This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
zfs_snapshot_send_receive [2017/08/27 13:45] ian created |
zfs_snapshot_send_receive [2020/02/13 22:55] (current) |
||
---|---|---|---|
Line 4: | Line 4: | ||
http:// | http:// | ||
+ | |||
+ | 1. znapzend is installed as a deb package (systemd service) using: https:// | ||
+ | |||
+ | 2. Create a shared key for SSH to allow password-less login from source to dest server as the receiver backupuser | ||
+ | |||
+ | < | ||
+ | Do not specify a password on the shared key, just press enter when prompted. | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | ssh-keygen | ||
+ | ssh-copy-id -i / | ||
+ | </ | ||
+ | |||
+ | 3. Create the remote ZFS volume to receive the snapshots and delegate permissions to a non-root user. | ||
< | < | ||
< | < | ||
- | 1. znapzend is installed as a deb package (systemd service) using: https:// | + | < |
+ | destserver:~# zfs create data/test | ||
+ | </code> | ||
- | 2. Create a shared key for SSH to allow password-less login from source to dest server as root | + | < |
+ | 'zfs allow' does not yet work with ZFS on Linux < 0.7.0 to allow a non-root destination user | ||
< | < | ||
- | ssh-keygen | + | destserver: |
- | ssh-copy-id -i /root/ | + | |
+ | destserver: | ||
+ | ---- Permissions on data/test ---------------------------------------- | ||
+ | Local+Descendent permissions: | ||
+ | user backupuser create, | ||
</ | </ | ||
+ | </ | ||
3. Create a snapshot schedule consisting of a local SRC schedule, and the remote DST schedule to send the snapshots. | 3. Create a snapshot schedule consisting of a local SRC schedule, and the remote DST schedule to send the snapshots. | ||
Line 22: | Line 45: | ||
Keep snapshots for 1week, with a snapshot every 30 minutes | Keep snapshots for 1week, with a snapshot every 30 minutes | ||
< | < | ||
- | # znapzendzetup create | + | # znapzendzetup create SRC ' |
</ | </ | ||
</ | </ | ||
Reload the config of the znapzend daemon | Reload the config of the znapzend daemon | ||
- | <note> | + | <code> |
# systemctl reload znapzend.service | # systemctl reload znapzend.service | ||
- | </note> | + | </code> |
4. The backup schedule is saved as ZFS volume properties | 4. The backup schedule is saved as ZFS volume properties | ||
- | <note> | + | <code> |
# zfs get all data/test | grep org.znapzend | # zfs get all data/test | grep org.znapzend | ||
data/ | data/ | ||
data/ | data/ | ||
- | data/ | + | data/ |
data/ | data/ | ||
data/ | data/ | ||
data/ | data/ | ||
data/ | data/ | ||
- | data/ | + | data/ |
data/ | data/ | ||
data/ | data/ | ||
data/ | data/ | ||
- | </note> | + | </code> |
+ | |||
+ | Watch the output of the znapzend daemon for any errors: | ||
+ | < | ||
+ | :~# journalctl -u znapzend.service -f & | ||
+ | </code> | ||
Watch for local snapshots to be created: | Watch for local snapshots to be created: | ||
- | <note> | + | <code> |
# zfs list -t snap | # zfs list -t snap | ||
NAME | NAME | ||
- | data/ | + | data/ |
- | data/ | + | </ |
- | </note> | + | |
+ | < | ||
+ | destserver: | ||
+ | NAME USED AVAIL REFER MOUNTPOINT | ||
+ | data/ | ||
+ | </code> | ||
+ | |||
+ | < | ||
+ | ~# znapzendztatz -r data/test | ||
+ | USED LAST SNAPSHOT | ||
+ | 85.2K | ||
+ | 0 | ||
+ | </ | ||
+ | |||
+ | 5. You can see how the files and directories looked at snapshot time by accessing the hidden .zfs directory | ||
+ | < | ||
+ | :~# find / | ||
+ | 7 1 -rw-r--r-- | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | destserver: | ||
+ | 7 1 -rw-r--r-- | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | :~# zfs diff data/ | ||
+ | M / | ||
+ | M / | ||
+ | + / | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | :~# zfs diff data/ | ||
+ | M / | ||
+ | + / | ||
+ | </code> | ||