Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Jan 2001 19:46:13 -0800 (PST)
From:      John Baldwin <jhb@FreeBSD.org>
To:        Dima Dorfman <dima@unixfreak.org>
Cc:        Poul-Henning Kamp <phk@critter.freebsd.dk>, mi@aldan.algebra.com, cvs-all@FreeBSD.org, cvs-committers@FreeBSD.org
Subject:   Re: cvs commit: src/sys/i386/conf GENERIC
Message-ID:  <XFMail.010130194613.jhb@FreeBSD.org>
In-Reply-To: <20010131025101.DA9A13E02@bazooka.unixfreak.org>

next in thread | previous in thread | raw e-mail | index | archive | help

On 31-Jan-01 Dima Dorfman wrote:
>> How about this: for /etc/fstab:
>> 
>> /dev/md0        /tmp    mfs     rw      0       0
> 
> How about replacing /dev/md0 with /dev/null or something and using the
> fact that mdconfig can dynamically assign a unit number?  Specifying a
> specific could still be an option, of course.  Also, maybe s/mfs/md/
> to avoid questions like, "Why does mfs show up as md?"

'mfs' would be the actual file system.  Perhaps it should really be 'ffs' then,
but something else would have to newfs the disk on boot.  If you wanted it
dynamic, maybe use /dev/md w/o a unit number.  /dev/null is very non-intuitive
in this case.  Remember that we want to be able to do: 'mount -p > /etc/fstab'
to recover a lost fstab still if things blow up and get something close to
useful.

>> Have mount_mfs be a suitable script or program that will create /dev/md0
>> as a swap-backed md(4) and then disklabel, newfs, and mount it.
> 
> Writing a Perl/sh/whatever script to take the arguments passed to it
> by mount(8) and run mdconfig/disklabel/newfs/etc. with the
> corresponding arguments seems rather trivial.  One of the problems is
> how to call mdconfig to deallocate the resources when it is unmounted.
> If this can be resolved and the idea seems reasonably acceptable, I'll
> gladly submit patches.
> 
> Thanks
> 
>                                       Dima Dorfman
>                                       dima@unixfreak.org

man mdconfig(8):  mdconfig -d.  However, the real issue is that you have a
memory "disk" as it were, and fstab is just for filesystem stuff.  mdconfig is
the util to manage the memory disks, and once you have a memory disk, you can
disklabel, newfs, and mount it just like any other memory disk.  Thus, you can
actually just use a normal:

/dev/md0c       /tmp    ffs     rw      0       0

entry in /etc/fstab with no changes to any system tools, all you need is
possibly a /etc/md.conf file that gets parsed during /etc/rc before filesystems
are mounted that will setup and created needed memory disks.  Perhaps something
simple like this:

# $FreeBSD$
#
# This file lists md(4) disks created during system initialization.
#
# device     type    size   flags   newfs
md0          swap    256m   none    yes

Where setting newfs to yes implies disklabel + newfs.  OTOH, this is now
somewhat complicated, and if the common case of /tmp is all we really want to
automate, having a 'tmpfs_size' variable in /etc/rc.conf that defaults to NO
along the lines of Sheldon's patch might be enough for the common case.  In
this case, you wouldn't list the filesystem in /etc/fstab at all, but just put
'tmpfs_size="256m"' and perhaps 'tmpfs_type="swap"' in /etc/rc.conf and it
would create, label, newfs, and mount an autonumbered disk on /tmp.

-- 

John Baldwin <jhb@FreeBSD.org> -- http://www.FreeBSD.org/~jhb/
PGP Key: http://www.baldwin.cx/~john/pgpkey.asc
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.010130194613.jhb>