lemoncube.com Search: (normal)


Linux - Small Footprint install

So why do I need 1gb to install a linux system? I realise that (within 6 months) 80gb hard drives will be the smallest hard drive that your money can buy, but it still seems a waste.

In the past I have installed what I thought were cut down Slackware installs; picking the minimum of install options. Even so I still ended up with ~500mb installs. This still seemed like a bit of overkill. So how do you make it smaller?

I've recently been playing with cramfs filesystems. Basically, cramfs is a simple compressed filesystem using zlib. The downside is that it is definately read-only. My theory is that if I say installed all of Slackware into a cramfs filesystem, but used symlinks to keep it separate, then I could definately save some space.

Lets say we take a 500mb cramfs rootfs and copy it into a cramfs image file. In our new empty root file system we'll just put that cramfs.img file in the root of the file system. The first thing our new system will do will be to loopback mount that image file on /cram. Meanwhile our rootfs will still be an ext2/ext3 type read/writeable filesystem. In order to make it useable, we populate the read/writeable filesystem with links.

    /usr/bin/bash -> /cram/usr/bin/bash
    /usr/bin/ls   -> /cram/usr/bin/ls
    /usr/bin/df   -> /cram/usr/bin/df
We end up with loads and loads of links. The key benefit is that if we wanted to upgrade our version of bash we could just write over the link with a real file. Sure this would stuff up having everything compressed in the cramfs.img but it gives us a lot of flexability.

If we really wanted to save on the number of links then we could link at the directory level for things that are unlikely to be updated.

pablo , 2003-06-30 17:57:06