From: Andrew Skretvedt <andrew.skretvedt@gmail.com>
To: linux-btrfs@vger.kernel.org
Subject: Re: what mens gen and ogen in btrfs sub list / ?
Date: Thu, 14 Apr 2022 06:32:22 -0500 [thread overview]
Message-ID: <t390o7$r7k$1@ciao.gmane.io> (raw)
In-Reply-To: <587892959.1863318.1648125512532.JavaMail.zimbra@helmholtz-muenchen.de>
Hello, basic btrfs user and enthusiast here. I have a reaction, seeing
as none of the experts here have so far replied,
On 3/24/22 7:38 AM, Lentes, Bernd wrote:
> I read the manpage and stumbled across gen and ogen of snapshots.
> But what does that mean and how can the values be interpreted ?
> Or is there another way to list the snapshots by e.g. creation date ?
I'm going by the manpages,
I don't claim to understand the concept of "generation" with respect to
subvolumes, but I've noted that it seems to be something that
continually increases as you use a btrfs filesystem. In doing some tests
today, I find that when I create a new subvolume inside another, the gen
of the containing subvolume and the newly created subvolume increase to
a new, larger value in common to both, and that the cgen (someone can
say how cgen and ogen relate, the manpage doesn't mention cgen, while
the tools report it, and it seems like cgen is a new name for ogen) on
the newly created subvolume is the value the containing subvolume gen
had before the new subvolume was created.
So, these values don't seem to me to be what you'd want to track.
> i'd like to write a script in which, beneath other stuff, the oldest snapshot(s) are deleted.
> So i'm looking for a way to sort the list of the snapshots by date.
Here, the rootids are closer to what you want. These also increase with
each new subvolume created. Newer snapshots will have higher IDs than
older ones. Also the 'btrfs subvolume list' command has an option to
list out only /snapshots/, as opposed to subvolumes which weren't
created as a result of a snapshot operation. With such a list, you could
select from the list of snapshot subvolumes, those with lower IDs for
candidate deletion.
I also found in the manpage that 'btrfs subvolume show' will display
extra info that isn't listed in 'btrfs subvolume list', among which is
the subvolume's creation date. It would be a more complicated script,
but issuing 'show' commands on the snapshots reported in the 'list'
command would allow you to build up a list of creation dates for each
snapshot. Then, you could issue 'delete' commands according to some
date-based criterion set by your script.
I don't know if another way to reveal the creation dates of snapshot
subvolumes, but if another method exists, I leave it to others to point out.
In my own use of btrfs subvolumes and snapshotting, I name snapshot
subvolumes using a date-based name scheme, so the subvolume path
implicitly also reveals the date of the snapshot's creation. I also
enjoy the 'send'/'receive' features of btrfs, and I find myself paying
the most attention to the various UUIDs that subvolumes may have. This
allows me to track which parent subvolume UUID a snapshot is created
from, as well as what subvolume a sent/received subvolume relates to.
The UUID scheme btrfs subvolumes use really seems clever, to me. I've
used it to great success in sending incremental changes efficiently to
backup storage, as a given reference subvolume is repeatedly snapshot.
Hope that gives you some insight.
-A
--
OpenPGP 0xC6901B2A6C976BB3 (https://keys.openpgp.org)
next prev parent reply other threads:[~2022-04-14 11:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-24 12:38 what mens gen and ogen in btrfs sub list / ? Lentes, Bernd
2022-04-14 11:32 ` Andrew Skretvedt [this message]
2022-04-14 13:39 ` Nikolay Borisov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='t390o7$r7k$1@ciao.gmane.io' \
--to=andrew.skretvedt@gmail.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox