Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

How can one take a VM and make it run on the machine?

share|improve this question
3  
This 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
add comment

3 Answers

up vote 5 down vote accepted

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.

share|improve this answer
    
xmount nice tool :) –  Grzegorz Wierzowiecki Jan 20 '12 at 23:10
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.