Primary and backup different conf

I have 3 Ubuntu ZFS file servers that utilize Sanoid/Syncoid for backups. Primary pushes to on-site backup and off-site pulls from backup via daily Syncoid crons. All 3 share the same sanoid.conf:

[tank]
use_template = backup
recursive = yes

#############################
# templates below this line #
#############################

[template_backup]
        frequently = 0
        hourly = 24
        daily = 30
        monthly = 12
        yearly = 7
        autosnap = yes
        autoprune = yes

Is there a way to configure the primary to only keep 24 hourly and 30 daily, while not affecting the multiple month and year backups already on the on-site and off-site backups? In other words, I would like for the primary to continue pushing hourly/daily snapshots to the backup, but I would also like the backup to 1) not delete any monthly/yearly already created and more importantly 2) instead of receiving monthly/yearly from primary, use the hourly/daily snapshots it receives from primary to create its own monthly/yearly snapshots?

Would it be as simple as giving primary something like the below conf or would it be necessary for primary to have at least 1 monthly and yearly:

[template_primary]
        frequently = 0
        hourly = 24
        daily = 30
        monthly = 0
        yearly = 0
        autosnap = yes
        autoprune = yes

syncoid will manage whatever snapshots it needs. You can choose different policies for sanoid on different hosts to meet your needs.

AFAIK you can get in trouble if syncoid uses some sanoid snapshots and, for some reason, doesn’t run for a while, resulting in no common snapshots between sender and receiver. That then requires sending the entire dataset.

You can create file based pools and set up whatever configuration you think will work and try it in the test pools.

You can set policies independently on the three hosts, and they’ll retain what they want to retain.

The biggest thing I’m worried about is that you said the three hosts have “the same” config. You need to only be using a production template on the source host; the other two should be using either backup or hotspare templates, depending on how frequently replication is expected to occur. (Or, if you thoroughly understand what you’re doing, you can create your own templates or ignore the template system altogether: but you’d still better get the details right as to which machines take snaps, and which simply receive them, and how frequently the latter is expected.)

1 Like

It sounds like I’m doing it incorrectly then because all 3 (primary, on-site backup, off-site backup) have the same sanoid.conf as I posted in the OP. The primary pushes via a daily cron with syncoid -r tank root@backup:tank. This has worked for me for a few years, but the issue I am running into is space needs to now be cleared up on the primary so there’s no reason for it to keep monthly/yearly Sanoid snaps on it if they are safely on the 2 backups.

I was not sure if I could have Sanoid on 2 different systems where the primary has monthly/yearly set to = 0 while the backup it is pushing to has monthly = 12 and yearly = 7. But what it sounds like is that is possible as long as the backup is making its own snapshots, not just receiving from primary (but that is how it currently is anyway since all have a template with autosnap = yes).

No. The thing you aren’t getting yet is that you can’t take snapshots directly on the backup target: I mean, you can, but (at best) they’ll instantly get wiped out with each incoming replication. That’s why you use the backup or hotspare template on targets, so they don’t try to take snapshots locally.

Once you understand that, it should be obvious why you can’t have any yearly snapshots on a target if its source isn’t taking any yearly snapshots.

What you can do is, for instance, monthly=3 on the source and monthly=12 on the target(s).