User Tools

Site Tools


zfs_snapshot_send_receive

This is an old revision of the document!


ZFS Snapshot Send/Receive

Local ZFS snapshots are uploaded to a remote server (backup) over SSH, using the utility znapzend to manage the snapshot schedule.

http://www.znapzend.org/

The ZFS volume of the given name must exist on the remote node
*** WARNING: destination 'root@destserver:data/test' does not exist, will be ignored! ***

1. znapzend is installed as a deb package (systemd service) using: https://github.com/Gregy/znapzend-debian

2. Create a shared key for SSH to allow password-less login from source to dest server as root

ssh-keygen
ssh-copy-id -i /root/.ssh/id_rsa.pub root@desterver

3. Create a snapshot schedule consisting of a local SRC schedule, and the remote DST schedule to send the snapshots.

Keep snapshots for 1week, with a snapshot every 30 minutes
# znapzendzetup create --recursive SRC '1week=>30min' data/test DST '1week=>30min' root@destserver:data/test

Reload the config of the znapzend daemon

# systemctl reload znapzend.service

4. The backup schedule is saved as ZFS volume properties

# zfs get all data/test | grep org.znapzend
data/test  org.znapzend:tsformat       %Y-%m-%d-%H%M%S                         local
data/test  org.znapzend:pre_znap_cmd   off                                     local
data/test  org.znapzend:dst_0          root@destserver:data/test  local
data/test  org.znapzend:mbuffer        off                                     local
data/test  org.znapzend:dst_0_plan     1weeks=>30minutes                       local
data/test  org.znapzend:enabled        on                                      local
data/test  org.znapzend:zend_delay     0                                       local
data/test  org.znapzend:recursive      on                                      local
data/test  org.znapzend:mbuffer_size   1G                                      local
data/test  org.znapzend:post_znap_cmd  off                                     local
data/test  org.znapzend:src_plan       1weeks=>30minutes                       local

Watch the output of the znapzend daemon:

:~# journalctl -u znapzend.service -f

Watch for local snapshots to be created:

# zfs list -t snap
NAME                                 USED  AVAIL  REFER  MOUNTPOINT
data/test@2017-08-27-100000             0      -   128K  -
data/test@2017-08-27-103000             0      -   128K  -
zfs_snapshot_send_receive.1503856097.txt.gz · Last modified: 2020/02/13 22:55 (external edit)

free spam filter