VirtualBox: using physical partition as virtual drive

79,600

What you are looking for is called "raw hard disk access" in VirtualBox.

Basically you create a virtual disk in vmdk format and configure it to direct to the desired partition or drive.

You can find a description in the manual under Advanced topics / Advanced storage configuration / Using a raw host hard disk from a guest

However keep in mind that, in the setup you are planning, the hardware that the operating systems see constantly changes. (your actual hardware when started as host OS, some virtualized hardware when started as a guest). Linux might cope with that but I am quite sure Windows will not handle that well. Also it might suspect you are using the same Windows licence on several computers and force you to reactivate often or flag itself as pirated.

Another issue might be how to tell the OS to use either the virtual drive (as guest) or the actual physical one (when started as host). Under Linux it might work to fiddle around so that both are assigned the same device name (like /dev/sdb1).

Share:
79,600

Related videos on Youtube

Hamman Samuel
Author by

Hamman Samuel

Updated on September 18, 2022

Comments

  • Hamman Samuel
    Hamman Samuel over 1 year

    Background: I am using VirtualBox installed on Windows 7. From within VirtualBox I am using Xubuntu as a virtual OS. The reason I chose this approach is so that I don't have to keep turning off Windows and rebooting from Xubuntu every time I needed to switch OSes. And VirtualBox's seamless mode is pretty amazing to allow me see Xubuntu and Windows 7 all in one screen.

    Issue: Now I am thinking of a way to have Xubuntu more integrated into my system. By this I mean I want to have a physical partition for Xubuntu. But I want to still have the feeling of the seamless mode.

    Question: So finally, my question is: is it possible to load a partition in VirtualBox as a virtual OS?

    Case examples: Ideal scenario would be: I physically boot up and login to Windows 7. Now I want to access Xubuntu, so I load VirtualBox and access my Xubuntu partition without rebooting. And the other way around too, i.e. I boot up the system, login to Xubuntu, and can access the actual Windows 7 partition through VirtualBox.

    Other info: Please note that I am not talking about getting access to files, as I have a completely separate partition for my files, and am very familiar with VirtualBox's Shared Folders option.

  • Daniel Labonté
    Daniel Labonté almost 9 years
    Sadly, this still doesn't work for GPT drives in VirtualBox 4.3.28 on Windows. Let's hope they fix that before releasing VBox 5.0. :-/ virtualbox.org/ticket/11049
  • Evan Langlois
    Evan Langlois over 7 years
    Done this with Linux host and Windows guest and it worked. But with only 8GB of RAM and no real use for Windows, I decided to format my Windows partition and divided it up using LVM
  • cas
    cas over 6 years
    block device naming is a long-solved problem - use the partition's UUID or LABEL in /etc/fstab instead of the device name (/dev/sdb1). All formatted partitions have a UUID, and most filesystems let you set a label either when you format the partition, or afterwards (e.g. with tune2fs -L for ext2/3/4).