Subject: towards a NetBSD LiveCD: /etc/rc.d/mountcritmem
To: None <tech-install@netbsd.org>
From: David Young <dyoung@pobox.com>
List: tech-install
Date: 12/02/2005 19:41:26
I use the attached rc script, mountcritmem, to make "Live" CD-ROMs.
mountcritmem makes copies select directories from a read-only root to a
read-write memory filesystem, and null-mounts the read-write copies at
the root.

Say I've written in rc.conf,

critical_filesystems_memory="/etc /home /tmp /var"

and I have added to /etc/fstab,

swap /mfs tmpfs rw,-s32M 0 0

mountcritmem will null-mount /{etc,home,tmp,var}/ at
/permanent/{etc,home,tmp,var}/, create directories {etc,home,tmp,var}
in /mfs/, and copy all of the files in /permanent/ to /mfs/.  Then it
null-mounts /mfs/* at /.

After mountcritmem runs, a read-only view of files on the CD-ROM is at
/permanent/, and there are read-write views at /mfs/ and at /.  It looks
like this:

# mount
/dev/wd0a on / type ffs (read-only, local)
tmpfs on /dev type tmpfs (local)
tmpfs on /mfs type tmpfs (local)
/etc on /permanent/etc type null (local)
/home on /permanent/home type null (local)
/tmp on /permanent/tmp type null (local)
/var on /permanent/var type null (local)
/mfs/etc on /etc type null (local)
/mfs/home on /home type null (local)
/mfs/tmp on /tmp type null (local)
/mfs/var on /var type null (local)

Comments?

Dave

-- 
David Young             OJC Technologies
dyoung@ojctech.com      Urbana, IL * (217) 278-3933