I am attempting to create a removable backup system that will replicate my datasets to removable pool in a hot swap cartridge. After spending hours with the man pages and online research, I still need a bit of help. I've tried to answer my own question below to the best of my ability, and I'm hoping someone with ZFS experience can fill in a few blanks or spot obvious errors.
I've figured out that I can replicate incremental snapshots (on a pool with no datasets) with a command like this:
Where:
BACKUP: The removable pool
TANK: The working pool on FreeNAS
SNAP: The last snapshot that was backed up and is already on BACKUP
NOW: The current state to backup.
(@SNAP & @NOW are placeholders for unique timestamped names can be maintained over time.)
I can't afford the luxury of a ton of intermediate snapshots i used '-i'.
I need to do the same thing with a pool structure like this (but split it up into multiple disks due to size):
TANK [HANDFULL OF FILES-I COULD EASILY CREATE ANOTHER DATASET]
TANK/DATASET1 [3TB] ->DISK1
TANK/DATASET2 [4TB] ->DISK1
TANK/DATASET3 [6TB] ->DISK2
I'm assuming that backing up TANK (the root of the pool) on both drives would facilitate (or may even be necessary as a target for ) backup.
What about restoration?
The backed up snapshots of TANK will likely be at different times for BACKUP 1 & 2-i.e. @SNAP would actually be @SNAP1 @SNAP2.
As long as I keep both @SNAP1 & @SNAP2 on TANK will that be a problem?
Will @SNAP1 & @SNAP2 on TANK (or the backups) grow significantly as a result of changes in the child datasets?
Can I restore DATASET1,2,3 without reference to a backup snapshot of the root TANK?
My best guess at how to proceed:
For ease of illustration I'm just calling the BACKUP pool BACKUP.
(I actually plan on having the name changed automatically to BACKUP01, BACKUP02, etc, but only one drive will be mounted at any time, so SNAP and NOW will likely translate into script variables.
I had a lot of difficulty figuring out exactly what target would receive what snapshot, but I'm thinking the correct way to start the process is to create initial snapshots like this:
Create BACKUP 1
Create BACKUP 2
What do I do to send the incremental snapshots? Will this work:
Incremental BACKUP 1
Incremental BACKUP 2
Can I split a pool like this? Have I got the right targets?
AFAIK this type of thing isn't a common use case since ZFS was originally aimed at enterprise use. I've looked around and haven't been able to find anything readable on replication. If anyone has seen something that would be helpful I'd appreciate a reference.
Unfortunately I don't have spare hardware to test on, so I'm forced to work on a live system, so anything that will reduce the amount of trail and error would be much appreciated. My workstation doesn't have enough RAM that I can virtualize a FreeNAS installation.
If I understood correctly it's possible to create pools & vdevs in files. Is there an easy way to create JUNKPOOL with several datasets and JUNKBACKUP in a file or zvol or something that I could make a miniature mockup to do testing? I've found there is often no substitute for practice but I don't have a test setup I can afford to destroy.
Any comments, suggestions or advice is much appreciated.
----END
P.S. If anybody besides me cares about this type of thing, I'm happy to share what I find (and maybe even some code - don't always promise to write pure POSIX some of the bash extensions save a ton of work.) I'll let replies be my guide since it takes time to post stuff.
I don't know if I'm right or not, but there don't seem to be a lot of good backup alternatives for the "home/small office" for backup and I've got to cobble something together myself. Even rsync is starting to struggle a bit with the huge number of files encoundered with todays giant disks
I've figured out that I can replicate incremental snapshots (on a pool with no datasets) with a command like this:
zfs send -vi TANK@SNAP TANK@NOW | zfs receive -v BACKUP/TANK
Where:
BACKUP: The removable pool
TANK: The working pool on FreeNAS
SNAP: The last snapshot that was backed up and is already on BACKUP
NOW: The current state to backup.
(@SNAP & @NOW are placeholders for unique timestamped names can be maintained over time.)
I can't afford the luxury of a ton of intermediate snapshots i used '-i'.
I need to do the same thing with a pool structure like this (but split it up into multiple disks due to size):
TANK [HANDFULL OF FILES-I COULD EASILY CREATE ANOTHER DATASET]
TANK/DATASET1 [3TB] ->DISK1
TANK/DATASET2 [4TB] ->DISK1
TANK/DATASET3 [6TB] ->DISK2
I'm assuming that backing up TANK (the root of the pool) on both drives would facilitate (or may even be necessary as a target for ) backup.
What about restoration?
The backed up snapshots of TANK will likely be at different times for BACKUP 1 & 2-i.e. @SNAP would actually be @SNAP1 @SNAP2.
As long as I keep both @SNAP1 & @SNAP2 on TANK will that be a problem?
Will @SNAP1 & @SNAP2 on TANK (or the backups) grow significantly as a result of changes in the child datasets?
Can I restore DATASET1,2,3 without reference to a backup snapshot of the root TANK?
My best guess at how to proceed:
For ease of illustration I'm just calling the BACKUP pool BACKUP.
(I actually plan on having the name changed automatically to BACKUP01, BACKUP02, etc, but only one drive will be mounted at any time, so SNAP and NOW will likely translate into script variables.
I had a lot of difficulty figuring out exactly what target would receive what snapshot, but I'm thinking the correct way to start the process is to create initial snapshots like this:
zfs snapshot TANK@SNAP
zfs snapshot TANK/DATASET1@SNAP
zfs snapshot TANK/DATASET2@SNAP
zfs snapshot TANK/DATASET3@SNAP
Create BACKUP 1
zfs snapshot TANK@SNAP | zfs receive BACKUP
zfs send zfs -vi snapshot TANK/DATASET1@SNAP | zfs receive BACKUP
zfs send zfs -vi snapshot TANK/DATASET2@SNAP | zfs receive BACKUP
Create BACKUP 2
zfs snapshot TANK@SNAP | zfs receive BACKUP
zfs send zfs -vi snapshot TANK/DATASET3@SNAP | zfs receive BACKUP
What do I do to send the incremental snapshots? Will this work:
Incremental BACKUP 1
zfs send -vi TANK@SNAP TANK@NOW | zfs receive -v BACKUP/TANK
zfs send -vi TANK/DATASET1@SNAP TANK/DATASET1@NOW | zfs receive -v BACKUP/TANK
zfs send -vi TANK/DATASET2@SNAP TANK/DATASET2@NOW | zfs receive -v BACKUP/TANK
Incremental BACKUP 2
zfs send -vi TANK@SNAP TANK@NOW | zfs receive -v BACKUP/TANK
zfs send -vi TANK/DATASET3@SNAP TANK/DATASET1@NOW | zfs receive -v BACKUP/TANK
Can I split a pool like this? Have I got the right targets?
AFAIK this type of thing isn't a common use case since ZFS was originally aimed at enterprise use. I've looked around and haven't been able to find anything readable on replication. If anyone has seen something that would be helpful I'd appreciate a reference.
Unfortunately I don't have spare hardware to test on, so I'm forced to work on a live system, so anything that will reduce the amount of trail and error would be much appreciated. My workstation doesn't have enough RAM that I can virtualize a FreeNAS installation.
If I understood correctly it's possible to create pools & vdevs in files. Is there an easy way to create JUNKPOOL with several datasets and JUNKBACKUP in a file or zvol or something that I could make a miniature mockup to do testing? I've found there is often no substitute for practice but I don't have a test setup I can afford to destroy.
Any comments, suggestions or advice is much appreciated.
----END
P.S. If anybody besides me cares about this type of thing, I'm happy to share what I find (and maybe even some code - don't always promise to write pure POSIX some of the bash extensions save a ton of work.) I'll let replies be my guide since it takes time to post stuff.
I don't know if I'm right or not, but there don't seem to be a lot of good backup alternatives for the "home/small office" for backup and I've got to cobble something together myself. Even rsync is starting to struggle a bit with the huge number of files encoundered with todays giant disks