Yesterday, I wrote about paying for free software. At the very end of that post, I highlighted a program called Macrium Reflect. That program can automatically create a Linux-based Rescue CD (in order to restore a previously saved image to a damaged or new hard drive).
On their site, they have a good tutorial for how to put that rescue ISO on a USB drive. As long as your BIOS supports booting from the USB drive (most modern ones do), it’s a tad more convenient to carry around a flash (thumb) drive than a CD.
In that tutorial, they use a program called UNetbootin (Universal Netboot Installer). What’s cool about this program (free and open source as well) is it can take practically any ISO and create a bootable USB drive out of it. It has many other cool features (e.g., it can automatically download any number of Linux distros and create a bootable USB or CD without you even knowing the location of the Linux project website!).
UNetbootin uses SysLinux under the covers to create and manage the bootable USB drive. Within SysLinux, there is a single file, syslinux.cfg, which controls the menu of selections that can be booted (different kernels, options to pass to a kernel, etc.).
Now switching gears for a moment, then back to the above to tie it all together…
There are a number of high-quality Virtual Machine programs/products available for all of the major operating systems. The three biggies on Windows are VMware, Virtual PC (directly from Microsoft) and VirtualBox (from Sun). All three are very capable, and all three have at least one version that is completely free.
On my old XP laptop, I used to use VMware Player. It’s free and quite good. I have read that recent versions of Virtual PC are good as well (also free), but I’ve never bothered to install it. While I understand that you can run Linux in Virtual PC, I believe it’s not supported, and I don’t really have a need to run Windows under Windows, so I passed on checking it out.
A few months ago, I stumbled onto VirtualBox. It used to be called InnoTek in a previous incarnation, and was purchased by Sun. There is a free version, which is fully open sourced as well, and there is a proprietary version which adds a few bells and whistles (including some cool USB support), which is available in binary form for free as well (for non–commercial use).
Since I have no interest or need (or capability!) to mess with virtualization source code, I am using the full binary version. On my new Vista Ultimate x64 laptop, I have only VirtualBox installed. I didn’t even download VMware (no knock on their product whatsoever!).
Here is what I like about it. Very fast to load. Full 64 bit support (both their app and guest operating systems!). Virtual PC now has 64 bit support for their own application, but you can only run 32 bit guests (if I understand correctly). Most importantly, I like the fact that it’s more complete (or at least easier to use) than the free version of VMware. I’m way too casual a user (I can go months without launching a VM!) to be willing to pay for VMware Workstation.
So, here are my two normal use cases with VirtualBox, and why I rarely need to run it:
- Check whether a new Rescue ISO works
- Do something fancy with ssh and X-Windows
The first one is simple. For emergency purposes, I carry around a few Linux Rescue disks (used to be only CDs, but stay tuned). My current favorite is SystemRescueCD (currently in version 1.1.4). When a new version becomes available, I download, and boot it immediately in VirtualBox, make sure it seems to work correctly, and only then burn it to a CD and toss the old CD.
The second is rarer, but more complicated. On rare occasion, a friend of mine who is running Linux (that I set up for her) on a very old laptop (that I gave to her) has a problem that I can’t talk her through over the phone. When that happens, I fire up CDLinux under VirtualBox, do some port forwarding on my router, do some ssh magic, and take control of her machine (by allowing her to ssh into my box first, so I don’t have to make changes on her firewall!). I can then even run GUI apps from her machine, redirecting the X session back to me!
Anyway, the point is that VirtualBox works really well, has tons of knobs (we’ll get to one of them in a minute), and doesn’t seem to slow down my pretty darn fast system.
Back to our main story…
When I created the Macrium Reflect Rescue CD (burned to a real CD), I also followed the tutorial to creat a bootable USB disk. When I looked at the disk, I saw the SysLinux stuff, and noticed that all of the Macrium files were in a folder.
I then experimented by using UNetbootin to create another bootable USB disk with SystemRescueCD on it. I saw that it used a different directory to store the various Linux kernels that it can boot. I was able to copy that directory to the other USB disk and copy/paste the lines from the syslinux.cfg file on the SystemRescueCD drive into the other syslinux.cfg.
I did the same thing with CDLinux (version 0.9.0 Community Edition). It used the same name for its subdirectory as Macrium did. I renamed the subdirectory before copying it over, and used the new name in the merged syslinux.cfg file. That worked, because once SysLinux gives control to the kernel in the renamed directory, everything else is relative to that new root directory!
I then rebooted my machine to test the new USB disk. It booted perfectly, and I had 28 choices of kernels to boot from! SystemRescueCD offers most of them, but I had Macrium Reflect and a few flavors of CDLinux to choose from as well. I was able to boot both 64 bit and 32 bit versions of SystemRescueCD successfully. Awesome.
Now the big test. I wanted to see whether I could boot that USB disk from VirtualBox. That would allow my normal use case of testing new releases without having to burn and reboot. Unfortunately, the GUI for VirtualBox does not permit an actual hard disk (USB or otherwise) to be directly attached to the VM (at least not for direct booting).
A quick scan of their excellent manual gave me the answer. There is a command line administration tool called VBoxManage.exe that can be used to create a tiny virtual disk (a VMDK file) that essentially points to any real disk or partition. I used that to create this virtual pointer to my USB drive. It worked perfectly.
I then attached that tiny VMDK disk to my virtual machine and fired it up. Voila, I got the same 28 choices to boot from. I couldn’t get the 64 bit versions to work (they boot, but they claim to be missing modules and won’t start X-Windows), but everything else works flawlessly under VirtualBox.
So, now I have a multi-boot USB drive, that I can keep adding stuff to, that I can test under VirtualBox to be sure it will work correctly should I ever have an emergency. It’s a 1GB USB drive, that has all of these various operating systems and tools on it, and I still have 500MB free. 🙂
Leave a Reply