Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I'm searching for a solution to boot a native OS on a hard disk as a virtual machine.

It's like what VMware Fusion did on a Mac which boots Windows in Boot Camp as a virtual machine.

In detail, I have Windows installed on /dev/sda2 and Ubuntu 11.10 on /dev/sda5.

Is there anyway to use a virtual machine software to boot the Windows on /dev/sda2 as a virtual machine while I'm using Ubuntu?

like image 990
YankeeWhiskey Avatar asked Mar 21 '12 19:03

YankeeWhiskey


People also ask

How do I boot a virtual machine from a hard drive?

To do so, open the VirtualBox GUI, select the desired VM, click Settings, click Storage, click Add Hard Disk button, select Choose existing drive, and then select the VMDK file you just created. You can now run the VM that will boot from the physical drive you defined when creating the VMDK file.

What is native boot?

Native boot is a virtual hard disk running an operating system on designated hardware without any other parent operating system, virtual machine, or hypervisor: You can use Windows disk-management tools, DiskPart, and the Disk Management Microsoft Management Console (Diskmgmt.

Can you run a virtual machine on an external hard drive?

Yes, it is possible, but you will likely have some performance loss. The VM should run okay as long as you don't have operations that require a lot of file writing. Also, the smaller the VM, the better. If you have a 50-60 GB Windows VM, it will be very slow on an external 5400 HD with USB 3.


2 Answers

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.

like image 152
TryTryAgain Avatar answered Sep 24 '22 00:09

TryTryAgain


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.

like image 24
jianglai Avatar answered Sep 24 '22 00:09

jianglai