We are setting up replication of snapshots for backup purposes on FreeNAS. We setup Ubuntu server and install ZFS on it. We will use this system to receive snapshot for backup purposes.
We manually generated ssh key on FreeNAS. This was done by connecting to CLI and running commands below.
ssh-keygen -q -t rsa scp id_rsa.pub username@remoteIP:/root
on ubuntu server side install ZFS and create pool
sudo apt-get install zfsutils-linux sudo zpool status sudo zpool create TESTPOOL /dev/sdb
Copy public key for replication to work
# if not already exists $ mkdir /root/.ssh # if not already exists $ touch /root/.ssh/authorized_keys # paste the contents of your FreeNAS root id_rsa.pub here # if not already exists $ chmod -R 600 /root/.ssh
Using FreeNAS GUI add Periodic snapshot task and Replication task to replicate to our Ubuntu ZFS pool
Using FreeNAS CLI
Node: Make sure root access is allowed via ssh in ssh configuration files. In other case replication will fail.
A public encryption key must be copied from FreeNAS to our Ubuntu system authorisedkeys to allow a secure connection without a password prompt. On FreeNAS, select Storage ‣ Replication Tasks ‣ View Public Key. Use the mouse to highlight the key data shown in the window, then copy it.
zfs list -t snapshot zfs send -v mypool/dataset@snapshotname | ssh myhost zfs receive -v myotherpool/newdataset
On your Ubuntu system to see snapshots and find out how much space they take. Run the following commands
zfs list -t snapshot zfs list -o space
You can now mount snapshot are back it up.
Some useful commands
zpool mount zpool list zpool status zfs list -t snapshot -o name,creation -s creation mount -t zfs P1firstname.lastname@example.org /mnt/test/ # mount snapshot named P1email@example.com on /mnt/test