[Wylug-discuss] Running from usb

Jim Jackson jj at franjam.org.uk
Sun Sep 17 16:57:47 BST 2006



On Sun, 17 Sep 2006, tom hall wrote:

> ive been building a few NASs with a custom debian install running from
> a usb flash memory stick, using these instructions
> http://feraga.com/node/30
> basically the trick is mounting as many of the oft-written filesystems
> in ram as you can
>
> """
> #/etc/fstab
> /dev/sda2        /          ext2    defaults,errors=remount-ro,noatime 0 1
> /dev/sda1       /boot          ext2    defaults,noatime                   0 1
> none            /proc          proc    defaults                           0 0
> tmpfs           /etc/network/run tmpfs defaults,noatime                   0 0
> tmpfs           /tmp           tmpfs   defaults,noatime                   0 0
> tmpfs           /var/lock      tmpfs   defaults,noatime                   0 0
> tmpfs           /var/log       tmpfs   defaults,noatime                   0 0
> tmpfs           /var/run       tmpfs   defaults,noatime                   0 0
> tmpfs           /var/tmp       tmpfs   defaults,noatime                   0 0
> """
>
> This is not as neat as i would like, zero writes (with the option of
> syncing to disk) is what im after.

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.

> Ive seen UnionFS and think it maybe what im after, but am open to suggestions.
> ideally, id like the system loaded into ram, changed there and synced
> on command to the stick.

If you had 2 partitions on your USB stick - one for root and another say
"save", then you could make the shutdown copy the file in ram to the
"save" partition. You could modify init to do the reverse and copy the
files into ram - though that might need some care abd further thought.

Of course you'll loose the ram files if the system crashes. And it does
depend on how big the files may get and the size of your RAM.

Sound sinteresting - What hardware are you doing this on?

Jim





More information about the Wylug-discuss mailing list