Boot a native OS on a hard disk as a virtual machine

As answered, this also can be done in VirtualBox, this is the way that works for me

Always, make sure that you are running as Administrator(Windows) or Sudo(Linux), any changes that you do will write to the REAL disk, so be carefull

In Windows

C:\Program Files\Oracle\VirtualBox>VBoxManage.exe internalcommands createrawvmdk -filename "E:\virtualbox\linuxhd.vmdk" -rawdisk "\\.\PhysicalDrive1"
RAW host disk access VMDK file E:\virtualbox\linuxhd.vmdk created successfully.

In Linux

$ VBoxManage internalcommands createrawvmdk -filename "~/linuxhd.vmdk" -rawdisk "/dev/sda"

It will create a file with something around 1kb that is a link to the physical hard drive.

Then create a Virtual Machine as ever you do.

If you want to map only a partition

At Windows

\\.\Physicaldrive1 -partitions 1

(Disk start with 0, partitions with 1)

At Linux (Much more intuitive)

/dev/sda1
/dev/sda2
etc.

Eventually you can get resolution issues

Eventually you can get resolution issues even after install vboxadditions, in my experience the problem is your /etc/X11/xorg.conf it is configured to your specific real hardware specs(I have a offboard GPU for example), least in my case I solve it simply removing this file (xorg auto configure at boot, only will not work if you set some specific setting), so run:

sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.original && sudo rm /etc/X11/xorg.conf

Reference

  • http://www.virtualbox.org/manual/ch09.html#rawdisk
  • https://forums.virtualbox.org/viewtopic.php?f=6&t=36694
  • https://romaimperator.com/?p=29

Yes, I did this long ago following this guide:

https://lists.ubuntu.com/archives/ubuntu-us-nm/2008-February/000521.html

of course, always backup and be careful!

Essentially:

  1. Used a USB 3.5 HD enclosure and connect the XP drive to it.

    If the drive was shutdown uncleanly you may need to manually 
    

mount it with the following command.

   sudo mount ntfs-3g /dev/whereyourdriveis /mount/somemountpoint -o 

force

   Once the drive is mounted under linux contiunue to step 2.
  1. Launch VMWare.
  2. Go to File -> New -> New Virtual Machine.
  3. Select "Custom"
  4. Select Next
  5. Select your operating system (i.e. Win XP)
  6. Select Next
  7. Give it a name like "WindowsXP"
  8. Select Next
  9. Specify processor One or Two
  10. Select Next
  11. Choose public or private (on a single-user machine this doesn't matter)
  12. Select Next
  13. Select the memory to devote to the virtual machine. 512 MB is a pretty useful number.
  14. Select your network connection
  15. Select Next.
  16. Leave SCSI set to BusLogic
  17. Select Next
  18. Select Use Physical Disk
  19. Select Next
  20. Select Use Entire Drive
  21. Select Next
  22. Specify the place to save the VM
  23. At this point you're done Select Power On to boot the Physical drive in VMWare!

More Info: I should add, I have successfully done this, but I also had success using this method years even years before. So there are at least two known and tested ways for accomplishing this that I can tell you.


You can do this via VirtualBox raw disk access. (http://www.virtualbox.org/manual/ch09.html) It basically creates a "virtual" disk file that points to the actual partition and loads it as a disk drive in the VM. I've installed Linux guest in VB on Windows host in such a way, and the installation can boot from the VM or by itself.