Linux – Starting one OS from another (virtualization?) – Linux

linuxpartitioningvirtualization

I need to do the following, and I'm not sure which tools I shuold use. I need to have 2 partitions on one PC; each partition contains a Linux Distro (any) in dual boot. Then, whenever I select to run OS1 or OS2, I need to be able to run the other OS from the one I selected. For instance, run OS2 from OS1. I've heard this is some kind of virtualization but I really don't know how to find exactly what I need. I'd be great if all these can be done through a linux-terminal (I bet it is possible).

SOme people have suggested me: Xen, KVM, VMware ESXi, even chroot…but If one of the OS's I have would be Windows, I guess some of these could not be use… or I simply can't get what capabilities from these tools would allow me to do it so… any advice on this weird topic would be very well appreciated.

Best Answer

Why is this question voted down? It's a good question.

As Vasily said, you can do this using VirtualBox. I have the same setup on my work PC: I have Ubuntu & Win 7 on different partitions on the same hard drive. I can boot into either using grub, or I can run Windows as a guest under Ubuntu as host. I've found that Symantec's hard drive scan tends to monopolize my hard drive, causing a bottleneck (2 OSs simultaneously hammering a single spinning disk).

Here's how you can do it:

1) Install VirtualBox on the Linux image you want to use as host. (I didn't use apt-get to install because I wanted it to work after Oracle inevitably breaks something with an update).

2) Depending on your system configuration, you may need to go into BIOS and enable VTx. I did.

3) Use this site (link) as a guide to setting up:
 a) your virtual machine
 b) your virtual disk image as a raw disk access to the partition where your other OS is installed. Raw disk access tells your host OS to directly use that partition, rather than using a file on your host OS's hard drive as the hard drive. Make sure you get the partition numbers right! Things can go very wrong on this step if you blindly copy commands you find on the internet, so I'll leave you with a warning to RTFA and RTFM (link TFM).

4) When I did this, I found at this point that Windows was having problems booting as a guest, so I booted Windows natively and burned a system repair disk.

5) Then I restarted, booted the guest OS from the repair disk, and let it do its thing (it just repaired the boot sector - the article above has you create a virtual one). Windows started working after this step!

6) I then re-activated Windows from the guest (it found a different hardware fingerprint and complained loudly at me), I installed VirtualBox's guest extensions, and and haven't had any problems since (~1 month ago).

PS: After doing this, booting into Windows natively automatically repairs the installation and I need to repeat step 5 the next time I boot the Windows VM; this isn't a big problem for me though, because I only ever have to boot Windows natively again once (when I decommission my PC).

Related Question