Jun 162017
 

Been searching for a tool to streamline ZFS replication between my storage arrays and I think I found it – it’s called syncoid.

Installation

# ubuntu
apt install pv lzop mbuffer libconfig-inifiles-perl git -y
# centos
yum install pv lzop mbuffer perl-Config-IniFiles.noarch git -y


cd /usr/src/
git clone https://github.com/jimsalterjrs/sanoid.git
cp sanoid/syncoid /usr/local/sbin/

Now setup SSH keys for passwordless root login and setup cronjob to fire up /usr/local/sbin/replication-syncoid.sh once a day/week/whenever suits you.

0 0 * * 1   /usr/local/sbin/replication-syncoid.sh|logger

Where /usr/local/sbin/replication-syncoid.sh is

#!/bin/bash
FILESYSTEMS="apps home service vmfs"
LOG=/var/log/wigry-syncoid.log
for i in $FILESYSTEMS; do 
echo "---------------  `date` - syncing $i -------------" >> $LOG 2>&1 
/usr/local/sbin/syncoid -r root@wigry.mielnet.pl:tank/$i cistern/$i >> $LOG 2>&1
echo "---------------  `date` - done $i -------------" >> $LOG 2>&1
done

It gets the job done nicely and saves me from writing my own bash-voodoo-black-magic-fuckery.

Thanks Jim.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)