Virtualization and the Throw-away Computer

August 14, 2009

VirtualBox running Windows on OSX

A week ago I would be livid if someone walked up to my work desk, ripped my computer out from under it, and threw it in the garbage. Today, not so much.

It's not that I care about the physical hardware. Not a bit. That thing is over 3 years old now! If you translate that from human years to computer years the hardware itself is decrepit. I'd love to such a visceral reason for a new machine.

It's not that I care about the data. I've backed that up and store code in our version control system and on GitHub. Storage is cheap.

It's the operating system and the configuration of all the software and tools I use. Being a developer means having a wide range of software configured: from text editors and IDEs like Eclipse, to servers like Apache and MySQL, to utility applications like SSH/SCP, git, etc, to all the libraries PHP 5.3 needs to be compiled from source. Downloading, configuring, and faithfully reproducing my existing workstation setup would take the better part of a long, boring day. Not anymore.

Learning about Viruses and "Hacking" Opened My Eyes

In graduate school I took a course on computer systems security. Our assignments were tasks like writing programs that fought off viruses from an infected machine, broke into a digital rights management scheme, and one involving a free-for-all "write programs to hack into each other's" machine contest. When the professor revealed, "You'll be doing this work on either your office computers in the iLab," I had no question where I would work with viruses: not on my machine, no sir, no way. I was wrong.

What I didn't know is that all of the classwork would be done on virtual machines. A virtual machine is, as the name implies, a full-blown emulated computer that runs "sandboxed" on your desktop. Virtual machines allow Mac users to enjoy Windows from within OSX, they allow Linux to be run on Windows, and generally allow you to run virtual computers with whatever operating system you please. What happens in a virtual machine stays in a virtual machine, unless you want to bring it out. So things like valuable files you bring home, things like viruses stay in the VM. Virtual Machines are like Vegas for computers, but better.

The eye-opener was that virtual machines can be backed up, deleted, and restored just like files. They are throw-away computers. When the virus won the battle we "threw away" the machine which meant opening another file. When we needed to submit a machine for grading we didn't lug a big box to the professor's office, we sent the VM image file over the network.

The Commoditization of Memory, Multi-core and Virtualization Software

The two big requirements to work with virtual machines are: 1) they use a lot of memory and computing power, and 2) virtualization software. In recent years both of these requirements have become commoditized. Last weekend I bought a 64-bit quad-core Core 2 Intel box with 4 gigabytes of RAM and over half a TB of disk space for $450. That's crazy. I then installed VirtualBox, an open source virtualization platform from Sun that runs on Windows, Linux, and Mac, for $0. Equipt with the tools I set out to build a throw-away desktop.

The only non pre-installed programs I installed on the primary OS is VirtualBox and some simple utilities. After that, all work has been done within a virtual machine. After installing Ubuntu I made a back-up that I can go back to for a fresh OS. I then scripted the install of all of my necessary developer tools, servers, etc, (and posted the scripts to GitHub for anyone interested). Finally I setup a backup for the virtual machine images to an external USB hard drive. The result? Throw away my home desktop. No biggie. In fact, I'm writing this blog post on that virtual machine I setup on my home desktop but running it on my laptop with everything I need. That's just it, being able to throw away a computer isn't the big win, it's the flexibility and the freedom to do things like:

  • Transfer your VM from one machine to another. No more excuse you can't do something because the program you need is on machine X.
  • Install new programs without fear that they'll bloat your machine and take it down. If they do, big deal, throw it away and open up a previous backup.
  • Test how applications/web pages work with other operating systems and internet browsers.
  • Have a shared workstation setup that your team can use that ensures everyone has software installed and configured consistently, even when team members prefer different operating systems

Here at New Media Campaigns our developer team is on the verge of migrating to a throw-away computer setup. As our experience with virtualization grows we'll write more on the specifics of getting set up, and using virtualization technology to power the development environment of small teams. You should subscribe to our developer blog if you're considering or in the process of such a move, too.

Comments

Kristin Ward's avatar
Kristin Ward
The company I work for learned the hard way several years back exactly how easy it is to restore deleted data. One of the employees sold their old laptop which they had been using for work to a small computer shop, which turned out to be stealing personal information from computers. They managed to get a hold of a lot of customer information and it resulted in several lawsuits. Now the company only allows employees to use work computers and has hard drive shredding done to all old computers by a company called http://datakillers.com. Haven't had a problem since.
Alex's avatar
Alex NMC team member

Yes, this is a HUGE time saver. Especially when doing cross-browser testing. My only wish is for Apple making our life a bit easier with more permissive OSX licensing.

 Kris Jordan's avatar
Kris Jordan

@Nolan - Great question re: virtual box per website. Most of our web work is for a common LAMP environment. For the couple of projects we've done for other environments our assets haven't been organized as cleanly as they could be. Setting up VMs per client on unique environments is a great idea. We haven't taken our internal process that far, yet. Our hope is that this VM development experiment on an internal project will prove its value and we will use a similar process for unique external/client projects.

We've been trying to work towards the mantra of 'Ubiquitous Automation' as put forth by Hunt & Thomas in the Pragmatic Programmer. Prior to trying VMs we tried bash scripting that was generic enough to be cross-platform (MSYS/MinGW for Win32). That route seemed to be a bigger pain than it was worth because keeping scripts in sync between Win/Mac with different server setups is non-trivial.

Where cross-platform shell scripting is a pain, shell scripting for a VM is a blessing (unless your VMs are a hybrid of Win/*nix). If the process moves to a VM per client the question I would fret most about is how to automate/script the tasks that every client project will face and how far you would want to take a snapshot to be used as the common base of all client VMs.

 Nolan's avatar
Nolan

Nice post. I'm a big fan of VirtualBox as well. I run Ubuntu on my home laptop, but as an iPhone owner, I need a solution to deal with that. With the Windows VM with USB pass-thru with iTunes installed, I'm good to go.

Slightly tangential, but since you are at web agency with lots of sites to work on with probably more than one developers on each one, does every developer have their own VM of a site? If websites were just code, this wouldn't really be necessary but as websites have a server and a database as well, this complicates matters quite a bit.

I've been thinking about this problem a lot recently, wanting to streamline things at my workplace, but was just curious if you used VMs for this solution or what route you took there.

As an aside, I've really been enjoying the blog posts. The writing is top-notch and the topics are always interesting.

Leave a comment