Being a grad student, I end up working in a variety of places: office, home, hotels, etc. Since I work on a variety of scientific projects, I require much more than the typical word processor, email client, etc. on my computers. One of my biggest frustrations was synchronizing my work environments. I was finding myself repeating configuration changes across my machines and having trouble remembering how each system was configured. Keeping files in sync across machines was a particular challenge. Subversion repositories work pretty well for most purposes, but it can be a challenge ensuring that all files are checked in and are even included in the repository in the first place.
A couple of different solutions usually spring to mind for addressing these sorts of issues. First, I could carry a laptop around. I dismissed that solution, because it's inconvenient and risky to transport laptops, and because laptop hardware is often less capable than desktop hardware. A second possibility is using a remote desktop system to connect to a central machine over a network. Unfortunately, I often don't have access to broadband.
So, I decided on a third option: perform much of my work within a virtual machine that is stored on a compact external hard disk. To achieve this, I had to overcome several challenges:
- Selecting a suitable virtualization platform that provides good performance, desktop integration, and portability
- Selecting an external storage device that is compact, fast, large, and cheap
- Configuring the guest operating system to have good performance on a variety of host platforms
The first one actually wasn't much of a challenge, because I already had a lot of experience with Sun VirtualBox and knew it would be a good choice for this project. It's easy to configure, fast, and has lots of features.
I was initially planning to purchase a flash-based Solid-State-Disk (SSD) for this purpose, but changed my mind and decided on a 1.8" electro-mechanical hard disk instead. SSDs have better performance than hard disks and are more rugged, but they cost much more per unit of storage. I was going for the ultimate in portability, so I ended up selecting the Samsung S1 1.8" USB 2.0 120GB hard disk. Tech moves fast, so that one isn't even a good option any more! Its big brother, the 160GB edition, now sells for around $70.
An unanticipated problem with the disk is that it uses the new 4096-byte sector format, which is poorly supported by Linux 2.6.31. Basically, the tools shipped with Ubuntu 9.10 choked on the disk, although it somehow was still recognized and automounted by the system. I eventually attempted to re-label the disk using parted (since the kernel was complaining that it had an unrecognized label), but that segfaulted parted after corrupting the partition table. I got around that issue by converting the disk to a GPT (GUID Partition Table, an EFI concept) disk in Windows 7 computer management disk manager. I formatted it with NTFS using the maximum cluster size (64KB) since it will only contain a few, very large files. This will maximize the available space and minimize disk management overhead. I then recompiled the Ubuntu kernel to recognize GUID partition tables (I actually used Zen Kernel).
Using VirtualBox, I statically allocated a 54GB partition on the disk for an Ubuntu virtual machine. Static allocation maximizes performance. Actually, an even faster option is to provide the guest with direct physical access to a partition, but that is apparently no longer supported with recent versions of Windows, so it is only suitable if the VM is only run on Linux hosts. I then installed 64-bit Ubuntu 9.10 in a straightforward fashion.
One customization that was helpful to me was permitting SSH access to the VM, so that I could forward X connections on my office desktop and thus utilize its dual screens. Here are some instructions for that: http://tombuntu.com/index.php/2008/12/17/configure-port-forwarding-to-a-virtualbox-guest-os/
This whole effort had some unanticipated benefits. First, I am now able to put my office desktop to sleep when I'm not using it, because I no longer need to access its files remotely. This saves power. Second, I was able to disable remote SSH access to my office desktop, which improves the security of the system (I used to observe many attack attempts against SSH on that system).
Overall, I'm quite happy with how this approach is working!