Help setting up ZFS snapshot schedule

seijirou

n00b
Joined
Feb 28, 2012
Messages
34
tl;dr can anybody recommend a snapshot based zfs backup script that's intuitive and flexible?

In my previous btrfs life I used some scripts written by someone else to do some scheduled incremental snapshotting and I'm sure it can be done with ZFS too, but the way it works is different enough that I'm not sure how.

The way it worked with the scripts I used before would start by creating a read-only snapshot, and from that create a rw version, then send the read-only snapshot over to a 2nd pool, and in that 2nd pool create a rw version from the ro version. Then I'd pass an argument to keep x number of snapshots.

I then used a rw version from the backup pool as a source for a remote cloud-based backup.

I would do this on an hourly, daily, weekly, and monthly schedule each with different retention periods. The cloud backup would source the weekly snapshot because it needed more than a day to complete a run. This was pretty simple because the latest rw snapshot was always referenced by a symlink "<pool_name>_last_rw" so all I had to do was share the symlink via smb/nfs and reboot the cloud backup machine once a week after the snap schedule and it would pick up the latest version. Generating the symlink was something the script handled.

So I think that with zfs snapshots are ro by default, and that a rw spawn from that is called a clone. I don't actually care about having a rw clone on the source pool, just the backup pool (because the cloud backup process does some writes).

I know with napp-it I can create replication jobs but I don't know about clones. I also see that it has an option for an SMB share of the replication but it looks like that is ro so it wouldn't work.

So I think what I need is a script that will make a snap, send the snap, clone a rw version of the sent snap, symlink to that latest rw clone, and roll off any snaps and clones that exceed the retention number.

Of course if anybody has a better way to go about it I'm all ears. Thanks for reading.
 
Check out napp-it. It's a GUI web based management tool i use for managing my NAS storage. It does have the keep x snap for xx amount of days. Not sure about the other features.
 
It seems, that the napp-it autoreplication function with the SMB share of the replicated filesystem is nearly what you need. As you said, only problem is that it is readonly.

The readonly behaviour is not a must. It is a setting in the replication script. As the filesystem is resetted on each replication to the last snap, all changes are lost and the readonly is only a setting to avoid a "omg, where are my changes..."

You have the options
1. edit the replication script /var/web-gui/data/napp-it/zfsos/_lib/scripts/job-replicate.pl
line 1934, comment out the line like
#$r=`$ZFS set readonly=on \'$zfs\' 2>&1`;

2. or create an "other job" (ex a simple commnd or shellscript or a Perlscript)
that modifies settings and prepares the filesystem (disable rw, set smbshare=on, repli-job=manual etc).

You do not need to create a writable clone (= a filesystem from a snap) as your replication target is already a filesystem.
You only need to care that there is no replication run during the backup.

3. or use the other job to
- create a snap of the replicated filesystem
- clone the snap
- do your backup
- destroy the clone and the snap
http://docs.oracle.com/cd/E18752_01/html/819-5461/gbcxz.html
 
Last edited:
Well I thought I would try a vanilla replication with smb share just to see what pops out rather than try to do it all at once.

The replication works and I can see the file system on the receiving pool (I understand now why the writeable clone isn't necessary) however I can't seem to get the SMB share to work.

I'm probably just doing it wrong, but here is what I'm doing.

Starting with a filesystem that exists on source, it does not exist on target. I create a replication job and select source/filesystem. I skip next options and select target. I skip next options and enter filesystem_test in "SMB share destination as", I check the box for SMB share guest access, I skip all other options and hit the submit button.

After it runs I see a new target/filesystem but SMB is off as seen under the ZFS Filesystems menu.
 
I have rechecked the reshare function on replications
reshare SMB works but I found a minor problem with the guest option
where you need to set enable (click on job-id ti set guest=enable)

I have modified the 16.01 (January 2016) release of napp-it to
allow yes or enable to activate guest access on a replicated filesystem.
 
Back
Top