Changes between Initial Version and Version 1 of bdsync


Ignore:
Timestamp:
Dec 12, 2014, 12:27:23 AM (11 years ago)
Author:
Jamie McClelland
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • bdsync

    v1 v1  
     1= Moving guests from one server to another using bdsync =
     2
     3[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.
     4
     5It works like this:
     6
     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).
     8 * Apply the diff file to the remove machine's block device so that they are in sync.
     9
     10== Using bdsync to move virtual guests on MF/PL infrastructure =
     11
     12bdsync is not (yet) in debian. So, it has to be compiled. Fortunately it is a small program that is easy to compile.
     13
     14=== On the source machine ===
     15
     16 * As root, install dependencies:
     17{{{
     18apt-get install make gcc libssl-dev libc6-dev
     19}}}
     20 * As root, Create a bdsync user to compile the program:
     21{{{
     22useradd bdsync
     23}}}
     24 * Become that user
     25{{{
     26su - bdsync
     27}}}
     28 * Check out the source and cd into the source directory:
     29{{{
     30git clone https://github.com/TargetHolding/bdsync && cd bdsync
     31}}}
     32 * Make:
     33{{{
     34make
     35}}}
     36
     37You should end up with a bdsync binary in your current directory.
     38
     39=== On the target machine ===
     40
     41 * 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.
     42 * If you haven't already, create a bdsync user on the target machine:
     43{{{
     44useradd bdsync
     45}}}
     46 * Add the source server's root user to the monkeysphere authorized user ids file. Replace $TARGETSERVER with the name of the target server, e.g. "chavez":
     47{{{
     48echo "root@$TARGETSERVER.mayfirst.org" >> /home/bdsync/.monkeysphere/authorized_user_ids
     49}}}
     50 * Update monkeysphere credentials
     51{{{
     52monkeysphere-authentication update-users bdsync
     53}}}
     54
     55=== Create first diff ===
     56
     57On 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"):
     58
     59Running via ionice ensures that it doesn't kill all disk i/o on the machine.
     60
     61ionice -c 2 -n 7 bdsync "ssh bdsync@$TARGETSERVER.mayfirst.org bdsync --server" $LOCDEV $REMDEV | gzip > DEV.bdsync.gz
     62
     63Now, copy the diff to the target machine.
     64
     65scp DEV.bdsync.gz bdsync@$TARGETSERVER.mayfirst.org:
     66
     67=== Apply first diff ===
     68
     69On the target server, apply the diff:
     70
     71{{{
     72gzip < DEV.bdsync.gz | bdsync --patch $REMDEV
     73}}}
     74
     75=== Final sync ===
     76
     77After running once, shutdown the source machine and repeat to get the final diff. Then repeat the application of the diff.