Sanoid config sanity-check

In my old setup I basically just changed a template with my own schedule and retention, set on the parent with recursion. And while it worked fine, after reading this reply to another question I had posted, and changes to my setup, I figured I’d ask for a sanity check along with some questions.

Out of scope, but I want to mention it for clarity sake, is I don’t consider snapshots or their replicated counterparts as ‘backup’. My backups are made with a backup tool, end to end encrypted, stored offsite with their own retention periods.

So, sandoid. I added new templates based on the type of data I am snapshotting.

[template_hourly]
	frequently = 0
	hourly = 24
	daily = 7
	weekly = 0
	monthly = 0
	yearly = 0
	autosnap = yes
	autoprune = yes

[template_hourly-long]
	frequently = 0
	hourly = 24
	daily = 31
	weekly = 0
	monthly = 0
	yearly = 0
	autosnap = yes
	autoprune = yes

[template_hourly-short]
	frequently = 0
	hourly = 24
	daily = 3
	weekly = 0
	monthly = 0
	yearly = 0
	autosnap = yes
	autoprune = yes

[template_daily]
	frequently = 0
	hourly = 0
	daily = 31
	weekly = 5
	monthly = 1
	yearly = 0
	autosnap = yes
	autoprune = yes

[template_daily-long]
	frequently = 0
	hourly = 0
	daily = 31
	weekly = 5
	monthly = 12
	yearly = 1
	autosnap = yes
	autoprune = yes

[template_daily-short]
	frequently = 0
	hourly = 0
	daily = 7
	weekly = 1
	monthly = 0
	yearly = 0
	autosnap = yes
	autoprune = yes

[template_ignore]
	autoprune = no
	autosnap = no
	monitor = no

I suppose it speaks for itself. A few examples of how datasets would look like:

[data]
        use_template = ignore

[data/coreos-ignite]
       use_template = daily-short

[data/apps/duplicati]
        use_template = daily-short

[data/apps/duplicati/config]
        use_template = hourly-short

[data/apps/minio]
        use_template = daily

[data/apps/nginx-proxy]
        use_template = daily-short

[data/apps/nginx-proxy/acme]
        use_template = hourly-long

[data/apps/nginx-proxy/certs]
        use_template = hourly-long

[data/apps/nginx-proxy/conf]
        use_template = hourly-long

[data/apps/nginx-proxy/html]
        use_template = hourly-long

[data/apps/nginx-proxy/vhosts]
        use_template = hourly-long

Anticipating some questions, a little background info: The parent [data] should never contain data, and it isn’t even mounted, so it is ignored. Each next level dataset has its mountpoint set and recurse down to its children. All their child datasets (ie, below nginx-proxy for example) may seem redundant, why not leave it at the nginx-proxy level and create sub-directories instead of more datasets? Well that’s because I need each of those shared via NFS, and at some point I decided to use ZFS sharenfs feature. Had I chosen to create and manage NFS shares manually, I could have left it as sub-directories. Now I’m guessing you’d want to know why these are shares … :thinking: . Sorry that’s out of scope :wink: .

So far that is hostA.
There is another pool on hostA called [backup], its setup in a similar way.
Sanoid is activated through a systemd timer.
There is second host, called hostB.

Both these pools on hostA with all their datasets should be replicated on a regular basis (nightly?) to hostB. The sole purpose of hostB is to receive and store all of hostsA’s pools, datasets and snapshots for disaster recovery purposes. HostB only has 1 pool though, so hostA pools data and backup should go to hostB into puddle/hostA/data and puddle/hostA/backup respectively.

Now, as for the questions:

  • Does the sanoid config look good? Any advise?
  • Should I setup sanoid on hostB as well, using the backup template for snapshot pruning that get replicated in?
  • Besides the monthly setting, what is the difference between backup and hotspare templates?
  • How do I setup syncoid? Do I simply create a cron job that runs 9 1 * * * root syncoid -r data hostb:puddle/hosta/data? I believe I once read that sanoid could handle sending snapshots but I can’t find that anymore (I could be wrong and just misremembered that). I don’t see a syncoid.conf or timer/service?

There’s another thing that I don’t quite get yet with syncoid. When syncoid -r runs for incremental sends (lets say its been running for 6 months on a daily basis sending the above sanoid snaps). What happens with snapshots on the target that have been pruned at the source? Sanoid creates and prunes, so at some point syncoid runs while a couple of hourlies, dailies and weeklies have been pruned by sanoid. Is that the purpose of template_backup, to just run on the target? It just prunes what gets replicated in? And syncoid doesn’t care what has been removed, it just replicates new snaps to the target? As long as the snapshot retention on the target is longer than the source then all is well then? Am I close? :stuck_out_tongue:

Thanks in advance!

Is that the purpose of template_backup, to just run on the target? It just prunes what gets replicated in? And syncoid doesn’t care what has been removed, it just replicates new snaps to the target? As long as the snapshot retention on the target is longer than the source then all is well then? Am I close? :stuck_out_tongue:

Yes, that’s how it works. Syncoid does not prune remotely, nor should it–if it did, you wouldn’t be able to, eg, keep only seven dailies on your fast SSD production but keep 90 dailies on your slower but much larger rust-based backup system.

By instead using sanoid on each machine, you can govern their retention policies independently.