Categories
Asus Eee PC

Should you keep unionfs on your Eee PC?

Introduction
When I announced to the other Ubuntu Forums staff members I was getting an Eee PC and planning to stick with Xandros (as opposed to installing Ubuntu on it), one of the first pieces of advice I got was to remove unionfs from the Eee to free up space.

What’s the deal with unionfs anyway?
Just a quick primer on unionfs (as well as I can understand it): one of the great features the Eee has is the ability to restore factory settings with the press of a couple of buttons at bootup (tap F9 quickly and then select the restore option from the menu). One person made a YouTube video of the process and clocked the restore at two minutes. I did the restore myself and it took about ten seconds (not kidding).

This works because the Eee has two major hard drive partitions (and two random smaller partitions at the end—I don’t know what those are for). The first is mounted at boot as read-only and contains the factory settings. The second is mounted as read-write and is the user partition you modify after you start using the Eee. While having those two partitions makes restoring (in case you mess up something) easy and quick, it also sucks up a lot of hard drive space on a drive that is already pretty small (4 GB on the 701 version).

My experience with unionfs and reasons for removing it
Even though the advice I got turned out to be good advice, at first I was hesitant to remove unionfs for two reasons:

  1. I knew I’d be tweaking Xandros a lot and wanted an easy way to restore the default installation in case I messed things up.
  2. I didn’t have an external DVD-ROM drive to use for the restore DVD that came with the Eee, and I was intimidated by the tutorials about making USBs into bootable live “CDs.”

Well, after a lot of tweaks, I did manage to mess up the Eee badly enough that I could fix it by undoing all the tweaks, but I was glad to have the option to quickly restore it. And, more importantly—too cheap to buy an external DVD-ROM drive—I rolled up my sleeves and actually followed a tutorial on making a USB device into a live “CD.” It wasn’t as difficult as I thought it would be.

So, with the ability to back up my installation (I used the dd command to back up the entire Eee PC hard drive to a .img file on an external hard drive), I had fewer qualms about removing unionfs. I also realized through regular use with unionfs that a little less than 2 GB is not a lot to work with after you have applications installed. I don’t want to store my entire music and photo collections on the Eee, but I’d like to have some selection available there.

The removal process
Emboldened by how much easier the make-a-USB-live-“CD” process was, I went ahead and tried the Removing UnionFS/aufs tutorial on the EeeUser Wiki, and the process could have been a lot smoother. I basically ended up following the instructions, messing everything up, and then having to restore my Xandros .img with dd and then redo the instructions again.

If you’re planning to follow the instructions, here are a few things to keep in mind:

  • You do not need to enable (i.e., add as a permanent boot option) single-user mode or recovery mode on the Eee, but it’s probably a good idea to know how to make it available for one-time use.
  • If you have an easy way to back up the Eee (the dd command, for example, or an external DVD-ROM drive with the Eee PC DVD), you can simplify the process by using a live CD (or live “CD” USB stick) to make all the changes to /dev/sda1. You should be familiar with mounting partitions, but it’ll save you the trouble of going into recovery mode and using vi and all that. You also won’t have to constantly reboot and test things (again, you should have backed everything up first; otherwise, testing is a good thing).
  • There are instructions in the middle of the page about growing the /dev/sda1 partition using GParted, but then there is a warning at the bottom of the page about how using GParted won’t work and how you should use fdisk and some other command-line options instead to merge partitions. Please heed this bottom-of-the-page warning. I tried to grow the /dev/sda1 partition in GParted to fill the space and got an error message and the /dev/sda1 partition then appeared to fill all 3.7 GB but was also almost completely full. When I rebooted into Xandros, the drive was reported as being only 2 GB large and almost full. If you want the non-unionfs-ed partition to fill the whole drive, follow the instructions about using the command-line to do it.
  • The other thing I learned is that the commands given seem counterintuitive to the uninitiated. To expand the first partition to fill the space, they actually have you delete all the partitions and then create a new partition. My intuition was telling me, “Hey, this is wrong! I don’t want to delete the partition. I just want to expand it.” But if you follow the instructions and delete all the partitions and recreate a new one, it actually has the same effect as expanding the first partition. Don’t ask me how that works, but it does. You backed everything up anyway, right? There should be nothing to lose.

Conclusion
My advice to owners of any Eee PC that has a 4 GB hard drive or smaller is to find a way to back up and/or restore your Xandros installation and then get rid of unionfs as quickly as possible in order to reclaim hard drive space. The quick restore tool is fun and amazing, but it takes up too much space. I’m so glad I now have 1.8 GB of free space on my Eee instead of 400 MB.