Jack Wallen suggests simple strategies that will help you reduce the chaos when managing the media in VirtualBox virtualization software.
I am a happy user of VirtualBox. I use the virtualization software for various purposes, including testing and virtualizing servers. However, when you start getting serious about using a tool like VirtualBox, virtual media management becomes crucial in the fight for your sanity. With this in mind, here's some help for anyone who is new to VirtualBox or hasn't reached the point where media management is necessary — trust me, the time will come. (Related TechRepublic post: DIY: Use VirtualBox to serve up virtual machines.)
Before we start snooping around VirtualBox's Media Manager, let's first consider the types of media that can be managed and how to convert other formats into manageable media. This is the list of supported media:
- ISO: I like to have a specific partition or directory for housing all of my ISOs that are to be virtualized. By doing this, it is possible to attach those ISOs to various virtual machines.
- Disk Image Files: These are large files that house an image and come in the form .vmdk (VMware), .vdi (VirtualBox), .vdh (Microsoft), and .hdd (Parallels).
- You might come across Virtual Appliances for VMware. These tend to be virtual machines that make use of multiple files. Before they can be used in VirtualBox, they have to be flattened. More on this in a bit.
When you create a new virtual machine, there are a number of ways to attach a virtual image to a virtual machine, including:
- The Virtual Media Manager allows the dragging and dropping of supported files to be used. Note: Prior to VirtualBox 4, there was an Add button in the Media Manager. The button is not in VirtualBox4, so drag and drop is the only method for adding files directly to the Media Manager.
- During the setup of the virtual machine, the wizard will ask what to use for the hard drive. At this point, it is possible to select from virtual drives already added to the VirtualBox system.
- From within the Settings of the virtual machine, it is possible to manage the virtual media.
Let's take a closer look at each option, except for Floppy Images, which is not worth discussing.The first place to start working with your virtual media is the Virtual Media Manager, which you can access from the main VirtualBox window by clicking File | Virtual Media Manager. When this new window opens (Figure A), it is possible to add Virtual Hard Drives, CD/DVD Images, and Floppy Images. Figure A
Make sure the tab you're viewing matches the file type you're dragging into the window.
With both Virtual Hard Drives and CD/DVD images, it's just a matter of dragging and dropping the files from the file manager into this window to make them available for the system.
Once you have the media attached to the Virtual Media Manager, it is possible to do the following:
- Copy: Make a copy of the media.
- Modify: If the media allows modification (most do not), you can change its properties here.
- Remove: Delete the file from the Manager.
- Release: Release the file from a virtual machine without deleting it from the Manager.
- Refresh: Refresh the media listing.
Only the images added to the Media Manager will show up in the drop-down.The last method is to walk through the process of creating the virtual machine (allowing the wizard to create a new hard disk, instead of attaching an image from the Media Manager) and then add the image from the virtual machine settings (Figure C). Figure C
Make sure the image is added to the correct controller or the image will not boot.
Converting from VMware to VirtualBox
It is possible to convert VMware machines to images that VirtualBox can use. You can do this with a handy tool called QEMU and a VirtualBox built-in command. Follow these steps to convert the machines:
Step 1: Convert the VMware image to a raw form with the command:
qemu-img convert guest-disk.vmdk -O raw raw-disk.binNote: In the above command, the -O is a capital "o" and not a zero.
Step 2: Convert the raw image to a usable format (.vdi in this case). The command for this looks like:
VBoxManage convertfromraw -format VDI raw-disk.bin guest-disk.vdi
Once this is complete, you should have a .vdi image that can then be imported into VirtualBox.