Archive

Knoppix Union FS

Introduction

Knoppix is a live-CD distribution of Linux based on Debian. Once you’ve made a CD, you simply put it in your CD/DVD drive and boot from the drive, the system detects all your hardware, and within about a minute you have a fully-functioning KDE Desktop.

Previously, Knoppix’s primary uses have been as a demo of Linux, or as an environment for fixing a broken system. However, since the recent release of version 3.8, Knoppix has incorporated a system called UNIONFS.

What UNIONFS does, and why it’s important

Until Recently…

Knoppix <=3.7 had a script that created a Persistent Home Directory, which was basically a file that saved a copy of the user’s /home to disk, and then mounted it to /home when Knoppix was booted. This allowed users to carry their documents, settings and whatnot on a USB Stick or similar device. However, short of remastering and burning a new Knoppix CD, the user couldn’t cleanly install their own programs permanently, and would have to wait for the next Knoppix release for security updates, etc.

Enter UNIONFS

UNIONFS combines two or more branches of a file system together, so they behave as if they were merged together. The branches have an order of precedence, which determines where things are read from and written to. Although the branches of the filesystem appear to be merged, they are still stored seperately.

UNIONFS and Knoppix

The implications of UNIONFS for Knoppix are brilliant. When you boot Knoppix, the read-only filesystem is mounted to /KNOPPIX. This is them merged with the read-write /ramdisk in /UNIONFS, allowing the user to make any temporary changes they wish. If the user then uses the new Persistant Disk Image (not just a Home Directory any more) this can then be mounted to /KNOPPIX.IMG and merged with the other two filesystems in /UNIONFS. Now, if the user runs Firefox, they get Firefox 1.01 from the CD. However, if they run sudo apt-get install mozilla-firefox Firefox is updated to the latest version. Now when the user runs Firefox, UNIONFS automatically sorts out what’s where using symbolic links, and seemlessly runs the program using the old bits on the CD and the new bits on the Persistent Image. In short, this means that, with Knoppix’s Auto-magical hardware detection capabilites and a USB stick, you can take your Linux desktop with you and use it anywhere (within reason). Cool, no?

How To Do It

You Will Need:

  • Knoppix 3.8 CeBit Edition or later

  • A formatted storage partition (you can use Qtparted on Knoppix for this)
  • A little bit of patience

What to do: (it looks long, but a lot of it’s clicking “OK”) #Place the Knoppix CD in the drive, and set your BIOS to boot from the said drive. #Once the system’s booted, open the KMenu, and Select KNOPPIX->Configure->Create a persistent KNOPPIX disk image #You’ll see a dialogue asking if you want to create a persistent image. (Don’t worry if it says about Home Directories, that’s just an artifact from the old script) As you’re reading this, I’ll assume you click “Yes” #Next you’ll see a list of detected partitions. Make sure you know which one you’re after, click the radio button and click Ok #You’ll be asked to enter the size of the image IN MEGABYTES. How big you want it depends on what you’re going to use it for. If you’re using this as your primary system, you’ll probably want a fair few GB. If it’s just for playing with, or as a demo, probably less. #Now you’ll be asked if you want to use encryption. Unless you’re carrying sensitive data around, I wouldn’t reccommend this. You’ll have to enter a 20 character password every time you boot. If it’s not vital, just click “No” #Here’s where you need patitence. You’ll see a progress bar saying “Preparing for Linux filesystem”. It goes quickly enough, but when it gets to 96% it seems to hang. Don’t worry, it’s still going. If you need confirmation of this, just open the mountpoint of the device the image is being made on. You’ll see knoppix.img there, and if you hit refresh, you’ll see it’s getting bigger. Just WAIT, RELAX, and let it work. #Once it’s done you’ll get a dialouge telling you how to use the image.

How to use your Persistent Disk Image: The dialouge tells you a slightly more hassley way to get it working, this is the simple way. #ENSURE YOUR DEVICE IS PLUGGED IN BEFORE YOU BOOT #At the boot prompt, just hit Enter as normal. Knoppix should autodetect knoppix.img. If not, restart and type knoppix home=scan at the prompt. #After Knoppix sorts out all the partitions in fstab, you’ll be presented with a Blue Screen (no death involved). Simply select the second option (system). #Take it for a test drive! Install some stuff, change some settings, change the wallpaper, then restart and see them magically reappear when you boot! (you’ll need to do steps 1-3 when you boot)

So there you have it, how to unlock the real power of Knoppix, and take your Linux desktop everywhere!

Leave a Reply