Date: Sat, 24 Jul 1999 11:52:07 -0700 (PDT) From: bob@pmr.com To: freebsd-gnats-submit@freebsd.org Subject: bin/12789: Confusing error msg when dumping a filesystem by mount point thats not in /etc/fstab Message-ID: <19990724185207.7764614DE6@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 12789 >Category: bin >Synopsis: Confusing error msg when dumping a filesystem by mount point thats not in /etc/fstab >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Jul 24 12:00:01 PDT 1999 >Closed-Date: >Last-Modified: >Originator: Bob Willcox >Release: 3.2-stable >Organization: Power Micro Research >Environment: FreeBSD luke.pmr.com 3.2-STABLE FreeBSD 3.2-STABLE #7: Tue Jul 20 12:00:05 CDT 1999 bob@luke.pmr.com:/usr/src/sys/compile/LUKE i386 >Description: When dumping a filesystem by specifying its mount point (rather than its special file name) if there is no entry in fstab for the filesystem dump fails with what can be a misleading error message. For example if I dump /bsd (which has no fstab entry I get): bob@luke-pf /usr/src/sbin/dump> dump -0ab 32 -f /dev/null /bsd DUMP: Date of this level 0 dump: Sat Jul 24 13:21:19 1999 DUMP: Date of last level 0 dump: the epoch DUMP: Dumping /bsd to /dev/null DUMP: bad sblock magic number What has happened here is that dump, because it did not find an entry for /bsd in /etc/fstab has opened the directory /bsd and tried to dump it (and, of course, failed since it has no superblock). >How-To-Repeat: Run dump against a mounted filesystem that has no entry in /etc/fstab and specifify its mount point rather than the special file path. >Fix: I have implemented a simple additional check to see that the open file (should be the filesystem) isn't a directory (as it will be in this case). If it is a directory, the changed code prints a warning message to assist the user in diagnosing what he has done wrong. The output from dump will now look like this: bob@luke-pf /usr/src/sbin/dump> /usr/obj/usr/src/sbin/dump/dump -0ab 32 -f /d > DUMP: Date of this level 0 dump: Sat Jul 24 13:47:39 1999 DUMP: Date of last level 0 dump: the epoch DUMP: Dumping /bsd to /dev/null DUMP: WARNING: /bsd will be processed as a directory, not a filesystem DUMP: bad sblock magic number DUMP: The ENTIRE dump is aborted. There are, no doubt, other and likely better ways to solve this problem but this worked for me (next time I won't spend so much time tracking down what's really wrong). Here is a patch for the change should you be interested: Index: src/sbin/dump/main.c =================================================================== RCS file: /usr/cvs/FreeBSD/src/sbin/dump/main.c,v retrieving revision 1.18 diff -u -r1.18 main.c --- main.c 1998/09/16 20:52:12 1.18 +++ main.c 1999/07/24 18:47:32 @@ -68,6 +68,7 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> +#include <sys/stat.h> #include "dump.h" #include "pathnames.h" @@ -104,6 +105,7 @@ register int ch; int i, anydirskipped, bflag = 0, Tflag = 0, honorlevel = 1; ino_t maxino; + struct stat sb; spcl.c_date = 0; (void)time((time_t *)&spcl.c_date); @@ -327,6 +333,11 @@ msg("Cannot open %s\n", disk); exit(X_STARTUP); } + if (fstat(diskfd, &sb)) + quit("unable to fstat filesystem"); + if (S_ISDIR(sb.st_mode)) + msg("WARNING: %s will be processed as a directory, not a filesystem\n", + disk); sync(); sblock = (struct fs *)sblock_buf; bread(SBOFF, (char *) sblock, SBSIZE); >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990724185207.7764614DE6>