TvE 2100

At 2100 feet above Santa Barbara

Installing Unionfs on an Amazon EC2 Instance

This is a quick note how to install unionfs on an Amazon EC2 instance. Unionfs allows multiple filesystem trees to be overlaid. The particular purpose I’d like to use it is to create snapshots of filesystem changes. Basically I’d like to overlay an empty directory tree on some existing tree that I will modify, for example by installing new applications. What unionfs does, is it shows me the union of the two threes and if I change anything, it copy-on-writes whatever I’m changing into the topmost overlay. So after changing a bunch of files, all the changes appear in the overlay that started out empty. Now I can tar up the overlay and I have an exact record of everything I modified (a the file level).

I launched the new EC2 developer image (ami-26b6534f in ec2-public-images/developer-image.xml) First we need to download and expand the unionfs source:

cd /home   # I like to install stuff in /home, don't ask me why
wget ftp://ftp.fsl.cs.sunysb.edu/pub/unionfs/unionfs-1.2.tar.gz   # version for 2.1.16 kernel
tar zxf unionfs-1.2.tar.gz
cd unionfs-1.2

Next we need to fix /lib/modules:

rm /lib/modules//2.6.16-xenU/build
ln -s /usr/src/linux-2.6.16-xenU /lib/modules//2.6.16-xenU/build

And it turns out we need to install a little package that unionfs requires:

yum install e2fsprogs-devel

Finally we’re ready to build unionfs itself:

make

That worked, but a make install failed. I did the following to fix:

echo "install: install-utils" >> utils/Makefile
make install

Ready for unionfs? Here we go loading the module and a little test:

modprobe unionfs

make install