Grant McWilliams

Tech Virtualization VirtualBox Howtos Convert raw disk images to vdi format

Convert raw disk images to vdi format

If you're moving from a real server installation to a VirtualBox virtualized configuration you may want to take your real physical disk and just turn it into a virtual disk. There are advantages to creating a new disk and rsyncing your OS into it but this tutorial will show you how to make an exact copy of it. Note the exact copy will be the same size as the real physical disk so make sure you have enough drive space. This is most useful for Operating System images with shared storage for data. I wouldn't advise anyone to make a 1TB copy of their new drive and turn it into a VDI file!

To get the image from the disk use the dd command.

  1. dd if=/dev/hda of=./hda.img
  2. VBoxManage convertdd hda.img hda.vdi
grant@workstation:~$ dd if=/dev/hda of=./hda.img
grant@workstation:~$ VBoxManage convertdd hda.img hda.vdi
VirtualBox Command Line Management Interface Version 1.6.0
(C) 2005-2008 Sun Microsystems, Inc.
All rights reserved.

Converting VDI: from DD image file="hda.img" to file="hda.vdi"...
Creating fixed image with size 1024966656 bytes (978MB)...

This will make an exact copy of /dev/hda to the raw image file hda.img. Then VBoxManage will convert the raw disk hda.img to hda.vdi for use with VirtualBox.

Tech Virtualization VirtualBox Howtos Convert raw disk images to vdi format