Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I would like to make a VirtualBox .vdi image out of my hard drive.

I've found howto's online that describe doing this by first usind DD to create a .raw image, then using VBoxManage to convert the .raw to a .vdi. SO if my HD is 1 TB, this process (temporarily) requires 2TB of space, to store both the .raw and .vdi.

I only have a bit more than 1TB of free space. Is there a way to create a .vdi image of a hard drive, without first having to create a .raw image?

share|improve this question
    
This is risky, but if you have your hard drive that you want to P2V, then you could create the image on your spare drive with about 1TB Free. Then format your original drive and copy the RAW file to the original drive. Then convert the RAW to VDI back onto your main drive. However, if it gets screwed up (could happen) then you're stuck with a RAW Image and no original. –  kobaltz Jul 2 '13 at 1:03
    
@kolbatz I considered this, but I thought that it had a high chance of failure. When I image the hard drive, the resulting .raw file is the size of the hard drive. But before copying the file back to the original drive, I need to give the drive a filesystem. This involves writing some metadata to the drive, leaving not enough space to hold the drive-sized file. –  SuperElectric Jul 2 '13 at 4:30

2 Answers 2

up vote 4 down vote accepted

You can directly create an image with VBoxManage convertfromraw. First unmount the device, then:

VBoxManage convertfromraw /dev/sda MyImage.vdi --format VDI

Replace /dev/sda with whatever disk or partition you want to clone.

You may need to do this as root to gain access to the device. If so, then you should change ownership of the finished image.

share|improve this answer

There are other safer ways to create a file of your current system that Virtualbox can work with. Vdi's are virtualbox specific files and are usually only generated by VB from a fresh virtual hard disk install.

You have many other options.

I recently used disk2vhd to create a .VHD (Microsoft Virtual Hard Disk) that Virtualbox imported beautifully. (Although it was an XP system) I don't think it works well with other OS's.

Alternatively there is Vmwares converter tool that can export your system to a variety of formats that virtualbox as well as other platforms can use. There are open standards for this kind of thing.

http://www.vmware.com/products/converter/features.html

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.