User Tools

Site Tools


zfs_snapshot_send_receive

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
zfs_snapshot_send_receive [2017/08/27 14:07]
ian
zfs_snapshot_send_receive [2020/02/13 22:55] (current)
Line 4: Line 4:
  
 http://www.znapzend.org/ http://www.znapzend.org/
- 
-<note>The ZFS volume of the given name must exist on the remote node 
-<code>*** WARNING: destination 'root@destserver:data/test' does not exist, will be ignored! ***</code></note> 
  
 1. znapzend is installed as a deb package (systemd service) using: https://github.com/Gregy/znapzend-debian 1. znapzend is installed as a deb package (systemd service) using: https://github.com/Gregy/znapzend-debian
Line 18: Line 15:
 <code> <code>
 ssh-keygen ssh-keygen
-ssh-copy-id -i /root/.ssh/id_rsa.pub backup@desterver+ssh-copy-id -i /root/.ssh/id_rsa.pub root@destserver
 </code> </code>
  
 3. Create the remote ZFS volume to receive the snapshots and delegate permissions to a non-root user. 3. Create the remote ZFS volume to receive the snapshots and delegate permissions to a non-root user.
 +
 +<note>The ZFS volume of the given name must exist on the remote node
 +<code>*** WARNING: destination 'root@destserver:data/test' does not exist, will be ignored! ***</code></note>
  
 <code> <code>
-# zfs create data/test+destserver:~# zfs create data/test 
 +</code>
  
-zfs allow -u backupuser create,receive,rename,mount,send data/test+<note> 
 +'zfs allow' does not yet work with ZFS on Linux < 0.7.0 to allow a non-root destination user
  
-# zfs allow data/test+<code> 
 +destserver:~# zfs allow -u backupuser create,receive,rename,mount,send data/test 
 + 
 +destserver:~# zfs allow data/test
 ---- Permissions on data/test ---------------------------------------- ---- Permissions on data/test ----------------------------------------
 Local+Descendent permissions: Local+Descendent permissions:
         user backupuser create,mount,receive,rename,send         user backupuser create,mount,receive,rename,send
 </code> </code>
 +</note>
  
 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 39: Line 45:
 Keep snapshots for 1week, with a snapshot every 30 minutes Keep snapshots for 1week, with a snapshot every 30 minutes
 <code> <code>
-# znapzendzetup create --recursive SRC '1week=>30min' data/test DST '1week=>30min' backupuser@destserver:data/test+# znapzendzetup create SRC '1week=>30min' data/test DST '1week=>30min' root@destserver:data/test
 </code> </code>
 </note> </note>
Line 53: Line 59:
 data/test  org.znapzend:tsformat       %Y-%m-%d-%H%M%S                         local 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:pre_znap_cmd   off                                     local
-data/test  org.znapzend:dst_0          backupuser@destserver:data/test  local+data/test  org.znapzend:dst_0          root@destserver:data/test               local
 data/test  org.znapzend:mbuffer        off                                     local data/test  org.znapzend:mbuffer        off                                     local
 data/test  org.znapzend:dst_0_plan     1weeks=>30minutes                       local data/test  org.znapzend:dst_0_plan     1weeks=>30minutes                       local
 data/test  org.znapzend:enabled        on                                      local data/test  org.znapzend:enabled        on                                      local
 data/test  org.znapzend:zend_delay                                           local data/test  org.znapzend:zend_delay                                           local
-data/test  org.znapzend:recursive      on                                      local+data/test  org.znapzend:recursive      off                                     local
 data/test  org.znapzend:mbuffer_size   1G                                      local data/test  org.znapzend:mbuffer_size   1G                                      local
 data/test  org.znapzend:post_znap_cmd  off                                     local data/test  org.znapzend:post_znap_cmd  off                                     local
Line 64: Line 70:
 </code> </code>
  
-Watch the output of the znapzend daemon:+Watch the output of the znapzend daemon for any errors:
 <code> <code>
 :~# journalctl -u znapzend.service -f & :~# journalctl -u znapzend.service -f &
Line 80: Line 86:
 NAME                          USED  AVAIL  REFER  MOUNTPOINT NAME                          USED  AVAIL  REFER  MOUNTPOINT
 data/test@2017-08-27-110000      0      -    19K  - data/test@2017-08-27-110000      0      -    19K  -
 +</code>
 +
 +<code>
 +~# znapzendztatz -r data/test
 +USED    LAST SNAPSHOT       DATASET
 +85.2K   2017-08-27-110000   data/test
 +    0   2017-08-27-110000   root@destserver:data/test
 +</code>
 +
 +5. You can see how the files and directories looked at snapshot time by accessing the hidden .zfs directory
 +<code>
 +:~# find /data/test/.zfs -type f -ls
 +              7      1 -rw-r--r--   1 root     root            0 Aug 27 11:08 /data/test/.zfs/snapshot/2017-08-27-113000/a.txt
 +</code>
 +
 +<code>
 +destserver:~# find /data/test/.zfs -type f -ls
 +              7      1 -rw-r--r--   1 root     root            0 Aug 27 14:08 /data/test/.zfs/snapshot/2017-08-27-113000/a.txt
 +</code>
 +
 +<code>
 +:~# zfs diff data/test@2017-08-27-113000
 +M       /data/test/
 +M       /data/test/a.txt
 ++       /data/test/b.txt
 +</code>
 +
 +<code>
 +:~# zfs diff data/test@2017-08-27-110000 data/test@2017-08-27-113000
 +M       /data/test/
 ++       /data/test/a.txt
 </code> </code>
  
zfs_snapshot_send_receive.1503857246.txt.gz · Last modified: 2020/02/13 22:55 (external edit)

free spam filter