Subject: Re: live cd
To: M.Negovanovic <milosn@xtra.co.nz>
From: Jeremy C. Reed <reed@reedmedia.net>
List: netbsd-users
Date: 02/09/2004 14:40:42
On Tue, 10 Feb 2004, M.Negovanovic wrote:

> echo "Creating memory filesystems ..."
> echo "/var 30m"
> mount_mfs -s 30m -o noatime,rw swap /var
> echo "/etc 10m"
> mount_mfs -s 10m -o noatime,rw swap /etc

I do:

echo -n 'Creating critical read-write directories...'

cd /

filelist="tmp var/log var/run var/db var/cron var/at var/account var/mail
var/spool etc usr/pkg/etc usr/X11R6/etc home root"

for directory in $filelist
  do
        echo -n " $directory"
        if [ -e $directory ]
          then
                tar -cf - $directory | (cd /var/tmp; tar -xpf -)
                mount -t null /var/tmp/${directory} $directory
          fi
  done

  chmod 1777 /tmp

> echo "/dev 10m"
> mount_mfs -s 10m -o noatime,rw swap /dev

/dev is MFS by default. It is built-in to NetBSD's init(8) and used if
/dev/console is missing.

My devices are done with:

 echo 'Making devices in background'
 cp /usr/local/bin/MAKEDEV.real /dev/MAKEDEV
 (cd /dev ; sh /dev/MAKEDEV all ) &

> echo "Extracting /dev ..."
> cd /dev && tar zxpf /.cdstuff/dev.tgz
> echo "Extracting /etc ..."
> cd /etc && tar zxpf /.cdstuff/etc.tgz
> echo "Extracting /var ..."
> cd /var && tar zxpf /.cdstuff/var.tgz

I debated doing it that way. (See my code above to show how I just copy in
place.) I don't use tarballs, because I can test running the image by just
chrooting into it.

> As u can see there is no union option :). U simply mount over existing

I use mount_null instead of union. Where is an example of using
mount_union?

> /dev/cd0a / cd9660 ro 0 0
> swap /tmp mfs rw,nodev,noexec,nosuid,noatime,-s=10m 0 0
> swap /root mfs rw,noatime,-s=10m 0 0
> swap /home mfs rw,noatime,-s=10m 0 0

My fstab is like:
/dev/cd0a / cd9660 ro 0 0
swap            /var/tmp        mfs     rw,-s=20m       0 0

My rc.conf has:
critical_filesystems_local="/var/tmp"


   Jeremy C. Reed
   http://www.reedmedia.net/