From owner-freebsd-questions@FreeBSD.ORG Fri Mar 4 22:56:25 2005 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E7AC016A4CE for ; Fri, 4 Mar 2005 22:56:25 +0000 (GMT) Received: from scorpion.eng.ufl.edu (scorpion.eng.ufl.edu [128.227.116.10]) by mx1.FreeBSD.org (Postfix) with SMTP id 353EF43D5A for ; Fri, 4 Mar 2005 22:56:25 +0000 (GMT) (envelope-from bob89@eng.ufl.edu) Received: (qmail 13020 invoked from network); 4 Mar 2005 22:56:24 -0000 Received: from scanner.engnet.ufl.edu (HELO ?128.227.152.221?) (128.227.152.221) by scorpion.eng.ufl.edu with SMTP; 4 Mar 2005 22:56:24 -0000 Message-ID: <4228E798.7040701@eng.ufl.edu> Date: Fri, 04 Mar 2005 17:56:24 -0500 From: Bob Johnson Organization: University of Florida User-Agent: Mozilla Thunderbird 1.0 (X11/20050131) X-Accept-Language: en-us, en MIME-Version: 1.0 To: "Michael R. Wayne" References: <200503032153.j23LrJTA026477@manor.msen.com> <8ca932905030314026f06ede8@mail.gmail.com> <20050304174809.GD70473@manor.msen.com> In-Reply-To: <20050304174809.GD70473@manor.msen.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit cc: freebsd-questions@freebsd.org cc: bob89@bobj.org Subject: Re: Are quotas possbile on md filesystems? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Mar 2005 22:56:26 -0000 Michael R. Wayne wrote: >On Thu, 03 Mar 2005 16:53:19 -0500, Michael R. Wayne wrote: > > >>Is it possible to use quotas on file-backed md filesystems >>on 5.3? I was guessing that a line in fstab like: >> >> > >OK, I see the error in my ways. My goal is to use file-based >filesystems that are preserved acoss boots. vnconfig says to >use mdconfig, the handbook suggests that the method I used is >correct. But everything is cleared on reboot, which is not >what I was looking for. > > > It appears that it always formats a new filesystem because that's what mount_mfs did, and mdmfs is a replacement for mount_mfs. I agree with you that that should not be the default behavior for a file-backed (vnode) disk, so I wrote a little patch to fix that: =========== --- mdmfs.c 2005/03/04 21:09:50 1.1 +++ mdmfs.c 2005/03/04 22:04:54 @@ -32,6 +32,7 @@ #include __FBSDID("$FreeBSD: src/sbin/mdmfs/mdmfs.c,v 1.20 2004/05/17 07:07:20 ru Exp $"); +/*$Id: mdmfs.c,v 1.5 2005/03/04 22:04:47 bobj Exp bobj $*/ #include #include @@ -89,7 +90,7 @@ *mount_arg; enum md_types mdtype; /* The type of our memory disk. */ bool have_mdtype; - bool detach, softdep, autounit; + bool detach, softdep, autounit, want_newfs; char *mtpoint, *unitstr; char *p; int ch; @@ -100,6 +101,7 @@ detach = true; softdep = true; autounit = false; + want_newfs = true; have_mdtype = false; mdname = MD_NAME; mdnamelen = strlen(mdname); @@ -119,10 +121,10 @@ 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:Uuv:w:X")) != -1) switch (ch) { case 'a': - argappend(&newfs_arg, "-a %s", optarg); + argappend(&newfs_arg, "-a %s", optarg); break; case 'b': argappend(&newfs_arg, "-b %s", optarg); @@ -151,6 +153,7 @@ usage(); mdtype = MD_VNODE; have_mdtype = true; + want_newfs = false; argappend(&mdconfig_arg, "-f %s", optarg); break; case 'f': @@ -213,6 +216,9 @@ case 'U': softdep = true; break; + case 'u': + want_newfs = true; + break; case 'v': argappend(&newfs_arg, "-O %s", optarg); break; @@ -268,7 +274,8 @@ do_mdconfig_attach_au(mdconfig_arg, mdtype); else do_mdconfig_attach(mdconfig_arg, mdtype); - do_newfs(newfs_arg); + if (want_newfs) + do_newfs(newfs_arg); do_mount(mount_arg, mtpoint); do_mtptsetup(mtpoint, &mi); @@ -666,7 +673,7 @@ if (!compat) fprintf(stderr, "usage: %s [-DLlMNSUX] [-a maxcontig [-b block-size] [-c cylinders]\n" -"\t[-d rotdelay] [-e maxbpg] [-F file] [-f frag-size] [-i bytes]\n" +"\t[-d rotdelay] [-e maxbpg] [-F file [-u]] [-f frag-size] [-i bytes]\n" "\t[-m percent-free] [-n rotational-positions] [-O optimization]\n" "\t[-o mount-options] [-p permissions] [-s size] [-w user:group]\n" "\tmd-device mount-point\n", name); ================ >So, what IS the correct way to create and use file-based file >systems? > > > Apply the patch above, then something in /etc/fstab like the following will not reformat the filesystem: /dev/md3 /mnt mfs rw,-F/vnodes/fileimage,noauto 0 0 If you want it to reformat the filesystem as the old mount_mfs did (or at least, as the old man pages say it did), then use something like /dev/md3 /mnt mfs rw,-F/vnodes/fileimage,-u,noauto 0 0 Note that -u MUST follow -F on the command line to have any effect. This breaks compatibility with the old mount_newfs. I guess I should have used to opposite sense for "-u". Which still would have broken compatibility, but not as much. This means that if this patch ever makes it into a FreeBSD distribution, it is likely to default to formatting rather than not formatting. This will lead to a nasty surprise if you aren't expecting it. In other words, don't use this patch unless you are desperately seeking a solution to a problem that makes it worth the risk. Don't blame me when some future change in behavior deletes your important filesystem. >And, can I put quotas on them? > > Don't know, but probably. If applying a patch is a mystery to you, try (assuming you have the full source installed) something that approximates this: # cd /usr/src/sbin/mdmfs # patch < /path/to/patch.file # make # make install If you want to be thorough, apply the following patch to fix the man page as well: =========== --- mdmfs.8 2005/03/04 22:06:21 1.1 +++ mdmfs.8 2005/03/04 22:38:38 @@ -24,6 +24,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD: src/sbin/mdmfs/mdmfs.8,v 1.20 2004/05/17 08:35:41 ru Exp $ +.\" $Id: mdmfs.8,v 1.4 2005/03/04 22:17:07 bobj Exp $ .\" .Dd February 26, 2004 .Dt MDMFS 8 @@ -36,13 +37,13 @@ driver .Sh SYNOPSIS .Nm -.Op Fl DLlMNSUX +.Op Fl DLlMNSUuX .Op Fl a Ar maxcontig .Op Fl b Ar block-size .Op Fl c Ar cylinders .Op Fl d Ar rotdelay .Op Fl e Ar maxbpg -.Op Fl F Ar file +.Op Fl F Ar file .Op Fl f Ar frag-size .Op Fl i Ar bytes .Op Fl m Ar percent-free @@ -57,7 +58,7 @@ .Ar mount-point .Nm .Fl C -.Op Fl lNU +.Op Fl lNUu .Op Fl a Ar maxcontig .Op Fl b Ar block-size .Op Fl c Ar cylinders @@ -238,6 +239,15 @@ It is only really useful to negate the .Fl S flag, should such a need occur. +.It Fl u +Install new UFS filesystem. This is only meaningful if +.Fl F +has already been specified, and is always done for swap-backed +.Pq Dv MD_SWAP +or +.Xr malloc 9 +.Pq Dv MD_MALLOC +backed disks. .It Fl v Ar version Specify the UFS version number for use on the file system; it may be either =========== - Bob Replies to my @eng.ufl.edu address will not be read on weekends. For that, send to @bobj.org or @wb4jcm.org