Here is an example using the new 'shwh' (show-whiteouts) option, available in aufs-20080310.
Junjiro: Maybe you'd like to check this through and include it in the cvs source? ######################################################## # EXAMPLE USAGE OF THE 'shwh' OPTION ------ 2008.03.11 # ######################################################## The show-whiteout ('shwh') option can be used to merge aufs branches containing whiteouts. This example is based on the usage in larch-5.2 (http://larch.berlios.de), a live USB-stick construction kit, based on Arch Linux. The live system has an aufs root mount comprising three layers: Bottom: 'system', squashfs (underlying base system), read-only Middle: 'mods', squashfs, read-only Top: 'overlay', ram (tmpfs), read-write The top layer is loaded at boot from a tar-lzo archive, which can also be saved at shutdown, to preserve the changes made to the system during the session. When larger changes have been made, or smaller changes have accumulated, the tar-lzo archive will have reached a size where loading and saving it take an appreciable time. At this point, it would be nice to be able to merge the two overlay branches ('mods' and 'overlay') and rewrite the 'mods' squashfs, clearing the top layer and thus restoring save and load speed. This merging is simplified by the use of another aufs mount, of just the two overlay branches using the new 'shwh' option. In larch, access to the individual branches of the root aufs is made possible by using 'mount -o bind' in the initramfs. The tmpfs is made available at /.livesys, containing mount points /.livesys/mods and /.livesys/overlay for the two overlay branches. The new, merging aufs mount will be at /.livesys/merge_union and it can be prepared using the command: # mount -t aufs \ -o ro,shwh,br:/.livesys/overlay=ro+wh:/.livesys/mods=rr+wh \ aufs /.livesys/merge_union Note that the aufs mount must be 'ro'. A merged view of the two overlay branches is then available at /.livesys/merge_union, and the new feature is that the whiteouts (.wh..wh..opq, etc.) are visible! [[[ Remounting is also possible, e.g. # mount -t aufs -o ro,br:b1=ro+wh:b2=ro+wh aufs mp # mount -o remount,shwh mp Note again that the mount must be 'ro' before using remount with the 'shwh' option. Making the whiteouts vanish again is also possible: # mount -o remount,noshwh mp ]]] It is now possible to save the combined contents of the two overlay branches to a new squashfs, e.g.: # mksquashfs /.livesys/merge_union /path/to/newmods.squash This new squashfs archive can be stored on the boot device and the initramfs will use it to replace the old one at the next boot. [[[ A new tar-lzo overlay must of course also be built, e.g. (retaining as root directory 'overlay'): # tar -cf - -C /path/to overlay | lzop > /path/to/newoverlay.tar.lzo ]]] Share and Enjoy! mt ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/