My small home server runs on a distribution featuring ZFS. On that system, I implemented a rolling snapshot scheme:
- every hour, a snapshot is created
- once a day, the chain is thinned so that I have a set of hourly / daily / weekly / monthly snapshots
I would like to store an offsite backup of some of the file systems on a USB drive in my office. The plan is to update the drive every other week. However, due to the rolling snapshot scheme, I have troubles implementing incremental snapshots.
To given you an illustration, this is my desired procedure:
- Initial snapshot:
zfs snap tank/fs@snap0 - Transfer initial snapshot:
zfs send tank/fs@snap0 | zfs recv -Fduv backup_tank - Store
backup_tankoffsite - Make a few snapshots:
zfs snap tank/fs@snap1,zfs snap tank/fs@snap2 - Thin the chain:
zfs destroy tank/fs@snap0 - Return
backup_tankand make an incremental update of the filesystem - Obviously,
zfs send -I snap0 tank/fs@snap2 | zfs recv -Fduv backup_tankfails assnap0does not exist ontankanymore.
Long story cut short:
Is there a clever solution for combining thinning of snapshot chains and incremental send / recv? Every time I attach the drive and run some commands I would like to a have a copy of the file system at that point of time. In this example, backup_tankshould contain the snapshots fs@snap1 and fs@snap2.