This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
zfs_snapshot_send_receive [2017/08/27 13:48] ian |
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 ' |
</ | </ | ||
</ | </ | ||
Line 36: | Line 59: | ||
data/ | data/ | ||
data/ | data/ | ||
- | data/ | + | data/ |
data/ | data/ | ||
data/ | data/ | ||
data/ | data/ | ||
data/ | data/ | ||
- | data/ | + | data/ |
data/ | data/ | ||
data/ | data/ | ||
Line 47: | Line 70: | ||
</ | </ | ||
- | Watch the output of the znapzend daemon: | + | Watch the output of the znapzend daemon |
< | < | ||
- | :~# journalctl -u znapzend.service -f | + | :~# journalctl -u znapzend.service -f & |
</ | </ | ||
Line 56: | Line 79: | ||
# zfs list -t snap | # zfs list -t snap | ||
NAME | NAME | ||
- | data/ | + | data/ |
- | data/ | + | </ |
+ | |||
+ | < | ||
+ | destserver: | ||
+ | NAME USED AVAIL REFER MOUNTPOINT | ||
+ | data/ | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | ~# 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 / | ||
+ | + / | ||
</ | </ | ||