[Wylug-discuss] Running from usb

John Hodrien johnh at comp.leeds.ac.uk
Mon Sep 18 08:02:22 BST 2006


On Sun, 17 Sep 2006, Jim Jackson wrote:

> One technique I've seen, is to identify every file in the root partition
> that is written to, and make that file a link to a file somewhere else,
> e.g. some ramdisk or similar. Then mount the root file read-only.

This is the technique used by Fedora Stateless Linux.  An rc.readonly script
makes the necessary symlinks on boot to /var/writeable.  It's not perfect, but
it's quite quick to setup.  A snippet:

mount_empty_dir() {
     if [ -e ${1} ]; then
         mkdir -p /var/writable${1}
         mount -n --bind /var/writable${1} ${1}
     fi
}
mount_files_onlydirs() {
     if [ -e ${1} ]; then
         mkdir -p /var/writable${1}
         find ${1} -type d -print0 | cpio -p -0vd /var/writable &> /dev/null
         mount -n --bind /var/writable${1} ${1}
     fi
}
mount_files() {
     if [ -e ${1} ]; then
         find ${1} -print0 | cpio -p -0vd /var/writable &> /dev/null
         mount -n --bind /var/writable${1} ${1}
     fi
}

jh

-- 
"Committee - a group of men who individually can do nothing but as a group
  decide that nothing can be done."                   -- Fred Allen



More information about the Wylug-discuss mailing list