Recently, I posted about
Squashing /usr and the 2.6.29 kernel, which is aimed at freeing up space by compressing the /usr directory.
When doing this, I forgot that this then makes the directory read-only, meaning you cannot install/remove/upgrade any packages on your system. The next vital step is to use unionfs which makes the compressed directory read
and write.
So, I will be covering that step now;
UnionFS for the 2.6.29 kernel
Be sure to have followed the instructions for installing the 2.6.29 kernel in the previous post.
As an additional to this, you will need to install the source, so download
http://kernel.ubuntu.com/~kernel-ppa/mainline/v2.6.29/linux-source-2.6.29_2.6.29-020629_all.deb and install it.
You will need to patch the source to include the relevant unionfs source and files. To do so, download the 2.6.29-rc2 patch:
http://download.filesystems.org/unionfs/unionfs-2.x/unionfs-2.5.1_for_2.6.29-rc2.diff.gz
Setup the linux source with the following commands;
sudo su
cd /usr/src
tar -jxvf linux-source*.tar.bz2
Note: The above commands will put you in super user mode, which we will continue to use for the rest of this tutorial.
Decompress the patch;
gzip -cd /PATH/TO/PATCH/unionfs*.gz
Apply the patch;
cd /usr/src/linux-source*
patch -p1 < /PATH/TO/PATCH/unionfs*.diff
Now you need to set up the source ready to compile unionfs;
make oldconfig && make prepare
You should be prompted three times for unionfs ending in "[N/m/y] (NEW)", or something to that effect. Make sure you enter "m" for each option.
Finally, we need to properly set up the Makefile which controls how unionfs is compiled for what we need. To do so, we're going to add a couple of lines to the Makefile which will depend on the location of the source directory. First, enter the following commands;
cd fs/unionfs
gedit Makefile
Then, add the following lines to the end, entering the directory where your source is (most likely /usr/src/linux-source-2.6.29);
all:
make -C /PATH/TO/SOURCE M=$(PWD) modules
clean:
make -C /PATH/TO/SOURCE M=$(PWD) clean
Note: The two lines above starting with "make" must have a tab before them.
Save and close the file.
Now we're ready to compile unionfs with the command;
make
This should create a file called unionfs.ko (as shown in the output) in the current directory.
If all went smooth, then we can install the module, and everything should be good to go for the next boot;
mkdir /lib/modules/'uname -r'/kernel/fs/unionfs
cp unionfs.ko /lib/modules/'uname -r'/kernel/fs/unionfs
depmod -a
Enjoy
On your next boot, you should have a working unionfs with your new kernel 2.6.29.