Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Sep 2022 14:47:43 -0700
From:      David Christensen <dpchrist@holgerdanske.com>
To:        questions@freebsd.org
Subject:   Re: zfs replication tool
Message-ID:  <e22183b7-8241-06e5-3e56-24074a040a15@holgerdanske.com>
In-Reply-To: <20220916133046.znfelln3fisrjnuz@x1>
References:  <20220916133046.znfelln3fisrjnuz@x1>

next in thread | previous in thread | raw e-mail | index | archive | help
On 9/16/22 06:30, Julien Cigar wrote:
> Hello,
> 
> I have the case here where I have to atomically snapshot recursively a
> dataset with many children (100+) but exclude a dozen of them.
> 
> There are dozen of ZFS replication tools and I was wondering which ones
> supports such case and are recommended?
> 
> It looks like "recursivity" in a lot of tools is handled through "zfs
> snapshot -r somepool" whereas ZFS also supports "zfs snapshot
> somepool/ds1 somepool/ds2 somepool/ds3/child1" which is also atomic


I use the zfs(8) program from a terminal to recursively create snapshots 
via 'zfs snapshot -r'.  RTFM I do not see an exclude option.  Perhaps 
you should file a feature request.


(I also use zfs-auto-snapshot from crontab(5).  AIUI it is a Ruby script 
that automates the 'zfs snapshot' and 'zfs destroy' commands.  It is 
configured via command-line options and dataset properties.)


The KISS solution is to organize the datasets into two hierarchies -- 
one for recursive snapshots and another for without.  This will also 
facilitate incremental replication via 'zfs send -R' with the '-i' or 
'-I' options.


A brute force approach would be to do a recursive snapshot, followed by 
destroying the snapshots you do not want.  But, beware -- incremental 
replication of dataset hierarchies with missing snapshots can be 
problematic.


Another idea is to to halt operations on the hierarchy, create snapshots 
of the desired datasets, and then resume operations on the hierarchy. 
Of course, this means coordinating with every process that uses the 
datasets.  The dataset 'readonly' property could be used as a fail-safe 
while creating snapshots.  Again, beware replication issues.


David



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?e22183b7-8241-06e5-3e56-24074a040a15>