LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Virtualization and Cloud (http://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/)
-   -   Putting a virtual machine on a partition thus being able to boot into it. (http://www.linuxquestions.org/questions/linux-virtualization-and-cloud-90/putting-a-virtual-machine-on-a-partition-thus-being-able-to-boot-into-it-876540/)

blacksiddis 04-22-2011 12:49 PM

Putting a virtual machine on a partition thus being able to boot into it.
 
I asked /g/ (4chan) if it was possible to take a Linux virtual machine and somehow put it on a partition and booting it, instead of running it as a virtual machine.
Some said it was possible and I was given a rundown of what needed to be done, however I don't know how to do most of it (although I understood it)
I was told to "cp -a" everything to a partition with a compatible filesystem and add an entry in the grub.

Regardless of what /g/ said, can anyone give me some info on how I would go about doing this?

paulsm4 04-22-2011 05:07 PM

Quote:

I asked /g/ (4chan) if it was possible to take a .. virtual machine and somehow put it on a partition and booting it, instead of running it as a virtual machine.

#NotIntendedToBeAFactualStatement
Only if it's a Windows VM :)

jefro 04-22-2011 05:10 PM

A virtual machine is (for this discussion) a real computer with a real file system. Any method that can be used on a real computer can be used on a VM. People tend to use dd or other clone apps to do what. You have to understand that the VM also has the entire hard drive not just a partition so you'd have to adapt the partition to be booted by your bootloader or chain it over.

So what method would you use to clone or copy a partition to a partition?

paulsm4 04-22-2011 09:32 PM

Jefro -

I think the OP was asking if it's possible to take a VM and have it boot itself. "Instead of running as a Virtual Machine".

Homey don't think so ;)

blacksiddis 04-23-2011 06:44 AM

Well I have no clue on how to do it or even if it is possible but if it is, I would love to give it a try.
I was told I could only do this if the guest operative system was a Linux system, then it could work but if the guest operating system was Windows it wouldn't.

jefro 04-23-2011 04:10 PM

I was told to "cp -a" everything to a partition with a compatible filesystem and add an entry in the grub.


This statement leads me to believe that one is trying to copy a partition. I would not use cp myself but it can be done.

I still offer this statement. Almost any virtual machine can be cloned or copied just like any real partition. Then it could be in most cases booted to the new hardware. This makes some assumptions too. That the OS either doesn't care about new hardware or it can be repaired somehow. One can not take a sparc VM and try to run it on a x86 for example.

gezley 04-25-2011 09:14 PM

Quote:

Originally Posted by paulsm4 (Post 4333204)
Jefro -

I think the OP was asking if it's possible to take a VM and have it boot itself. "Instead of running as a Virtual Machine".

Homey don't think so ;)

I do it all the time with Slackware. It can boot as a domU under a NetBSD dom0 or as a bare-metal installation outside Xen.

paulsm4 05-03-2011 01:06 AM

Slackware can be a VM running under Xen.

Slackware can be the DomU running directly under the Hypervisor.

And, of course, Slackware can be a bare metal install (the PC boots and runs Slackware).

The same can be true of pretty much any distro.

But I can't believe the *SAME* install can be used in all three roles. It might happen to be Slackware (or SuSE, or Debian) ... but it's a *different* install and a *different* configuration for each of the three roles.

Isn't it?

gezley 05-03-2011 04:31 AM

Quote:

Originally Posted by paulsm4 (Post 4344687)
Slackware can be a VM running under Xen.

Slackware can be the DomU running directly under the Hypervisor.

And, of course, Slackware can be a bare metal install (the PC boots and runs Slackware).

The same can be true of pretty much any distro.

But I can't believe the *SAME* install can be used in all three roles. It might happen to be Slackware (or SuSE, or Debian) ... but it's a *different* install and a *different* configuration for each of the three roles.

Isn't it?

Nope - the exact same install. There's really only two roles - one as bare metal install and the other as domU under Xen. One Linux installation can function in both environments. Possibly a couple of small changes to be made to kernel and fstab and that's it.

For example:

1) Install Xen hypervisor with NetBSD dom0;

2) install Slackware/Scientific Linux/Debian as normal, on bare metal, completely apart from Xen, on separate partitions or in logical volumes;

3) make sure kernel in Slack/Debian etc. is compiled with Xen domU options and also change /etc/fstab values to UUIDS so the system boots in both environments; Debian and Scientific Linux have the kernel options enabled by default so no change necessary there, and SL has UUIDs in fstab so no change needed there either;

4) boot into Xen and start one or all of these Linux distros as domUs, using XDMCP to bring up full-speed desktop;

5) alternatively, boot normally again and select one but only one of these Linux installations to run as bare-metal install, completely outside XEN.

I now have Scientific Linux and Debian doing the same as Slack. To my mind it's the best kind of virtualisation: it allows me to run the same installation virtualised or natively. The only thing I don't have working yet in domU is audio forwarding to dom0. Otherwise everything is perfect, with minimum fuss and configuration.

paulsm4 05-03-2011 01:16 PM

thanx, gezley :)!


All times are GMT -5. The time now is 05:43 PM.