Re: zfs replication tool

From: David Christensen <dpchrist_at_holgerdanske.com>
Date: Fri, 23 Sep 2022 22:13:09 UTC
On 9/23/22 06:48, Paul Mather wrote:

> I like zrepl on the whole but it has some annoying quirks and limitations currently that, although I use it for daily replications, make me wish these issues could be addressed:
> 
> 1) Although you can specify a snapshot prefix for pruning purposes, zrepl selects datasets for replication. I discovered that all snapshots on those datasets are replicated, not just the ones you want stewarded by zrepl.


That makes me think zrepl is using the '-I' option with 'zfs send' (e.g. 
incremental stream with target and all intermediary snapshots).


I recently wanted just the monthly snapshots of certain datasets on a 
retired/ archived pool.  I did it by hand, one dataset at a time.  I 
started by replicating the oldest snapshot by itself; e.g. 'zfs send' 
without the '-R' option.  I then did a series of 'zfs send' operations 
with the '-i' option (e.g. incremental stream with target only).  I 
intend to include this use-case in my next generation homebrew scripts.


> In my case, I also use Tivoli TSM (now Spectrum Protect) to back up a system, and make a snapshot (for consistency), which is backed up.  (The snapshot is deleted after the backup finishes.)  I found that zrepl runs were picking up this ephemeral snapshot during the pull job and then getting into a tumult ...


My workflow is to start with a full replication on new backup media 
(e.g. large HDD).  Then periodically (weekly or sooner), I do 
incremental replication (with '-I' option) to online media and/or 
near-site removable media.  On a longer period (monthly), I rotate the 
near-site media and another off-site media.  I must be careful to only 
destroy snapshots (live or on any backup) that are older than the oldest 
incremental target on any backup (e.g. three months).


> 2) Related to 1) above, replicated boot environments cause problems when I delete them (which is usually after I've successfully upgraded).  It leaves a dangling snapshot hold on the receiver side, which I need to clean up manually.


I do not attempt to replicate my boot or root pools.  I keep my OS 
instances small enough to fit onto a "16 GB" device and back up by 
taking a raw image with dd(1) (monthly, or sooner).


David