Changes between Version 6 and Version 7 of bdsync


Ignore:
Timestamp:
Apr 2, 2015, 1:53:03 PM (5 years ago)
Author:
Jamie McClelland
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • bdsync

    v6 v7  
    55It works like this:
    66
    7  * Generate a diff file that records the differences between two block devices (typically one is local and the other is on a remote machine).
     7 * Generate a diff file that records the differences between two block devices (typically one is local and the other is on a remote machine). With a remote block device, you have to have ssh access to the remote server - but just to read the remote block device - bdsync doesn't write to it at this stage.
     8 * Copy the diff file to the remote machine.
    89 * Apply the diff file to the remove machine's block device so that they are in sync.
     10 * Repeat.
    911
    10 == Using bdsync to move virtual guests on MF/PL infrastructure =
     12== Using bdsync to move virtual guests on MF/PL infrastructure ==
    1113
    1214bdsync is not (yet) in debian. So, it has to be compiled. Fortunately it is a small program that is easy to compile.
    1315
     16== In puppet ==
     17
     18Since you are sync'ing two block devices, both block devices need to exist. On the source machine, of course, it will exist. However, it won't exist on the target machine.
     19
     20To 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.
     21
    1422=== On the source machine ===
     23
     24These 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.
    1525
    1626 * As root, install dependencies:
     
    2030 * As root, Create a bdsync user to compile the program:
    2131{{{
    22 useradd bdsync
     32useradd bdsync-builder
    2333}}}
    2434 * Become that user
    2535{{{
    26 su - bdsync
     36su - bdsync-builder
    2737}}}
    2838 * Check out the source and cd into the source directory:
     
    3747You should end up with a bdsync binary in your current directory.
    3848
     49 * 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.
     50  * Check available space:
     51{{{
     52vgs
     53}}}
     54  * Create a lvs:
     55{{{
     56lvcreate --size SIZEGB --name bdsync NAME_OF_VG
     57}}}
     58 * Make a filesystem:
     59{{{
     60mkfs --type ext4 PATH/TO/LV
     61}}}
     62
    3963=== On the target machine ===
    4064
    4165 * 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.
     66
     67 * 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
    4269 * If you haven't already, create a bdsync user on the target machine:
    4370{{{
     
    5380}}}
    5481
    55 === Create first diff ===
    56 
    57 On the target machine, figure out which device is the one being used, e.g.:
    58 
     82 * Ensure the bdsync user can write to the device. On the target machine, figure out which device is the one being used, e.g.:
    5983{{{
    60840 cleaver:~# ls -l /dev/mapper/vg_cleaver0-fuller
     
    62860 cleaver:~#
    6387}}}
    64 
    65 Then, chgrp it so that the bdsync user can read it:
    66 
     88 * Then, chgrp it so that the bdsync user can read it:
    6789{{{
    6890chgrp bdsync /dev/dm-3
    6991}}}
    7092
    71 On the source machine execute the following command. Replace $LOCALDEV with the path to the block device on the local machine and $REMDEV with the path of the block device on the remote machine (e.g. /dev/mapper/vg_kiyoshi0-chavez). Replace $TARGETSERVER with the name of the target server (e.g. "chavez"):
     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.
     94
     95=== Let's begin ===
     96
     97On the source machine execute the following command as root. Replace $LOCALDEV (e.g. /dev/mapper/vg_ken0-debs) with the path to the block device on the local machine and $REMDEV with the path of the block device on the remote machine (e.g. /dev/mapper/vg_cleaver0-debs). Replace $TARGETSERVER with the name of the target server (e.g. "cleaver"):
    7298
    7399Running via ionice ensures that it doesn't kill all disk i/o on the machine.