ZFS Automate ZFS snapshot backups to another drive

Buck

Member

Reaction score: 11
Messages: 60

So there are several utilities in ports that provide convenient snapshot management, but I haven't been able to find one that would similarly automate cloning and managing those snapshots to a different drive/zfs pool installed in the same machine.
What I'm looking to have is not a clone of the original ZFS datasets selected for backup but rather a directory tree that looks like

/backuppool/mainpoolbackups/usr/home/.zfs/snapshot-01.01.2020/
/backuppool/mainpoolbackups/usr/home/.zfs/snapshot-10.01.2020/
...


I know it's possible to send specific snapshots from one pool to another manually, but is there a way to automate the process using some kind of utility that would look for current snapshots on the main pool, compare them to snapshot backups on the backup pool and sync those so that those pools contain identical snapshots? Maybe there's another approach I should try to achieve what I'm looking for?
 

Dunuin

New Member


Messages: 7

I want to do the same thing on my FreeNAS Server but I'm not sure if it will work...

I setup a "periodic snapshot task" in FreeNAS which will create 1 snapshot each day "HDDpool/HDD-Share@auto_xyz" and delete snapshots older than 1 week so I am protected against ransomware.

But I also want to run a backup script manually to replicate the datasets to a USB-HDD once every 1 oder 2 months like in the Script T-Daemon posted.
How is that working together with the periodic snapshots which will be created and also deleted between two backups?

Is it unimportent If other snapshots are created or deleted as long as the manually created backup snapshots are untouched?

Like here?:

Initial backup...
zfs snapshot "HDDpool/HDD-Share@backup_Initial"
zfs send "HDDpool/HDD-Share@backup_initial" | zfs recv "backuppool/HDD-Share_backup"
... one month later while 30 "HDDpool/HDD-Share@auto_xyz" snapshots were created and 23 "@auto" Snapshots already deleted...
zfs snapshot "HDDpool/HDD-Share@backup_2"
zfs send -i "HDDpool/HDD-Share@backup_initial" "HDDpool/HDD-Share@backup_2" | zfs recv "backuppool/HDD-Share_backup"
zfs destroy "HDDpool/HDD-Share@backup_Initial"
...some weeks and dozens of created and deleted "@auto" snapshots later...
zfs snapshot "HDDpool/HDD-Share@backup_3"
zfs send -i "HDDpool/HDD-Share@backup_2" "HDDpool/HDD-Share@backup_3" | zfs recv "backuppool/HDD-Share_backup"
zfs destroy "HDDpool/HDD-Share@backup_2"
 
OP
Buck

Buck

Member

Reaction score: 11
Messages: 60

Don't know why exactly but I wasn't able to get Znapzend to work properly. Snapshots are replicated but their contents isn't matched with the source snapshot contents. I see a .zfs/snapname-date/... folders with correct names but inside the contents is all the same (seemingly unchanged from some previous snapshot), even though original .zfs folders on the main drive all have correct contents.
 

kevdog

New Member

Reaction score: 5
Messages: 19

Don't know why exactly but I wasn't able to get Znapzend to work properly. Snapshots are replicated but their contents isn't matched with the source snapshot contents. I see a .zfs/snapname-date/... folders with correct names but inside the contents is all the same (seemingly unchanged from some previous snapshot), even though original .zfs folders on the main drive all have correct contents.
Hmm that's strange. I get what you're saying. Settings and can you post some examples?
 

fcorbelli

Active Member

Reaction score: 74
Messages: 195

A rather old request, but better late then never

So there are several utilities in ports that provide convenient snapshot management, but I haven't been able to find one that would similarly automate cloning and managing those snapshots to a different drive/zfs pool installed in the same machine.
What I'm looking to have is not a clone of the original ZFS datasets selected for backup but rather a directory tree that looks like

/backuppool/mainpoolbackups/usr/home/.zfs/snapshot-01.01.2020/
/backuppool/mainpoolbackups/usr/home/.zfs/snapshot-10.01.2020/
...


I know it's possible to send specific snapshots from one pool to another manually, but is there a way to automate the process using some kind of utility that would look for current snapshots on the main pool, compare them to snapshot backups on the backup pool and sync those so that those pools contain identical snapshots? Maybe there's another approach I should try to achieve what I'm looking for?
If someone want to "freeze" some snapshots forever, with optional restore of files one by one, it is possible to try a somewhat radical approach, storing snapshots inside a single archive, by the mighty (I am joking of course) zpaqfranz
with the zfsadd command.

The archive can be stored everywhere, just like a .tar or .7z or whatever, with optional encryption (something not easy to do with replicas).

The purpose is to maintain the data without time limit, just forever (aka: a backup policy for very valuable files), NOT a somewhat "hacked" zfs replica-superscript, that will require, sooner or later, purging of older snaps.
 
Top