On Sat, Sep 30, 2017 at 07:56:25PM +0200, Holger Hoffstätte wrote:
> On 09/30/17 18:37, Graham Cobb wrote:
> > On 30/09/17 14:08, Holger Hoffstätte wrote:
> >> A "root" subvolume is identified by a null parent UUID, so adding a new
> >> subvolume filter and flag -P ("Parent") does the trick. 
> > 
> > I don't like the naming. The flag you are proposing is really nothing to
> > do with whether a subvolume is a parent or not: it is about whether it
> > is a snapshot or not (many subvolumes are both snapshots and also
> > parents of other snapshots, and many non-snapshots are not the parent of
> > any subvolumes).
> 
> You're completely right. I wrote that patch about a year ago because I
> needed it for my own homegrown backup program and spent approx. 5 seconds
> finding a free option letter; ultimately I ended up using the mentioned
> shell hackery as alternative. Anyway, I was sure that at the time the
> other letters sounded even worse/were taken, but that may just have been
> in my head. ;-)
> 
> I just rechecked and -S is still available, so that's good.

Hi Holger,

On the topic of shell hackery, someone on #btrfs and I discussed this
two days ago.  The method I decided to use was blacklisting snapshots
(subvols with parent UUID) that also had to ro property set.

The rational was that a rw snapshot (with parent UUID but not ro
property) could contain live data.  eg: subvol containerA, containerB,
and containerC are all rw children of subvol containerX.  My backup
script would include containerA, containerB, and containerC in the
automatically generated list of live data subvols that need to be
snapshotted and backed up.  Because containerX has no parents it is
part of this list, regardless of whether or not it's ro.

Would you please consider addressing rw child subvols (eg: containers
cloned from a base subvol) in your patch?

> > I have two suggestions:
> > 
> > 1) Use -S (meaning "not a snapshot", the inverse of -s). Along with this
> > change. I would change the usage text to say something like:
> > 
> >  -s list subvolumes originally created as snapshots
> >  -S list subvolumes originally created not as snapshots
> > 
> > Presumably specifying both -s and -S should be an error.
> 
> That sounds much better indeed and is a quick fix. While I agree
> that the "-P <uuid>/none" filter would be useful too, it's also
> a different feature and more work than I want to invest in this
> right now. Maybe later "-S" can simply delegate to "-P none".

Proposed -s will exclude both containerX and container{A,B,C}
Proposed -S will add containerX (base subvolume) to list,
and will exclude container{A,B,C}

I believe the quickest way to solve this would be to add a check for
ro property to:
-s list read-only subvolumes originally created as snapshots

Then in the backup script:  1) get the full subvolume list  2) get the
ro snapshot list  3) Use #2 to remove ro snapshots from #1  4) Backup
subvols from #1 list

Thank you for working on this! :-)

Sincerely,
Nicholas

P.S. Please CC me for any replies

Attachment: signature.asc
Description: PGP signature

Reply via email to