Date: Fri, 25 Jul 1997 14:56:15 -0700 (PDT) From: "Jin Guojun[ITG]" <jin@adv-pc-1.lbl.gov> To: FreeBSD-gnats-submit@FreeBSD.ORG Subject: bin/4167: dump fials for dumping subdirectory Message-ID: <199707252156.OAA00641@adv-pc-1.lbl.gov> Resent-Message-ID: <199707252200.PAA27012@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 4167
>Category: bin
>Synopsis: dump fials for dumping subdirectory
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Fri Jul 25 15:00:01 PDT 1997
>Last-Modified:
>Originator: Jin Guojun[ITG]
>Organization:
>Release: FreeBSD all-RELEASE i386
>Environment:
all FreeBSD RELEASEs
>Description:
dump only dumps on the root of a file system.
>How-To-Repeat:
# uname -r
2.2.2-RELEASE
# dump 0f - src
DUMP: Date of this level 0 dump: Fri Jul 25 14:10:19 1997
DUMP: Date of last level 0 dump: the epoch
DUMP: Dumping src to standard output
DUMP: bad sblock magic number
DUMP: The ENTIRE dump is aborted.
# dump 0f - /data/src | (cd /X/src ; restore xf -)
DUMP: Date of this level 0 dump: Fri Jul 25 14:10:58 1997
DUMP: Date of last level 0 dump: the epoch
DUMP: Dumping /data/src to standard output
DUMP: bad sblock magic number
DUMP: The ENTIRE dump is aborted.
Tape is not a dump tape
# dump 0f - /data | (cd /X/src ; restore xf -)
DUMP: Date of this level 0 dump: Fri Jul 25 14:11:22 1997
DUMP: Date of last level 0 dump: the epoch
DUMP: Dumping /dev/rsd0s2e (/data) to standard output
DUMP: mapping (Pass I) [regular files]
DUMP: mapping (Pass II) [directories]
DUMP: estimated 408089 tape blocks.
DUMP: dumping (Pass III) [directories]
DUMP: dumping (Pass IV) [regular files]
DUMP: 82.06% done, finished in 0:02
DUMP: DUMP: 408117 tape blocks
DUMP: finished in 707 seconds, throughput 577 KBytes/sec
DUMP: DUMP IS DONE
set owner/mode for '.'? [yn] y
# uname -r
3.0-970618-SNAP
# dump 0f - /usr/src/sys | more
DUMP: Date of this level 0 dump: Fri Jul 25 14:18:12 1997
DUMP: Date of last level 0 dump: the epoch
DUMP: Dumping /usr/src/sys to standard output
DUMP: bad sblock magic number
DUMP: The ENTIRE dump is aborted.
# dump 0f - /usr/src | more
DUMP: Date of this level 0 dump: Fri Jul 25 14:18:25 1997
DUMP: Date of last level 0 dump: the epoch
DUMP: Dumping /usr/src to standard output
DUMP: bad sblock magic number
DUMP: The ENTIRE dump is aborted.
# dump 0f - /usr | more
DUMP: Date of this level 0 dump: Fri Jul 25 14:23:32 1997
DUMP: Date of last level 0 dump: the epoch
DUMP: Dumping /dev/rwd0s2e (/usr) to standard output
DUMP: mapping (Pass I) [regular files]
DUMP: mapping (Pass II) [directories]
DUMP: estimated 358154 tape blocks.
DUMP: dumping (Pass III) [directories]
>Fix:
---------------- /usr/src/sbin/dump/main.c ----------
Line 337:
if ((diskfd = open(disk, O_RDONLY)) < 0) {
msg("Cannot open %s\n", disk);
exit(X_ABORT);
}
sync();
sblock = (struct fs *)sblock_buf;
bread(SBOFF, (char *) sblock, SBSIZE);
if (sblock->fs_magic != FS_MAGIC)
quit("bad sblock magic number\n");
Line 347: ...
-----------------------
The variable "disk" on line 338 needs to be replaced as
open(disk, ...) ==> open(get_rawdisk(disk), ...)
by using following routines.
-------------------- raw-dev.c ----------------------
#include "something may need"
#include <sys/stat.h>
#include <sys/mount.h>
static
subpath(full, sub)
register char *full, *sub;
{
if (full && sub) {
register int len = strlen(sub);
return !strncmp(sub, full, len);
}
}
char *
get_rawdisk(name)
char *name;
{
long mntsize, i;
struct statfs *mntbuf;
static char cwd[256];
mntsize = getmntinfo(&mntbuf, MNT_NOWAIT);
if (*name != '/' && cwd[0] == '\0') {
if (!getwd(cwd)) {
cwd[0] = 0;
return 0;
}
name = cwd;
}
for (i=mntsize; i--;)
if (!strcmp(mntbuf[i].f_mntonname, name) ||
subpath(name, mntbuf[i].f_mntonname)) {
register char* cp=mntbuf[i].f_mntfromname;
if (!strncmp(cp, "/dev/", 5))
bcopy(cp+5, cp+6, strlen(cp)-5),
cp[5] = 'r';
return cp;
}
return (0);
}
---------------- end of raw-dev.c ------------------------
Hopefully, this will not break other things.
>Audit-Trail:
>Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199707252156.OAA00641>
