Introduction
Based on original author instructions, do it:
Install
- Install Linux. Its tested at Ubuntu 8.04 (Hardy) but can work with other
- Install
aufs-tools
andinitramfs-tools
packages ```apt-get update
apt-get dist-upgrade
apt-get install aufs-tools initramfs-tools
1. Overwrite `/etc/initramfs-tools` contents with provided files
* `modules` has USB controllers
* `initramfs.conf` has changed to automatically handle dependency
* `scripts/init-bottom/rootaufs` is the main script
1. Make `rootaufs` executable
chmod 0755 /etc/initramfs-tools/scripts/init-bottom/rootaufs
1. Clean up `menu.lst` (of Grub bootloader)
update-grub
update-initramfs -u
1. Add `aufs=tmpfs` to some kernel entry if you want a "turnoff->wipe anything" behavior
1. Add `aufs=yes maskunit=USB-KEY-DEVICE` to some kernel entry if you want a "store changes at _USB-KEY-DEVICE_" behavior
* By default, is assumed that your _USB-KEY-DEVICE_ is formated with EXT3 filesystem
* If you want to use another filesystem type, add `maskfs=MYFSTYPE` too, but this needs to be a POSIX-capable filesystem, who includes ext2, ext4, reiserfs, etc. but excludes vfat (Windows filesytems) or ntfs. Chosen _MYFSTYPE_ is used by `mount` command.
* _USB-KEY-DEVICE_ can be any thing understood by Linux as an block device mapper, so can be used plain simple `/dev/sdxx` or `UUID=XPTO-KDCJA-O3JR...` or even NFS addresses.
1. Update your `initramfs`, used at boot time
update-initramfs -u
1. Update boot entries
grub-install MY-ROOT-DEVICE
``` 1. Reboot and choose any modified kernel option
How It Works
This works creating, at boottime, the following directories at the root of USB-KEY-DEVICE:
* /.rootaufs
* /.rootaufs/rw
* /.rootaufs/ro
Then it mounts local disk at /.rootaufs/ro
and external storage at /.rootaufs/rw
, and uses /
as a mountpoint of RW OVER RO, as if ro
are an used paper sheet and rw
a transparent paper sheet OVER the used one.
When you try to read some file at /
, system looks at rw
and then at ro
. When you modify something, it is wrote at rw
, and even complete deletions are wrote in a special manner that can be recognized by the system. This way you can safely do # rm -fr /
and watch your system being destroyed without warming the sysadmin. Of course that YOUR USB Key will not work next reboot but, hey, you deleted everything!
If you want do start from scratch, simple format your USB Key from another computer. This wipes rw
and system starts to use anything from ro
again.
Help-me help you!
If you found it awesome, but it works not for you, please report a bug and I'll try to get what happened and fix it. If you are feeling very brave, clone and fork this project, and ask me to merge after made something work.
Have any questions? Comment!
Credits
Thanks to Nicholas A. Schembri, by making that tmpfs
base, who would take a lot more time to be done by me.
Thanks to Prof. Fernando Auil, by being interested in this thing and motivated me to put effort in release it to world.