Knoppix 3.8 and UnionFS. Wow. Just Wow.
Knoppix 3.8 and UnionFS. Wow. Just Wow.
by Kyle Rankin
Mar. 14, 2005
URL: http://www.heise.de/english/newsticker/news/56987
Klaus has released the latest version of Knoppix, 3.8, to the crowd at CeBIT 2005. This version includes the normal round of updates including the 2.6.11 kernel by default, KDE 3.3.2, and Firefox and Thunderbird instead of Mozilla. The exciting news, however, is the addition of UnionFS. UnionFS stacks your Knoppix ramdisk on top of the read-only filesystem on the CD, the effect being that you can apt-get install, and otherwise modify all of the files on the system as though they were all writeable. Here I’ll go over why I think this is going to change Knoppix in a major way.
One of the struggles with using Knoppix day-to-day as a portable distribution has always been the fact that the majority of the CD was read-only. You had a nice ramdisk sandbox that let you write within the /home directory, and tinker in /etc if you changed some of the symlinks. If you wanted persistence, there was a nice script that created a small filesystem on writeable media like a usb thumbdrive and used it to store your home directory.
The Problem
The problem, of course, is that you couldn’t install new programs with this method. All of /usr is read-only. Over time various methods have been introduced to try to hack around this by redirecting binaries into the /home directory and changing various system paths. The live software installer that came with previous versions of Knoppix is one example, and klik is another. These worked okay, depending on the program, but in some cases relied on hacks such as using scripts to search and replace file paths within binaries.
The Solution
Enter UnionFS. With this system, basically every segment of the filesystem is read-write. UnionFS keeps track of which files you have modified (which are modified and stored within the ramdisk) and which are unmodified, all on the fly. When you access a file in the filesystem that has been modified, UnionFS points you to the copy in ramdisk instead of the copy on the CD-ROM. This means that if you, say, want to install the enlightenment window manager all you would need to do is:
knoppix@2[knoppix]$ sudo apt-get update
knoppix@2[knoppix]$ sudo apt-get install enlightenment
You can install programs just like with Debian. They all get installed to their regular locations, and if you check out the /ramdisk directory on the CD, you will see a mirror of the root directory structure (or at least the directories that have been modified) and can see all of the files that you have changed. You can even use your favorite graphical packaging program (if you have one) to install packages.
This also means that if you set up a persistent home directory, you can potentially back up all of these changes and restore them at boot. In fact, Knoppix 3.8 already has a modified persistent home script that does just this (although it’s still a beta feature so expect to see bugs here and there). Knoppix can even detect when you have done this on a drive when it boots, and will let you choose what features to restore from this image (if any). If you let it time out, Knoppix does the safe thing and doesn’t load any of the settings.
The latest persistence script also automates the process of setting up an AES256-encrypted home directory, so if you are concerned about the security of your persistent image you can enable this option, type in a passcode, and Knoppix does the rest.
I really think UnionFS is going to take Knoppix to a whole new level of ubiquitous computing. You can truly use the CD just like any other installed CD, and with the prices of usb thumbdrives continuing to drop, you can basically install anything you would like. Major changes, such as replacing KDE with Gnome, probably will still work better if you do a full remaster, but I expect all of the Knoppix-based live CDs (if they are smart) will incorporate this technology into future releases.
Can you tell that I’m excited about this? Like I said, currently it seems to be a bit buggy (on a few of my machines I seem to get some instability after I restore from an image), but I imagine that sort of thing will be ironed out once the "download version" of Knoppix 3.8 hits http://www.knoppix.org.
Kyle Rankin is a system administrator for The Green Sheet, Inc., the current president of the North Bay Linux Users Group, and the author of Knoppix Hacks.