Raw disk to VirtualBox image

If you want to use any raw disk in VirtualBox, it is not only possible, but quite easy. Remember, that bigger the raw disk is, longer it will take to convert it. And you may need a lot of disk space to store the image of raw disk and then the converted image.

Raw image
First you should make a copy of raw disk, and store it as a file. This is done with dd. Remember that it is not advisable to copy a running filesystem, so best way is to boot your machine with System Rescue CD or some LiveCD.

As an example, lets assume that you have only one operating system on your machine and there is only one hard drive (/dev/sda). After booting the machine from CD, we plug in and mount an USB hard drive with enough capacity to store the whole internal hard drive. Lets assume that we have mounted USB drive as /store.


dd if=/dev/sda of=/store/copy_of_disk.img

Depending on the size of hard drive this may take from minutes to hours.

Conversion
Conversion is done with VirtualBox utility VBoxManage.

VBoxManage convertfromraw /path_to_image/copy_of_disk.img /path_to_virtualbox_images/virtual_disk.vdi --format vdi

Now you can add this virtual_disk as VirtualBox machine.

Leave a comment

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 105 other subscribers