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 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)

share|improve this question

migrated from stackoverflow.com Aug 21 '11 at 13:03

This question came from our site for professional and enthusiast programmers.

1 Answer 1

up vote 3 down vote accepted

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.

share|improve this answer
    
you dont need the "-register" command. follow the text exactly and it will work. –  cyberkeeper1 Dec 4 '11 at 5:16
    
Works perfectly! You will need to run both VirtualBox and VBoxManage as administrator in order to use this (to run VBoxManage as admin, run the command prompt as admin) –  LightningIsMyName Nov 15 at 9:36

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.