Ubuntu – How to use a real partition with Windows 7 installed, in a virtualbox vm

12.04virtualboxwindows 7

My Ubuntu 12.04 is installed on /dev/sda5 and Windows 7 on /dev/sda1. When I am running Ubuntu, I would like to use Virtualbox to run Windows 7 in a VM. The Windows 7 partition is 1 TB and is half full, i.e. large, so I don't want to copy it into a virtual hard disk.

I have read that it is possible to use a real hard disk for a Virtualbox VM, but the various instructions I have found differ from each other, and I can't seem to get it to work. Does anyone know a way to make it work in Ubuntu 12.04 and Virtualbox 2.1.12_Ubuntu r77245 (the latest Ubuntu installed the repos)?

Please post how it works for you as I want to retry any method that might work.

Best Answer

The command you want is

VBoxManage internalcommands createrawvmdk -filename Win7.vmdk -rawdisk /dev/sda -partitions 1

This will create a special VMDK virtual disk file (Win7.vmdk) which is actually a pointer to the host disk partition /dev/sda1.

In theory, you can then use this as the disk file for a VM to run directly from the actual disk partition, but...

  • (a) I've never tried this, so don't know how reliable it is
  • (b) you may get problems with Windows Activation depending on your license key and whether Windows decides that the detected 'hardware' has significantly changed
Related Question