VirtualBox: Bits and Bytes Masquerading as Machines

Using virtualization to turn your ho-hum desktop into a computer cluster.
Creating a New Virtual Machine

Because I opted for the personal evaluation binary, I had to accept the PELA and fill in a quick registration at first launch.

There are two parts to creating any virtual machine: the creation of the virtual machine container and then the installation of the OS into that container. To do the first part, start VirtualBox and click the New icon. This opens up the New Virtual Machine Wizard (Figure 2).

Figure 2. The VirtualBox New Virtual Machine Wizard

First, you must name your virtual machine. I know from experience that I will create many, many virtual machines, so I have opted to name them each as the OS and then its function. In this case, I want to see whether I can run our podcasting rig out of a VirtualBox virtual machine, so I'm going to install dyne:bolic into my virtual machine. Therefore, I name this virtual machine Dynebolic-Podcasting and select the Linux 2.6 kernel OS (Figure 3).

Figure 3. Select the virtual machine OS and set the name.

Like a physical machine, a virtual machine needs some RAM. On the next screen, the wizard suggests 256MB of RAM. However, because I know that crunching a big Ogg file can take a system to its knees, I allocate 512MB to this virtual machine (Figure 4).

Figure 4. Setting the RAM of the Virtual Machine

What does the virtual machine need next? Well, just like a regular machine, it needs a hard drive. I know from experience that I can use a CD/DVD ISO file (like my friendly dyne:bolic ISO) as the bootable hard drive, but VirtualBox's new machine wizard doesn't allow for that. I will be able to add my ISO later on, but not right now. So, as counter-intuitive as it seems, simply click the Next button without setting up any disks and acknowledge the error dialog that tries to stop this folly (Figure 5). Click Finish, and voilà, you have a shiny new dyne:bolic virtual container.

Figure 5. VirtualBox's Caution Dialog about Not Creating a Hard Disk

Sadly, this virtual machine will not boot, because I still don't have a hard drive or other bootable media. I want this thing to boot the dyne:bolic ISO image I have stored on my hard drive, so I have to mount a virtual CD/DVD drive into my virtual machine. This is one area where virtual and physical machines differ. If this were a physical machine, I would not only have to attach a CD/DVD drive to the machine, but I also would have to insert my dyne:bolic CD into the drive for the machine to boot in to it. With a virtual machine, I merely point to the ISO image, and VirtualBox is smart enough to understand that it is to boot from it. To accomplish this rather unintuitive task, follow these steps from the main VirtualBox screen:

  1. Highlight the virtual machine you just created.

  2. Click the blue CD/DVD-ROM label in the right column.

  3. Click the Mount CD/DVD Drive check box (Figure 6).

  4. Click the ISO Image File check box.

  5. Click the file folder browse icon next to the ISO Image File drop-down list box.

  6. Click the Add button and browse for your ISO image (Figure 7).

Figure 6. Create a Virtual CD/DVD ROM Drive

Figure 7. Use an ISO file from which to boot the virtual machine.

Creating a Hard Drive

Note that the screen from Step 2 above also provides the interface to add all sorts of ports and storage devices to the virtual machine. I'm happy running my dyne:bolic as a live CD, but if I wanted to install it into this virtual machine, I would have to create a hard drive into which to install it.

There are two types of hard drives in the virtual world: those that take up all the space they are allocated right off the bat, and those that can grow into their maximum allocated size as needed. I'm a big fan of the second type, because it allows me to allocate large amounts of disk space to my virtual machines without fearing that I will lose all that space from my host machine right away.

To create a growable hard disk, get yourself back to the main VirtualBox interface and ensure that the virtual machine is shut down. Then, follow these steps:

  1. Highlight the virtual machine to which you want to add a drive.

  2. Click the blue Hard Disks label in the right column.

  3. To add a primary master drive, select the Primary Master check box.

  4. Select the file folder browse icon next to the Primary Master check box.

  5. Click the New button.

  6. Select the Dynamically expanding image check box, unless you have a reason to select the Fixed-size image, and click the Next button.

  7. I recommend naming your disk file(s) with the same name as the virtual machine to which they belong. There are instances where you might want to share disks between virtual machines, and therefore this naming convention might not make sense, but for the most part, the “one-disk-one-machine” philosophy works well.

  8. Use the Image Size slider, or type in the desired disk size (Figure 8).

  9. Click the Next button and the Finish button, and you now have a disk for your virtual machine.

Figure 8. Add a hard disk to the virtual machine.

If you've done everything right, the main VirtualBox screen will show your ISO under the CD/DVD-ROM label (remember, I didn't actually create a hard disk for my machine, so it doesn't show in my screenshot—Figure 9).

Figure 9. Newly Created Virtual Machine Overview