Mac – Convert a USB drive into a Virtual Machine HDD

cloneusb-flash-drivevirtual machinevirtualizationvmware

I am creating a bootable USB flash drive. Before using it I would like to test it with VMware Player (or VirtualBox).

I could make a raw image of the UFD and convert it with "qemu"

qemu-img convert -O vmdk imagefile.img imagefile.vmdk

or I can use raw2vmdk.

My problem is that my UFD is very large when compared to the actual data stored on it (larger than the primary HDD on my system). So there is no room for the raw image and the vmdk file on my system.

Is it possible to make a raw image of the UFD based only on the actual data (used sectors)?

Or is it at least possible to have a direct process? UFD to VMDK without passing via a raw image?

I would like to avoid solutions with physical UFD which oblige me to keep my UFD plugged.

Obviously, after playing with the virtual machine, the reverse should be possible, i.e. copy the virtual drive onto the UFD.

Best Answer

You can use VBoxManage, it comes with VirtualBox.

This'll create "transparent" virtual disk, which gives you direct access to specified device. VBoxManage internalcommands createrawvmdk -filename mydrive.vmdk -rawdisk \\.\PhysicalDrive0

Look here for more examples: http://www.sysprobs.com/access-physical-disk-virtualbox-desktop-virtualization-software