Bug 25730

Summary: [PATCH] mount_mfs is being phased out -> new diskless boot procedure
Product: Base System Reporter: krepel <krepel>
Component: confAssignee: Brian Dean <bsd>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff
none
file.diff
none
file.diff
none
rc.diskless1
none
rc.diskless2 none

Description krepel 2001-03-12 11:10:01 UTC
Due to mount_mfs is being phased out in preference for mdconfig, it is
necessary to make a new diskless boot procedure (after every mount_mfs
command the system paused for 15 seconds).

I have replaced the mount_mfs with mdconfig and add a boot switch "swap_enable".
Let me explaine some ideas behind this.

/etc/default/rc.conf:
I have add the "swap_enable" variable to have the knowledge during the boot
process if swap space is avaible or not. Because it is possible to havn't
any swap space. This will be need in the rc.diskless2 file.

/etc/rc.diskless1
Creat a memory disk (md) with malloc. We must use malloc because up to now
no "swapon -a" were made. This is done after rc.diskless1.
Null mount won't needed any more because we can umount the md and 
remount it without any losses.

/etc/rc.diskless2
When swap is enabled make mdconfig with swap is used otherwise make malloc.

Build the var dir from a pre-build var dir. This is easier than build all dirs
and files. With the old procedure many dirs and files are not created at boot
time.

Also the creation of the dev dir is obsolet because of DEVFS working now.
Perhaps it possible to switch between this two solutions depending on
a variable (I don't know if such a variable allready exist).

/etc/defaults/rc.conf
Add the "swap_enable" variable due to the previous explained reasons.

Fix: aries# diff -u rc.diskless1 /usr/src/etc/rc.diskless1
aries# diff -u rc.diskless2 /usr/src/etc/rc.diskless2
Comment 1 krepel 2001-03-30 17:53:31 UTC
I have implemented some good ideas from Mike Smith in my
rc.diskless{1,2} files and make some other changes:

1. Now I use the kernel flag "vm.nswapdev" to determine if swap is
available.

2. To determine if DEVFS are used I check the kernel flag
"vfs.devfs.generation" as it done within the /etc/rc file.

3. I write "chk_err" and "mkmd" functions also in rc.diskless2 because
the rc.diskless2 file is executed in the rc file: "sh rc.diskless2"
When you change this call to ". rc.diskless2" than the mkmd function
from rc.diskless2 could replace the mkmd function in rc.diskless1. The
chk_err funcktion in rc.diskless2 could be deleted.

The following knobs must be added in the /etc/defaults/rc.conf:

diskless_var_size="32m"
diskless_tmp_enable="NO"
diskless_tmp_size="32m"
diskless_dev_size="2m"

Maybe other values are more useful.

-- 
Falco Krepel			Phone:  +49-(0)30 - 34 63 - 7 276
GMD-FOKUS			Fax:    +49-(0)30 - 34 63 - 8 276
Kaiserin-Augusta-Allee 31	e-mail: krepel@fokus.gmd.de
10589 Berlin			WWW:	http://www.fokus.gmd.de/usr/krepel
Comment 2 dd freebsd_committer freebsd_triage 2001-06-19 02:18:50 UTC
Responsible Changed
From-To: freebsd-bugs->bsd

Brian seems to have done some work in this area recently.
Comment 3 bsd 2001-06-30 04:09:21 UTC
Most of the requested features have already been added to the
rc.diskless scripts.  Specifically, mfs has been completely removed
from -current and a wrapper function has been supplied for mounting
the memory filesystems.  This same wrapper name is used in -stable,
albeit, it is defined to use mount_mfs there.  Thus, the only
difference now between -current and -stable is the definition of the
'mount_md' shell function.

Additionally:

	* devfs is used automatically if it is available

	* /var is constructed using the /etc/mtree/BSD.var.dist file
          and /var/log/* are initially populated based on the contents
          of /etc/newsyslog.conf instead of hard-coding everything

	* /var and /tmp can be individually sized (using varsize and
          tmpsize) and /tmp can be seperate from /var/tmp now as well

I think the only thing left in the patch that is not already addressed
is making /var swap-backed if swap_enable is set to 'yes'.  If swap is
available, then by the time that rc.diskless2 runs, the sysctl
vm.swap_enabled could be checked instead of supplying a new rc
variable.  However, one may not want to do this in all cases due to
swap perhaps being on slow NFS storage, so I'm reluctant to make that
change.

If the submitter feels this feature is really important, I would
consider something like 'diskless_var_swapbk=YES' which would be
checked and cause /var to be set up swap-backed but only if the sysctl
vm.swap_enable reported true.

But before I spend time on this, please look over the newer code in
-current and -stable and let us know if it meets your needs.

-Brian
-- 
Brian Dean
bsd@FreeBSD.org
Comment 4 Brian Dean freebsd_committer freebsd_triage 2001-08-12 14:49:46 UTC
State Changed
From-To: open->closed

No feedback from submitter.