How can one take a VM and make it run on the machine?
-
3This is not really a unix/linux question. But here is the VMWare documentation for such a transfer. – Wim Coenen Jan 12 '11 at 17:19
3 Answers
Generally, yes. If your VM is running off native disks or partitions, it may be as simple as pointing your bootloader to it. Otherwise, you'll need to copy the data. For some VM formats, there are tools to mount the VM disk on the host (e.g. xmount). For other formats, the simplest way to get the data is to treat the VM as any old machine and boot a live CD in it.
Then your OS must be able to boot on the metal. Unix installations are generally fairly hardware-independent (as long as you stay with the same processor type). You need to have the right drivers, to configure the bootloader and maybe /etc/fstab
properly. See for example Moving linux install to a new computer.

- 829,060
It depends on what you use for virtualization. Qemu allows you to install the OS to a partition on your hard disk and you can either boot into it or load it up in Qemu.
If your VM is installed to a file on your filesystem like VirtualBox does, it may be possible to convert it to a disk image that you can install to a hard disk but it's more effort on you part than what Qemu can do for you. With VirtualBox there isn't any easy way to synchronize the disk partition and the VDE file so you can swap back and forth between them.

- 1,918
As others have implied, the storage mechanism matters most. Some virtualization products, especially desktop virtualization products, storage data in opaque formats. In that case, you'll need to extract the filesystems from the disk images. Each virtualization product will have a different and sometimes proprietary way of doing this.
If you're building a virtualized datacenter, however, you can actually plan on making virtual machines that can be easily migrated to or from a virtualized environment. In this case, you'll be best using a SAN, such as iSCSI, assigning raw block storage to your virtual machines.
For example, I personally create iSCSI LUNs which appear as block devices under Linux. Then, I boot these machines with Xen. I can easily shut these machines down and then use gPXE to boot the machine directly from the iSCSI volume. This is probably not what you're looking to do, but it is possible!
Not important to forget, however, is that once your storage is accessible, the OS itself needs to be configured to find its devices. Using UUIDs in your /etc/fstab will help, for instance. If booting from a SAN, you will need a properly constructed initrd.

- 676