ZFS replication

Hi folks,

Just trying to get my feet wet with FreeBSD.
I'm trying to expand past FreeNAS for my ZFS solution. But for the life of me I can't figure out how to manually replicate pools.
With the ui/tools it's quite easy but I'm just not getting it with FreeBSD directly.

I have

server A: 192.168.100.50 FreeBSD 13.1
zpool/daily_files

server B: 192.168.100.51 FreeBSD 13.1
zpool/daily_backup


My question is, what is involved in using replication as a crontab to back up files from 2 separate hosts across the network?

I haven't been able to find a reliable tutorial that seems to work.


Thank you.
 
zfs-autobackup. Example:

1 - setup passwordless SSH access from A to B.

2 - on A (with --dry-run):
Code:
# install zfs-autobackup
pkg install py39-zfs-autobackup

# Mark the dataset with the a2b custom property. All datasets with this label will be copied by the next command.
zfs set autobackup:a2b=true zpool/daily_files

# run zfs-autobackup with --dry-run (basic run)
zfs-autobackup --dry-run --ssh-target b --verbose a2b zpool/daily_backup

# real life example
zfs-autobackup --dry-run --clear-mountpoint --destroy-incompatible --keep-source=10,1d1w,1w1m,1m1y --keep-target=10,1d1w,1w1m,1m1y --no-holds --rollback --ssh-target b --verbose a2b zpool/daily_backup

3 - result on B
Code:
zfs list -rt all

The output will look like this:
Code:
zpool/daily_backup/daily_files
zpool/daily_backup/daily_files@a2b-20221107060000
zpool/daily_backup/daily_files@a2b-20221108060000
zpool/daily_backup/daily_files@a2b-20221109060000
 
Sanoid-Syncnoid
Only a problem: the target BSD machine must change default shell

crontab something like that
01 07 * * * /root/script/bak_replicaremota.sh >/dev/null 2>&1

the script something like (to replicate tank/d in this example) with

Code:
if ping -q -c 1 -W 1 backup.mygoodbackup. com >/dev/null; then
/bin/date +"%R ----------REPLICA remote server answer PING => replica"

/usr/local/bin/syncoid  -r --sshkey=/root/script/root_backup --identifier=myd2 tank/d ro
ot@backup.mygoodbackup.com:zroot/copia_d

/bin/date +"%R ----------REPLICA done"

else
    /bin/date +"%R mygoodbackup KAPUTT!"
fi
 
Back
Top