[2019] | 1 | Migrating a Scripts guest between Xen hosts |
---|
| 2 | ------------------------------------------- |
---|
| 3 | |
---|
| 4 | Two main components: |
---|
| 5 | |
---|
| 6 | 1. Copying the disk image (we do this with dd/netcat/backend network) |
---|
| 7 | 2. Modifying Xen configuration |
---|
| 8 | |
---|
| 9 | First, get a copy of /etc/fstab; in particular, you care about the UUIDs |
---|
| 10 | of the swap and cache partitions. |
---|
| 11 | |
---|
| 12 | Next, shut off the relevant VM. Make sure that you have space on the |
---|
| 13 | destination host, and that you have a volume ready to receive the data |
---|
| 14 | (check with 'lvs'). From now, we'll assume $MACHINE is the name of the |
---|
| 15 | VM you're migrating, $SRC is the source host, and $DST is the destination host. |
---|
| 16 | |
---|
| 17 | Setup dd listening on a port on the destination host. Pick a random, |
---|
| 18 | hard to guess port number. |
---|
| 19 | |
---|
| 20 | root@$DST:~# nc -l -p $RANDOMPORT | dd of=/dev/$DST/$MACHINE-root bs=16M |
---|
| 21 | |
---|
| 22 | Next, send the data over the *backend network*. We have 172.21.*.* setup |
---|
| 23 | to be routed on our backend network, do NOT use the public IPs on 18.*.*.*. |
---|
| 24 | |
---|
| 25 | root@$SRC:~# dd if=/dev/$SRC/$MACHINE-root bs=16M | nc 172.21.X.Y $RANDOMPORT |
---|
| 26 | |
---|
| 27 | where X and Y are the last two digits of the normal 18.181.X.Y IP address of $DST. |
---|
| 28 | |
---|
| 29 | Once you're done, ensure that the swap and cache partitions are ready on the |
---|
| 30 | destination (you don't, mercifully, have to dd those over)--make sure they're |
---|
| 31 | properly configured; especially make sure that they the right UUIDs (from |
---|
| 32 | the fstab you saved!) Check 'install-fedora' if you need to be reminded |
---|
| 33 | what the incants are. |
---|
| 34 | |
---|
| 35 | Finally, edit /etc/xen/scripts and modify the host that is hosting the server. |
---|
| 36 | Spin it up on the host and make sure everything is in order, then nuke the |
---|
| 37 | old disk image (multiple copies of a Scripts server is a bad idea!) |
---|