Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have two physical machines that I wish to virtualize.

I can not (physically) plug the hard drives from either machine into the new machine that will act as their VM host, so I think that copying the entire structure of the system over using dd is out of the question.

How can I best go about migrating these machines from their hardware to the KVM environment? I've set up empty, unformatted LVM logical volumes to host their filesystems, with the understanding that giving the VMs a real partition to work with achieves higher performance than sticking an image on the filesystem.

Would I be better off creating new OS installs and rsyncing the differences over?

FWIW, the two machines to be VM'd are running CentOS 5, and the host machine is running Ubuntu Server 10.04 for no particularly important reason. I doubt this matters too much, as it's still going to be KVM and libvert that matter.

share|improve this question
add comment

3 Answers

up vote 2 down vote accepted

You could possibly pipe the output from dd through an SSH tunnel to your target machine. I've known it to be done relatively successfully into a VMWare virtual machine.

Good details in the main answer here, and provides instructions for what to do if SSH isn't running (a number of liveCDs have SSH server on them anyway, so shouldn't be a problem): http://serverfault.com/questions/51567/how-to-set-up-disk-cloning-with-dd-netcat-and-ssh-tunnel

share|improve this answer
    
The notes at the bottom of that answer are golden. In particular, one of source filesystems is dramatically larger in capacity than the space allotted, though it's mostly free space and all the actual data will fit. Looks like a dump/restore for that machine, and a netcat+ssh+dd copy for the other. –  Charles Jun 29 '10 at 1:57
add comment

You can copy the disk images to the LVM logical volumes and provide this as the disk image for the VM. Make sure you disable NTP and NTPDATE on the virtual servers.

I converted some old images using Mondo to create bootable recovery images. This allowed me to resize the partitions during reinstall.

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.