User Tools

Site Tools


project:rsnapshot-zfs-helper

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
project:rsnapshot-zfs-helper [2018/01/24 13:34] – [what's happening] 88.65.214.4project:rsnapshot-zfs-helper [2021/06/17 00:18] (current) 37.49.32.145
Line 17: Line 17:
 As zfs uses copy-on-write there is no need to somehow emulate this with '''cp -al ...'''. As zfs uses copy-on-write there is no need to somehow emulate this with '''cp -al ...'''.
  
-===== how =====+===== example for rsnapshot ======
  
-rsnapshot-zfs-helper is to be configured inside rsnapshot's configuration. i.e. '''/etc/rsnapshot-backup.d/enabled/conf.<BACKUP-CLIENT>'''+[[project:rsnapshot-zfs-helper:rsnapshot-example|Example for using rsnapshot-zfs-helper with rsnapshot]]
  
-Additionally, '''cmd_cp''' has to be set to '''/bin/true'''.+===== example for rsnapshot-backup ======
  
 +[[project:rsnapshot-zfs-helper:rsnapshot-backup-example|Example for using rsnapshot-zfs-helper with rsnapshot-backup]]
 +
 +
 +
 +
 +
 +==== Example for creating a zpool: ====
 <code> <code>
-cmd_cp        /bin/true +## 
-cmd_preexec   /usr/sbin/rsnapshot-zfs-helper /etc/rsnapshot-backup.d/enabled/conf.<BACKUP-CLIENTpreexec +## setup zfs (optional) 
-cmd_postexec  /usr/sbin/rsnapshot-zfs-helper /etc/rsnapshot-backup.d/enabled/conf.<BACKUP-CLIENT> postexec+## 
 +# 'bpo' kernel won't do the trick 
 +apt-get install linux-image-amd64 
 +apt-get clean 
 +reboot 
 + 
 +- add "contrib" to the apt-sources 
 +apt-get update 
 +apt-get install zfs-dkms zfsutils-linux 
 +apt-get clean 
 + 
 +/sbin/modprobe zfs 
 + 
 +## caveat: this example (a single disk partition) is neither redundant nor exceptionally performant 
 +## and serves for illustration purpose only!  
 +## create partition for zfs: 
 +Device     Boot   Start       End   Sectors  Size Id Type 
 +... 
 +/dev/sda3       4194304 209715199 205520896   98G bf Solaris 
 + 
 +## create zpool without mount point 
 +zpool create zp-bak /dev/sda3 -m none 
 + 
 +# create prereq. datasets 
 +zfs create zp-bak/backup                        -o compression=lz4 -o snapdir=hidden -o xattr=sa -o acltype=posixacl -o mountpoint=/backup 
 +zfs create zp-bak/backup/hosts                  -o compression=lz4 -o snapdir=hidden -o xattr=sa -o acltype=posixacl -o mountpoint=/backup/hosts 
 +df   
 +-> 
 +   Filesystem     1K-blocks    Used Available Use% Mounted on 
 +   ... 
 +   zp-bak/backup        99041152     128  99041024   1% /backup 
 +   zp-bak/backup/hosts  99041152     128  99041024   1% /backup/hosts
 </code> </code>
  
-Create a zfs dataset using:+## if you use rsnapshot you have to add the commands commands below 
 +## if you use rsnapshot-backups the tool rsnapshot-backup-conf will handle those for you 
 +Create a zfs dataset for a single backup:
 <code> <code>
-zfs create <ZPOOL>/<BACKUP-CLIENT>/daily.0+zfs create <ZPOOL>/backup/hosts/<BACKUP-CLIENT> -o compression=lz4 -o snapdir=hidden -o xattr=sa -o acltype=posixacl -o mountpoint=/backup/hosts/<BACKUP-CLIENT>/daily.0 
 +# e.g. 
 +zfs create zp-bak/backup/hosts/srv42 -o compression=lz4 -o snapdir=hidden -o xattr=sa -o acltype=posixacl -o mountpoint=/backup/hosts/srv42/daily.0
 </code> </code>
  
Line 39: Line 81:
 50 23 * * 5 root /usr/sbin/rsnapshot-zfs-helper /etc/rsnapshot-backup.d/enabled/conf.<BACKUP-CLIENT> weekly 50 23 * * 5 root /usr/sbin/rsnapshot-zfs-helper /etc/rsnapshot-backup.d/enabled/conf.<BACKUP-CLIENT> weekly
 55 23 1 * * root /usr/sbin/rsnapshot-zfs-helper /etc/rsnapshot-backup.d/enabled/conf.<BACKUP-CLIENT> monthly 55 23 1 * * root /usr/sbin/rsnapshot-zfs-helper /etc/rsnapshot-backup.d/enabled/conf.<BACKUP-CLIENT> monthly
-</code> +</code>
  
 ===== how it works ===== ===== how it works =====
Line 55: Line 97:
   * But why then use UTC? **A:** I would have preferred to use ISO-8601 with timezone notation. But zfs does not accept '+' as a character in snapshot names. So I used the format closest by - the UTC timestamp.   * But why then use UTC? **A:** I would have preferred to use ISO-8601 with timezone notation. But zfs does not accept '+' as a character in snapshot names. So I used the format closest by - the UTC timestamp.
   * What's the deal with '''cmd_cp /bin/true'''? **A:** Think of it as NOOP.   * What's the deal with '''cmd_cp /bin/true'''? **A:** Think of it as NOOP.
 +  * Why is the .zfs subdir hidden ('''snapdir=hidden''')? **A:** Because rsync would traverse it and all the subsequent snapshots resulting in really bad performance.
 +  * Where can I download rsnapshot-zfs-helper? **A:** https://www.fischglas.de/software/rsnapshot-zfs-helper/
  
  
  
project/rsnapshot-zfs-helper.1516797268.txt.gz · Last modified: 2018/01/24 13:34 by 88.65.214.4