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!

2 Responses to “Create VHD Images Using VirtualBox”

  1. Sventimir says:

    I assume this is how you create an *empty* vhd image, right? Now suppose I have an NTFS partition on my disk, which I’d like to create an image of and hence mount it on VirtualBox VM. How do I do that from within my Linux?

    • Tulsti says:

      Hello,
      your question is some time ago, but as I just did something similar:

      * created a raw image with dd from the ntfs partition
      * converted the raw image to vhx using VBoxManage

      Thanks,
      Tulsti.

Leave a Reply