Changes between Version 7 and Version 8 of bdsync


Ignore:
Timestamp:
Apr 8, 2015, 11:00:14 AM (5 years ago)
Author:
Jamie McClelland
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • bdsync

    v7 v8  
     1[[PageOutline]]
    12= Moving guests from one server to another using bdsync =
    23
    34[http://bdsync.rolf-fokkens.nl/ bdsync] is a synchronizing tool designed to work on block devices, as opposed to rsync which is designed to work on file systems.
     5
     6Sometimes we want to move a KVM guest from one physical server to another physical server (if we are retiring a physical server or if we want to free up resources). This page explains how to do this procedure. NOTE: both physical servers must be in the same colocation for networking to work flawlessly. Otherwise, you might need to modify the network settings on the target after you complete the copy.
    47
    58It works like this:
     
    811 * Copy the diff file to the remote machine.
    912 * Apply the diff file to the remove machine's block device so that they are in sync.
    10  * Repeat.
     13
     14Normally, you will take this step once to copy over the vast majority of the data - and it will take a long time.
     15
     16Then, at some point during off hours, you would stop the KVM guest on the source machine and re-run the same procedure. Since the volumes are amost the same, it should go more quickly and it should result in a much smaller diff.
     17
     18When it is complete, you can simply start the guest on the target machine and delete it from the source machine.
    1119
    1220== Using bdsync to move virtual guests on MF/PL infrastructure ==
     
    2028To ensure it is properly created on the target, you will need to add a guest stanza in the target machine's .pp file in puppet. You can copy, exactly, the stanza from the source machine. Then commit the change and push to the origin and push to the target machine. When you push to the target machine, the target block device and guest will be greated - but the guest won't be started or have anything installed.
    2129
     30When you are finished, be sure to delete the stanza from the source machine.
     31
    2232=== On the source machine ===
     33
     34==== Build bdsync ====
    2335
    2436These steps are only necessary the first time. If your target server is ken, you don't need to do anything. Otherwise, you can probably copy the binary bdsync program from `ken.mayfirst.org` and skip this step entirely.
     
    4759You should end up with a bdsync binary in your current directory.
    4860
     61==== Create a logical volume to hold your diff file ====
     62
    4963 * Since you will be creating giant diff files - you have to be sure you have a device that is as big as the biggest logical volume you are going to move.
    5064  * Check available space:
     
    6074mkfs --type ext4 PATH/TO/LV
    6175}}}
     76 * Mount the filesystem somewhere convenient. On the source machine you will be running as root, so putting it in the /root directory makes sense:
     77{{{
     78mkdir /root/bdsync
     79mount /PATH/TO/LV /root/bdsync
     80}}}
    6281
    6382=== On the target machine ===
    6483
     84==== Ensure you have the bdsync program available ====
     85
    6586 * If the source and target machines are running the same version of debian and have the same architecture, just copy the bdsync binary to the target machine. Otherwise, repeat this process on the target machine.
    6687
     88==== Create a bdsync user on the target machine ====
     89
    6790 * Unlike the source machine (where you will run as the root user), you will be running as the bdsync user on the target machine. So, you need a bdsync user created.
    68 
    69  * If you haven't already, create a bdsync user on the target machine:
     91 * If you haven't already, create a bdsync user on the target machine. This only needs to happen once per physical server.
    7092{{{
    7193useradd bdsync
     
    79101monkeysphere-authentication update-users bdsync
    80102}}}
    81 
    82103 * Ensure the bdsync user can write to the device. On the target machine, figure out which device is the one being used, e.g.:
    83104{{{
     
    91112}}}
    92113
    93  * You also need to make sure the target server has a big enough volume to receive the giant diff that is coming. Repeat the steps above for creating a logical volume and mounting it under the bdsync user's home directory.
     114==== Ensure you have a device big enough to receive the diff file ====
     115
     116 * You also need to make sure the target server has a big enough volume to receive the giant diff that is coming. Repeat the steps above (Create a logical volume to hold your diff file) for creating a logical volume.
     117 * On the target server, you will be running as the bdsync user. So, instead of mounting it under /root/bdsync you should mount it under /home/bdsync/bdsync and ensure it is writable by the bdsync user.
    94118
    95119=== Let's begin ===