Thursday, January 14, 2010

Moving a physical machine to qemu-kvm (work in progress)

The base OS on which qemu-kvm is used needs to have vmx or svm flag (CPU support for hardware virtualization). Without this feature kvm WON'T work.

cat /proc/cpuinfo | grep flags

flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc arc h_perfmon pebs bts pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm la hf_lm tpr_shadow vnmi flexpriority


An excellent article on setting up QEMU on Fedora is given here:




Steps to move from Hardware OS to QEMU-KVM based OS.

++ Create a image

qemu-img create rhel5.img -f qcow2 6G

++ Ensure nbd module is loaded.

modprobe nbd max_part=8

++ Connect to this image using nbd-client (using socket)

qemu-nbd --connect=/dev/nbd0 --socket=/var/lock/qemu-nbd0 /home/user/rhel5.img

++ Create partitions on /dev/nbd0 using fdisk

Say 2 partitions nbd0p1 (/boot) and nbd0p2 (/)

++ Mount the partitons so that data can be copied

mkdir nbd0p1
mkdir nbd0p2

mount /dev/nbd0p1 nbd0p1
mount /dev/nbd0p2 nbd0p2

++ Copy /boot

cd nbd0p1
ssh 'dump -0 -f - /boot' | restore -r -f -

++ Copy /

cd nbd0p2
ssh 'dump -0 -f - /' | restore -r -f -


The above two copies failed for me with weird error messages. I read somewhere that dump/restore tend to fail after 3GB of data transfer.

I need to figure out a way to copy the entire remote filesystem.

Labels: , ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home