From 3cc4938297c88cc1f7b39876590c6593a9dd3211 Mon Sep 17 00:00:00 2001 From: bsd Date: Wed, 9 May 2001 15:13:51 +0000 Subject: * Simplify the population of the /etc memory filesystem. To avoid the null mount, we currently create a temporary mfs on /tmp, copy /etc to /tmp, then mount /etc as mfs and copy everything back from /tmp, then delete the /tmp mfs. The patch eliminates the temporary /tmp mfs and the subsequent copying and simply populates the /etc mfs by copying from /conf/default/etc. This requires that /conf/default/etc contain a complete copy of all the /etc stuff instead of just overrides. I don't think that is too much of an extra step in setting up a diskless environment. * Provide the ability to make /tmp a memory filesystem independent of /var. This removes the requirement that /tmp be a symlink to /var/tmp and this makes the diskless code work with the default filesystem layout. If a seperate /tmp memory filesystem is created, the 'tmpsize' environment variable is used to determine its size (default to 10 Meg). * Reduce diffs between the -current and -stable versions of these files to a bare minimum. Only the definition of the shell function 'mount_md' is different. Not Objected to by: -arch@, -small@ MFC after: 2 days --- etc/rc.diskless2 | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'etc/rc.diskless2') diff --git a/etc/rc.diskless2 b/etc/rc.diskless2 index 189d5e3..a3f58fe 100644 --- a/etc/rc.diskless2 +++ b/etc/rc.diskless2 @@ -29,10 +29,20 @@ # rc.diskless2 # +# Provide a function for normalizing the mounting of memory +# filesystems. This should allow the rest of the code here to remain +# as close as possible between 5-current and 4-stable. +# $1 = size +# $2 = mount point +# $3 = md unit number (ignored in pre 5.0 systems) +# $4 = (optional) bytes-per-inode mount_md() { + if [ -n "$4" ]; then + bpi="-i $4" + fi /sbin/mdconfig -a -t malloc -s $1 -u $3 /sbin/disklabel -r -w md$3 auto - /sbin/newfs /dev/md$3c + /sbin/newfs $bpi /dev/md$3c /sbin/mount /dev/md$3c $2 } @@ -46,7 +56,7 @@ elif [ -r /etc/rc.conf ]; then fi echo "+++ mfs_mount of /var" -mount_md ${varsize:=65536} /var 2 +mount_md ${varsize:=65536} /var 1 echo "+++ populate /var using /etc/mtree/BSD.var.dist" /usr/sbin/mtree -deU -f /etc/mtree/BSD.var.dist -p /var @@ -63,11 +73,11 @@ mount -a # chown and chgrp are in /usr # XXX make sure to create one dir for each printer as requested by lpd # -# We assume that /tmp is symlinked to /var/tmp on the shared root -# partition. mount_null seems to have problems. -#if [ ! -h /tmp -a ! -h /var/tmp ]; then -# mount_null /var/tmp /tmp -#fi +# If /tmp is a symlink, assume it points to somewhere writable, like +# /var/tmp, otherwise, use a small memory filesystem for /tmp. +if [ ! -h /tmp ]; then + mount_md ${tmpsize:=20480} /tmp 2 +fi if sysctl vfs.devfs.generation > /dev/null 2>&1 ; then # we have DEVFS, no worries... @@ -75,6 +85,6 @@ if sysctl vfs.devfs.generation > /dev/null 2>&1 ; then else # extract a list of device entries, then copy them to a writable fs (cd /; find -x dev | cpio -o -H newc) > /tmp/dev.tmp - mount_mfs -s 4096 -i 512 -T qp120at dummy /dev + mount_md 4096 /dev 3 512 (cd /; cpio -i -H newc -d < /tmp/dev.tmp) fi -- cgit v1.1