Title: unionfs mini howto Subject: This is an filesystem exercise, to expand how you see file systems. Terms: Squashfs - read-only filesystem, very compact. tmpfs - read-write filesystem, ramdisk, temporary storage. unionfs - filesystem overly system, overly writeable over readonly fs. REFERENCE: http://gentoo-wiki.com/HOWTO_Diskless:_Unionfs._Why_not%3F # In gentoo install unionfs # 1st. Unpask echo 'sys-fs/unionfs ~x86' >> /etc/portage/package.keywords # 2nd. Version is kernel specific # For Kernel 2.6.18 use unionfs-1.4 # For Kernel 2.6.19 use unionfs-1.5 # emerge --deep --newuse =sys-fs/unionfs -ta # 3rd. Update module info depmod -a modules-update # 4th. Load moudle modprobe unionfs # 5th. Veirfy I have installed unionfs-1.5_pre200701042308 eix -I unionfs [I] sys-fs/unionfs Available versions: (~)1.0.14 (~)1.1.4-r2 (~)1.1.5 (~)1.2 (~)1.3 (~)1.4 (~)1.5_pre200701042308 Installed versions: 1.5_pre200701042308(10:59:18 03/19/07)(-acl -debug kernel_linux -nfs) Homepage: http://www.fsl.cs.sunysb.edu/project-unionfs.html Description: Stackable unification file system, which can appear to merge the contents of several directories # 6th. Verify my gentoo kernel is 2.6.19-gentoo-r5 uname -r 2.6.19-gentoo-r5 # 7th. Load unionfs modprobe unionfs # 8th. Check for loaded module lsmod |grep union unionfs 79240 0 exportfs 5280 1 unionfs # Example using using # 1st. Create 3 directories used in the example: mkdir /tmp/new_ro /tmp/new_rw /tmp/new # 2nd. Create a readonly mount of a squashfs to /tmp/new_ro mkdir -p /tmp/test/if/this/works mksquashfs /tmp/test /tmp/new_squash.sqsh -info -always-use-fragments mount -t squashfs -o loop /tmp/new_squash.sqsh /tmp/new_ro # 3rd. Create a writeable mount of a tmpfs to /tmp/new_rw mount -t tmpfs -o size=50m none /tmp/new_rw # 4th. Create the Union of /tmp/new_rw over /tmp/new_ro as /tmp/new/ mount -t unionfs -o dirs=/tmp/new_rw:/tmp/new_ro unionfs /tmp/new # 5th. Test write touch /tmp/new/foo ls -alF /tmp/new/ total 1 drwxrwxrwt 3 root root 60 Mar 21 17:53 ./ drwxrwxrwt 20 root root 824 Mar 21 17:50 ../ -rw-r--r-- 1 root root 0 Mar 21 17:53 foo drwxr-xr-x 3 root root 21 Mar 21 17:35 if/ # 6th. Cleanup unmount /tmp/new umount /tmp/new_* rm -rf /tmp/new*