Posts Tagged ‘Machine’

Create VHD Images Using VirtualBox

Yesterday, I wrote a post offering some VHD image files of various sizes for download. However, if you’re a bit more intrepid, you might want to create some of your own.

Despite the fact that (as far as I’m aware) you can’t create VHD image files using the GUI version of Oracle’s VirtualBox software, it is possible to create them using the command line tool ‘VBoxManage’.

Here’s how:

$ VBoxManage createhd --filename 40GB_VHD.vhd --size 40000 --format VHD --variant Standard

This command is fairly self-explanatory. Options as follows:

  • createhd (create a virtual disk image)
  • –filename [filename.vhd]
  • –size [size in MB]
  • –format [specify the new file as a VHD image]
  • –variant [‘Standard’ equates to self-expanding]

VBoxManage and other VBox command line tools are installed when you load the full version of VirtualBox (available here), so there’s nothing extra you need to load on. This command works on PC, Mac and Linux. Enjoy!

Download Blank VHD Images


VHD is the virtual hard disk file format originally used by Microsoft Virtual PC, but fully compatible with VirtualBox, Citrix and VMWare.

Despite the fact that VHD is not native to any of these VM hosts, it is actually a very useful file format, widely compatibility with (and thus portable between) various pieces of host software. There is also a broad range of useful tools for modifying and working with VHD images. I’ve recently been experimenting with the Plop VHD Loader, one such 3rd party tool which allows the user to boot a real machine from a VHD file.

Although they are VHD compatible, hosts like VirtualBox and VMWare prefer to create images in their own (.VMDK, .VDI) file formats, so I’ve created some blank VHD image files of different sizes which are available for download below:

These are all self-expanding, so the files themselves are very small (you don’t have to download a full 40GB of nothing). Hopefully these will help you get started experimenting with VHDs. Enjoy!

Booting a Virtual Machine from a USB Disk (Easily)

Virtual Machines are fantastically useful – whether you want to try out something beta, something old, run apps across platforms or in the cloud, VMs are a killer part of any power user’s repertoire.

One thing which I’ve felt has always limited their flexibility, however, is their storage mechanism, the virtual hard disk. In a previous tutorial, I used Oracle’s VirtualBox to install Ubuntu Linux to an external storage device. Out-of-the-box, however, VBox and its ilk don’t make booting from a physical disk a particularly simple process (see here, for example).

Luckily, this doesn’t need to be, thanks to the Plop Boot Manager.

This boot manager obviates the need for any command line trickery to boot your VM from USB. (This assumes you’ve already got an OS installed to a USB drive – if you don’t, have a look at this tutorial, which demonstrates how to install Ubuntu to a USB disk from within a VM).

How to:

1. Download the Plop boot manager to your host computer (here)

2. Open up your virtual machine and connect ‘plpbt.iso’ to your virtual CDROM drive.

3. Connect your USB disk to the virtual machine.

4. Boot up the VM. When the Plop boot screen appears, select USB.

The machine will now boot from the external disk. Once the OS has started loading, it’s safe to ‘remove’ the Plop image from the virtual CDROM drive.

VirtualBox ostype List

When you’re creating a VirtualBox VM, you need to specify an –ostype when using ‘VBoxManage createvm’. A list of these options is, bizarrely, not in the VBox documentation. You can get this list by typing ‘VBoxManage list ostypes’ at the command line, but here it is reproduced for reference.

ID:          Other
Description: Other/Unknown
ID:          Windows31
Description: Windows 3.1
ID:          Windows95
Description: Windows 95
ID:          Windows98
Description: Windows 98
ID:          WindowsMe
Description: Windows Me
ID:          WindowsNT4
Description: Windows NT 4
ID:          Windows2000
Description: Windows 2000

Porting a Virtual Machine to a VirtualBox Server

If you’re like me, you’ll have a few virtual machines in the stable on your main desktop computer, which isn’t always the best place for them. Virtual hard drives take up tons of room, and the machine itself will be a big resource drain on the host system. This task is ideally suited to a server, and if you use VirtualBox it’s easy to port your desktop VMs to the cloud, freeing up hard drive space, wiping out the resource toll and making the virtual machine accessible from any computer.

This technique is also really useful for tricky to install virtual machines, particularly those with installers requiring multiple floppy disks, which can be set up with ease on a GUI machine and then sent to the server for archiving/remote access.

i: Check Your Specs

Before opening any terminals or remote anything, you need to open VirtualBox on your desktop computer (I’m using Mac OS X but this process will be exactly the same under Windows or Linux). For this example, I’ll be porting a virtual machine containing Windows NT 4. Again, this will work fine for any guest OS.

When VirtualBox opens to the ‘VirtualBox Manager’ screen, highlight the machine you wish to port. The specs of the machine will appear in the right hand pane of the window (see fig 1).

fig. 1 – Check the specs of your VM

We need to recreate this environment as closely as possible on the server to maximise compatibility. Most of the time you’ll be using the default VBox hardware selection, but you still need to make sure that you match the other details with as much accuracy as possible.