9

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.

1
  • If you want to do this you will need to have additional storage.
    – Ramhound
    Commented Aug 22, 2013 at 11:29

2 Answers 2

3

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

3
  • Thanks. Just one thing. Should my UFD be plugged only when running VBoxManage internalcommands createrawvmdk... or also after when I use mydrive.vmdk in the guest VM?
    – antonio
    Commented Aug 22, 2013 at 14:02
  • That image file act as kind of proxy, so you have to plug UFD. Never tried it, but I think that you can use clonehd parameter to clone your UFD partition through that mydrive.vmdk, to image with variable size.
    – week
    Commented Aug 22, 2013 at 14:30
  • clonehd throws an error on a .vmdk that links to a raw disk. Use A. Richards answer instead to create an unlinked disk file. Commented Feb 1, 2021 at 12:13
12

for those wanting to convert the drive instead of using a transparent virtual disk, or link... (took me around 20 minutes to convert a 32GB USB drive to vmdk)

VBoxManage convertfromraw \\.\PhysicalDrive2 D:\VirtualMachines.vmdk --format vmdk
  • *\.\PhysicalDrive = number of your USB drive found in Disk Management
  • *D:\VirtualMachines = this is the path I used. can be anywhere.
  • *.vmdk / --format vmdk = the extension and chosen format should match.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .