systemd-zfs-partition-backup.sh
How to:
- rsync is required and used internally with
--delete
to get rid of already deleted files (with zfs we have snapshots)
- systemd-automount should be working for the device to back up (=fstab)
- A zfs dataset will be searched with the name of the partition. If it is there it will be used for the backup.
- if the partion is encrypted an entry in the
crypttab
will automatically be found by automount.
- have fun.
crypttab
# /etc/crypttab example
SomeDisk_SDSSDH0000G_123456789-part2 /dev/disk/by-id/SomeDisk_SDSSDH0000G_123456789-part2 /etc/.crypt/SomeDisk_SDSSDH0000G_123456789-part2.key noauto,x-systemd.device-timeout=5s
fstab
# /etc/fstab example
# Note that the connector name has been removed from the mountpoint.
# The automount unit will be named after that and so must the zfs dataset
/dev/disk/by-id/ata-SomeDisk_SDSSDH0000G_123456789-part1 /media/SomeDisk_SDSSDH0000G_123456789-part1 auto defaults,noauto,ro,x-systemd.automount,x-mount.mkdir,x-systemd.idle-timeout=1min,x-systemd.device-timeout=5s 0 0
# The following name takes the name we gave our disk in the crypttab (first column).
# Such devices are then available via /dev/mapper/:
/dev/mapper/SomeDisk_SDSSDH0000G_123456789-part2 /media/SomeDisk_SDSSDH0000G_123456789-part2 auto defaults,noauto,ro,x-systemd.automount,x-mount.mkdir,x-systemd.idle-timeout=1min,x-systemd.device-timeout=5s 0 0