how to create VMDK file in Virtualbox for adding USB as a new OS?

I have a USB which has OSes on it. Now I want to create VMDK file to use them in VirtualBox.

I read many articles but never found how I can use them. In an article I found the way that:

C:\Program Files\Oracle\VirtualBox > VBoxManage internalcommands createrawvmdk -filename D:\usb.vmdk -rawdisk \\.\physicalDrive<Disk 1> -register

It's not working. I try it without register but nothing happened. If I open my diskmsgmt.msc then they show me the drive's name is Disk 1 Removable

I want to know how I can do this. The problem is that when I run the command the system tells me file not found.

I tried checking the USB. It's working fine. I think that there is may be two reasons for the problem:

  1. The disk name has whitespace so I think it doesn't work because of that.
  2. I'm missing something in the commands.

Can anyone explain what commands I need to use so that it works for me?

(I tried the commands with VirtualBox not VMware)


Simply open a terminal on Linux or a command-line tool on Windows (Win+R cmd) and change directory to your VirtualBox folder.

cd "C:\Program Files\Oracle\VirtualBox"

Then we run the VBoxManage command with the following options to link the USB Drive to a vmdk file (Virtual Machine Disk):

VBoxManage internalcommands createrawvmdk -filename usb.vmdk -rawdisk "path_to_usb"

For example on Linux if I want to save in /home/thomas/.VirtualBox/usb.vmdk a virtual machine disk that links to my USB in /dev/sdb, I type the following line:

VBoxManage internalcommands createrawvmdk -filename /home/thomas/.VirtualBox/usb.vmdk -rawdisk /dev/sdb

On Windows, if I want to save the virtual machine disk in C:\Users\Thomas.VirtualBox\usb.vmdk that links to my USB in in Disk 1 (according to the previous Disk Management), I type the following line:

VBoxManage internalcommands createrawvmdk -filename C:\Users\Thomas\usb.vmdk -rawdisk \\.\PhysicalDrive1

Replace the 1 in \\.\PhysicalDrive1 by YOUR device number of the USB drive (for example \\.\PhysicalDrive2).

If any path contains spaces, write it between quotation marks (") to make it work. Example:

VBoxManage internalcommands createrawvmdk -filename "C:\Documents and Settings\Carletdesiles\.VirtualBox\usb.vmdk" -rawdisk \\.\PhysicalDrive1

That's it, you have done a Virtual Machine disk that should be very tiny (~1KB) and links to your USB drive.

You just need to import this hard drive in VirtualBox and use it as primary hard drive (to boot on) for your new system.