From owner-freebsd-bugs@FreeBSD.ORG Thu Dec 15 13:40:06 2005 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6D7BD16A41F for ; Thu, 15 Dec 2005 13:40:06 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id D56F643D60 for ; Thu, 15 Dec 2005 13:40:05 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id jBFDe5gg063958 for ; Thu, 15 Dec 2005 13:40:05 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id jBFDe5r5063957; Thu, 15 Dec 2005 13:40:05 GMT (envelope-from gnats) Date: Thu, 15 Dec 2005 13:40:05 GMT Message-Id: <200512151340.jBFDe5r5063957@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: "L. Jason Godsey" Cc: Subject: Re: misc/90415: Add -Z (no newfs) to sbin/mount_mfs. Use with existing vnode backed devices between reboots. X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: "L. Jason Godsey" List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Dec 2005 13:40:06 -0000 The following reply was made to PR misc/90415; it has been noted by GNATS. From: "L. Jason Godsey" To: bug-followup@freebsd.org Cc: Subject: Re: misc/90415: Add -Z (no newfs) to sbin/mount_mfs. Use with existing vnode backed devices between reboots. Date: Thu, 15 Dec 2005 05:30:00 -0800 (PST) Revised patch, if skipping newfs, you need to run fsck. Index: mdmfs.8 =================================================================== RCS file: /usr/ncvs/src/sbin/mdmfs/mdmfs.8,v retrieving revision 1.20 diff -u -r1.20 mdmfs.8 --- mdmfs.8 17 May 2004 08:35:41 -0000 1.20 +++ mdmfs.8 15 Dec 2005 13:28:17 -0000 @@ -263,6 +263,14 @@ .It Fl X Print what command will be run before running it, and other assorted debugging information. +.It Fl y +Force fsck to answer Yes if using existing vnode device. +(see the +.Fl Z +option). +.It Fl Z +Skip newfs(8) command. Use with existing vnode backed +devices between boots. .El .Pp The Index: mdmfs.c =================================================================== RCS file: /usr/ncvs/src/sbin/mdmfs/mdmfs.c,v retrieving revision 1.23 diff -u -r1.23 mdmfs.c --- mdmfs.c 10 Feb 2005 09:19:30 -0000 1.23 +++ mdmfs.c 15 Dec 2005 13:28:17 -0000 @@ -77,6 +77,7 @@ static void do_mount(const char *, const char *); static void do_mtptsetup(const char *, struct mtpt_info *); static void do_newfs(const char *); +static void do_fsck(const char *); static void extract_ugid(const char *, struct mtpt_info *); static int run(int *, const char *, ...) __printflike(2, 3); static void usage(void); @@ -86,10 +87,11 @@ { struct mtpt_info mi; /* Mountpoint info. */ char *mdconfig_arg, *newfs_arg, /* Args to helper programs. */ - *mount_arg; + *mount_arg, *fsck_arg; enum md_types mdtype; /* The type of our memory disk. */ bool have_mdtype; bool detach, softdep, autounit; + bool no_newfs; char *mtpoint, *unitstr; char *p; int ch; @@ -98,6 +100,7 @@ /* Misc. initialization. */ (void)memset(&mi, '\0', sizeof(mi)); + no_newfs = false; detach = true; softdep = true; autounit = false; @@ -113,6 +116,7 @@ */ mdconfig_arg = strdup(""); newfs_arg = strdup(""); + fsck_arg = strdup(""); mount_arg = strdup(""); /* If we were started as mount_mfs or mfs, imply -C. */ @@ -121,7 +125,7 @@ compat = true; while ((ch = getopt(argc, argv, - "a:b:Cc:Dd:e:F:f:hi:LlMm:Nn:O:o:p:Ss:t:Uv:w:X")) != -1) + "a:b:Cc:Dd:e:F:f:hi:LlMm:Nn:O:o:p:Ss:t:Uv:w:XyZ")) != -1) switch (ch) { case 'a': argappend(&newfs_arg, "-a %s", optarg); @@ -228,6 +232,12 @@ usage(); debug = true; break; + case 'y': + argappend(&fsck_arg, "-y"); + break; + case 'Z': + no_newfs = true; + break; default: usage(); } @@ -271,7 +281,11 @@ do_mdconfig_attach_au(mdconfig_arg, mdtype); else do_mdconfig_attach(mdconfig_arg, mdtype); - do_newfs(newfs_arg); + if (!no_newfs) { + do_newfs(newfs_arg); + } else { + do_fsck(fsck_arg); + } do_mount(mount_arg, mtpoint); do_mtptsetup(mtpoint, &mi); @@ -488,6 +502,15 @@ errx(1, "newfs exited with error code %d", rv); } +static void +do_fsck(const char *args) +{ + int rv; + rv = run(NULL, "%s -t ufs %s /dev/%s%d", "/sbin/fsck", args, mdname, unit); + if (rv) + errx(1, "fsck exited with error code %d", rv); +} + /* * 'str' should be a user and group name similar to the last argument * to chown(1); i.e., a user, followed by a colon, followed by a @@ -670,13 +693,13 @@ name = "mdmfs"; if (!compat) fprintf(stderr, -"usage: %s [-DLlMNSUX] [-a maxcontig] [-b block-size] [-c cylinders]\n" +"usage: %s [-DLlMNSUXZ] [-a maxcontig] [-b block-size] [-c cylinders]\n" "\t[-d rotdelay] [-e maxbpg] [-F file] [-f frag-size] [-i bytes]\n" "\t[-m percent-free] [-n rotational-positions] [-O optimization]\n" "\t[-o mount-options] [-p permissions] [-s size] [-v version]\n" "\t[-w user:group] md-device mount-point\n", name); fprintf(stderr, -"usage: %s -C [-lNU] [-a maxcontig] [-b block-size] [-c cylinders]\n" +"usage: %s -C [-lNUZ] [-a maxcontig] [-b block-size] [-c cylinders]\n" "\t[-d rotdelay] [-e maxbpg] [-F file] [-f frag-size] [-i bytes]\n" "\t[-m percent-free] [-n rotational-positions] [-O optimization]\n" "\t[-o mount-options] [-s size] [-v version] md-device mount-point\n", name);