Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 12 Mar 2001 03:02:28 -0800 (PST)
From:      krepel@fokus.gmd.de
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   conf/25730: [PATCH] mount_mfs is being phased out -> new diskless boot procedure
Message-ID:  <200103121102.f2CB2Sr94198@freefall.freebsd.org>

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

>Number:         25730
>Category:       conf
>Synopsis:       [PATCH] mount_mfs is being phased out -> new diskless boot procedure
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Mar 12 03:10:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Falco Krepel
>Release:        5.0 current
>Organization:
GMD FOKUS
>Environment:
FreeBSD aries.fokus.gmd.de 5.0-CURRENT FreeBSD 5.0-CURRENT #0: Thu Mar  1 17:29:32 GMT 2001     root@aries.fokus.gmd.de:/usr/obj/usr/src/sys/GENERIC  i386

>Description:
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.
>How-To-Repeat:

>Fix:

aries# diff -u rc.diskless1 /usr/src/etc/rc.diskless1
--- rc.diskless1        Wed Mar  7 17:47:04 2001
+++ /usr/src/etc/rc.diskless1   Sun Oct  8 19:18:24 2000
@@ -98,14 +98,9 @@
 # WARNING! null mounts cannot handle mmap, and since many programs
 # use mmap (such as 'cp'), we have to copy.
 #
-# up to now we don't have make swapon and so we must use malloc
-#
-mdconfig -a -t malloc -s 2048 -u 10
-disklabel -r -w md10 auto 
-newfs /dev/md10c
-mount /dev/md10c /conf/etc
+mount_mfs -s 2048 -T qp120at dummy /conf/etc
 cp -Rp /etc/* /conf/etc
-chkerr $? "MD mount on /conf/etc"
+chkerr $? "MFS mount on /conf/etc"
 
 if [ -d /conf/${bootp_ipa} ] ; then
         cp -Rp /conf/${bootp_ipa}/etc/* /conf/etc
@@ -117,8 +112,7 @@
 
 # Make the new directory available as /etc
 #
-umount /dev/md10c
-mount /dev/md10c /etc
+mount_null /conf/etc /etc
 
 # Tell /etc/rc to run the specified script after
 # it does its mounts but before it does anything


aries# diff -u rc.diskless2 /usr/src/etc/rc.diskless2
--- rc.diskless2        Wed Mar  7 18:03:04 2001
+++ /usr/src/etc/rc.diskless2   Sun Oct  8 19:18:24 2000
@@ -38,29 +38,28 @@
        . /etc/rc.conf
 fi
 
-# If the diskless station work without swap use malloc instead of swap
-#
-case ${swap_enable} in
-[Yy][Ee][Ss])
-       mdconfig -a -t swap -s ${varsize:=65536} -u 11
-       ;;
-*)
-       mdconfig -a -t malloc -s ${varsize:=65536} -u 11
-       ;;
-esac
-
-disklabel -r -w md11 auto
-newfs /dev/md11c
-mount /dev/md11c /mnt
-
-# cp the pre-build /var dir and make available as /var
+mount_mfs -s ${varsize:=65536} -T qp120at dummy /var
+var_dirs="run dev db msgs tmp spool spool/mqueue spool/lpd spool/output \
+       spool/output/lpd"
+for i in ${var_dirs}
+do
+    mkdir /var/${i}
+done
+chmod 755 /var/run
+chmod 755 /var/db
+chmod 755 /var/spool
+chmod 1777 /var/tmp
+chown -R root.daemon /var/spool/output
+chgrp daemon /var/spool/lpd
 #
 # XXX make sure to create one dir for each printer as requested by lpd
 #
-cp -Rp /var/* /mnt
-umount /dev/md11c
-mount /dev/md11c /var
 
 if [ ! -h /tmp -a ! -h /var/tmp ]; then
        mount_null /var/tmp /tmp
 fi
+
+# extract a list of device entries, then copy them to a writable partition
+(cd /; find -x dev | cpio -o -H newc) > /tmp/dev.tmp
+mount_mfs -s 4096 -i 512 -T qp120at dummy /dev
+(cd /; cpio -i -H newc -d < /tmp/dev.tmp)


--- defaults/rc.conf    Wed Mar  7 17:39:08 2001
+++ /usr/src/etc/defaults/rc.conf       Wed Feb 28 22:28:00 2001
@@ -19,7 +19,6 @@
 ###  Important initial Boot-time options  ####################
 ##############################################################
 
-swap_enable="YES"      # Set to NO to disable swapspace
 swapfile="NO"          # Set to name of swapfile if aux swapfile desired.
 apm_enable="NO"                # Set to YES to enable APM BIOS functions (or NO).
 apmd_enable="NO"       # Run apmd to handle APM event from userland.

>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?200103121102.f2CB2Sr94198>