[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [rhelv5-list] Migrate Host to Xen or Qemu (James Harrison)



Just like previous post mentioned to use dd, I will give you a bit more context as I've done hundreds of these without using any enterprise p2v or v2v tools.

There are two methods you can try:
1) online method - not clean, but suitable if all IO intensive apps/dbs are powered off and nothing is writing to disk. If it's a webserver that servers a content and does not write much to a disk you can keep it running.
2) offline method - power off the host to ensure consistent clean copy

Online method:
1) Create a VM with the same disk size (or tiny bit larger) as your source VM.
2) Shut off apps that write to disk, the apps that only read or rely on external DB can be up and running (use your judgment on this one)
* if your host to remain online, you can allow your apps to run as is, however upon completion, you will have to shutdown the application and initiate rsync - this will ensure the least downtime
3) Boot the destination VM with bootable distro (i.e. linux rescue, or knoppix/centos/fedora live distros)
4) On destination VM, start network, start sshd daemon, set the root password test ssh login from another host as root, verify that disk you created can be seen and note the device name (i.e. /dev/sda) and IP address.
5) On the source host, note the source disk (/dev/sda or /dev/cciss/c0d0) initiate a dd session as a root user like so (verify syntax I'm doing by memory), screen session would be nice:
dd if=/dev/sda | gzip -c | ssh $targetip 'gzip -d | dd of=/dev/sda'
6) To monitor the progress of dd, from another tty on the source host, you can send "kill -USR1 [yourddpid]", you can also put into "watch" command to get the stat as it goes on. Note that the status will be printed on the original tty that dd was initiated.
7) Upon completion of dd, do a power on start and see if system comes up with default ramdisk, if it does, initiate kudzu and reconfigure the new devices (kudzu should start automatically if you have it in your runlevel)
8) If kernel panics because the disk modules are missing, you will need to recreate your initrd with modules needed for your VM. Instructions are posted online. 
* Or you can copy and replace the initrd from another host with the same kernel/os. This is probably the easiest method if you have vanilla initrd with no special modules.
9) If you used online method you must run fsck on your partitions

Offline method:
1) Create a VM with the same disk size (or tiny bit larger to be safe) as your source VM.
2) Boot the source host into bootable distro (i.e. linux rescue, or knoppix/centos/fedora live distros), note the ip, root disk name, start sshd and verify connectivity
3) Boot the destination VM with bootable distro (i.e. linux rescue, or knoppix/centos/fedora live distros), note the ip, root disk name, start sshd and verify connectivity
Use remaining steps from "Online Method" start with step 5 and beyond

For windows host, the same method applies, except that you will definitely have to add the disk driver for virtual disk controller.

Good luck,
-ilya | www.serverchief.com



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]