FreeNAS remote Replication with Life Preserver


#1

Creating the first remote snapshot replication with Life Preserver can take very long so be patient. I used following setup:

FreeNas-11.1-U5
trueos-stable-18.03

Tested on the 11.06.2018.

setup Remote Server FreeNAS
create a new data-set ( storage -> create new data-set, name trueos_backup )
create a new user (Account -> add user -> sample: Mike, Auxiliary groups: Wheel, set password)
set permission data-set (storage -> select data-set -> set permission -> owner:Mike group:Mike )

i used on my FreeNAS
zfs allow -u trueos create,destroy,hold,mount,receive,send,snapshot zpool/trueos_backup

required for lpreserver to fully work
zfs allow -u trueoes atime,canmount,clone,compression,create,destroy,hold,mount,mountpoint,promote,receive,rename,send,userprop

setup TrueOS
open Life Preserver
set Host IP: 192.168.0.10
set Username: Mike
set Dataset: zpool/trueos_backup
select Local DS:
set Frequency: Sync with snapshot

save config and start the process. check process is running:

ps -aux | grep lpreserver

root       28597   0.0  0.0   12708   3028  -  I    17:27     0:00.01 /bin/sh /usr/local/bin/lpreserver replicate run tank1/usr/home/michael 192.168.0.50
root       28602   0.0  0.0   12708   3004  -  I    17:27     0:00.01 /bin/sh /usr/local/share/lpreserver/backend/runrep.sh tank1/usr/home/michael 192.168.0.50

check /var/log/lpreserver/lpreserver.log

Mon Jun 11 17:17:29 CEST 2018: "Starting replication SCHEDULED task on tank1/usr/home/michael: /var/log/lpreserver/lastrep-send-log"

error Messages

if you find error messages like below … run the troubleshooting option to narrow down the issue.

Mon Jun 11 19:09:55 CEST 2018: Starting replication SCHEDULED task on tank1/usr/home/michael: /var/log/lpreserver/lastrep-send-log
Mon Jun 11 19:09:55 CEST 2018: Cannot locate remote dataset "zpool/trueOS_backup": LOGFILE:
Mon Jun 11 23:13:13 CEST 2018: Starting replication SCHEDULED task on tank1/usr/home/michael: /var/log/lpreserver/lastrep-send-log
Mon Jun 11 23:13:13 CEST 2018: Cannot locate remote dataset "/mnt/zpool/trueOS_backup": LOGFILE:

troubleshooting

The commands below can be used to trouble. I used only the first one. I did not need the other commands.

But to keep the trobleshooting process easy. you run the commands in steps.
I willl test the comands below, too.
Commands that have been tested, are marked with usefull.

zfs list -t snapshot, all    # list all snapshots       :useful


lpreserver status

start replication over cli

zfs send -Rv  tank1/usr/home/michael@auto-2018-06-11-14-00-00 | ssh -v trueos@192.168.0.50 zfs -vuFd zpool/trueOS_backup

option
-u was needed because on my FreeNAS i upgraded the zfs pool

output

23:37:47    61.3K      tank1/usr/home/michael@auto-2018-06-11-14-00-00
23:37:50    61.3K      tank1/usr/home/michael@auto-2018-06-11-14-00-00
23:37:53    61.3K      tank1/usr/home/michael@auto-2018-06-11-14-00-00
23:37:56    61.3K      tank1/usr/home/michael@auto-2018-06-11-14-00-00
23:37:58    61.3K      tank1/usr/home/michael@auto-2018-06-11-14-00-00
....

some extra command sets for troubleshooting in the future

#!/bin/bash

$1=tank1/snapshot                     # local
$2=user@192.168.0.10
$3=zpool/trueos_backup  # remote
DATE=`date +%Y-%m-%d`

case $1 in
 
*)
        # Datafile is found, creating incr.
        echo "Incremental started at `date`"
        zfs snapshot -r ${1}-${DATE}
        zfs send -RI  ${1}   ${1}-${DATE} | ssh ${2} zfs recv -Fd ${3}
        zfs destroy -r ${1}
        ssh ${2} zfs destroy -r ${3}
        echo "Incremental complete at `date`" 
;;
firsttime)
        # Datafile not found, creating full.
        echo "Full started at `date`"
        zfs snapshot -r ${1}@zynk-${DATE}
        # sample : zfs send -R mypool/home@monday | ssh someuser@backuphost zfs recv -dvu recvpool/backup
        zfs send -R     ${1}@zynk-${DATE} | ssh ${2} zfs recv -Fd ${3}
        echo "Full completed at `date`"
;;
esac
        

more info see https://www.freebsd.org/doc/handbook/zfs-zfs.html


#2

“Creating the first working snapshot with Life Preserver can take very long so be patient.”

What’s the meaning of ‘snapshot’ in this? Snapshots are instantaneous.

Where’s the introductory HashBang-Line of Your script?

Where does DATE get its value?


#3

You meant, shebang?.. Or where you trying to start a Twitter hashtag?


#4

It’s the same. Only different names.

#! </path/shell>


#5

i need a bit more time not finished yet


#6

It’s OK. Please, don’t feel attacked. It’s not my intention.


#7

no worries. I have just put some commands together. i will do it properly. Feel free to add stuff and questions. It’s not a script yet just parts.


TrueOS Tips, Tricks, and FAQ