|
|
|
|
|
|
|
|
|
|
xen-users
[Xen-users] Hack Attack: Moving domU's between hosts without shared disk
So I have two hosts that I want to move domU's between, but they do
not have any shared disk. I am willing to suffer some downtime to move
the domU's, but not a lot (like maybe the time needed to do a reboot,
but certainly not the time required to copy the virtual disks over).
This is what I did.
WARNING: THIS IS A HACK AND YOU SHOULD BE CAREFUL DOING THIS.
But it worked for me :-)
The idea is to use the linux raid driver to facilitate copying the
domU's virtual disks. In my case I am using LVM based disks, but this
shouldn't matter.
Step 1: Allocate LVM's on the destination host.
Step 2: Export the LVM's via the network block driver (nbd) using
nbd-server. [1]
Step 3: shutdown the domU
Step 4: Use resize2fs to shrink the disks by 64Kb (I use 128Kb just to
be safe). This leaves space for a raid header.
Step 5: Create a RAID 1 array with the source LVM and the word "missing"
for the second disk.
(Ex: mdadm --create /dev/md0 -l 1 -n 2 /dev/group/disk missing)
Step 6: Edit the xen config file for domU to access the virtual
disk(s) via the raid device (i.e., /dev/md0 etc.)
Step 7: Reboot the domU -- Service restored.
Step 8: Import the destination nbd via the nbd-client command.
(Ex: nbd-client destination port /dev/nb0)
Step 9: Add the nbd device to the array.
(Ex: mdadm --add /dev/md0 /dev/nb0)
Step 10: Wait for the resync to complete (this may take hours).
Step 11: AFTER RESYNC: shutdown domU
Step 12: Shutdown raid device and nbd device
(Ex: mdadm --stop /dev/md0)
(Ex: nbd-client -d /dev/nb0)
Step 13: Copy xen config file to destination, edit to taste.
Step 14: You can either reference the domU disks directly on the new
LVM or you can build a raid array in reverse from before
(i.e., export the old LVM from the original host via the nbd
driver and assemble the array on the destination). NOTE WELL:
DO NOT USE mdadm --create this time around, the array already
exists. Use mdadm --assemble.
Step 15: Boot domU on the destination. You are done.
Note: If you build the array "in reverse" on the destination, the LVM
on the original host will be updated which can facilitate moving back
quickly if you need to because you won't have to copy the disks again.
If you think about it, this is a good scheme for having a "warm"
standby host ready to roll in the even of a host failure!
[1] There are significant security implications of using the network
block device. Take care. In fact you should have some familiarity with
Linux RAID to do any of this.
It does work. Enjoy all.
-Jeff
--
=============================================================================
Jeffrey I. Schiller
MIT Network Manager
Information Services and Technology
Massachusetts Institute of Technology
77 Massachusetts Avenue Room W92-190
Cambridge, MA 02139-4307
617.253.0161 - Voice
jis@xxxxxxx
============================================================================
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users
|
<Prev in Thread] |
Current Thread |
[Next in Thread> |
- [Xen-users] Hack Attack: Moving domU's between hosts without shared disk,
Jeffrey I. Schiller <=
|
|
|
|
|