Is it possible to efficiently detect changes in subvolumes before creating a new snapshot?
Hi, I find bcachefs very promising and have been following it for quite a while now. Since the "experimental" flag is gone, I'm seriously considering switching to bcachefs. So I am currently looking into whether it can support a snapshot workflow similar to the one I use currently.
I currently use Btrfs together with btrbk. One feature I find particularly useful is the onchange snapshot policy of btrbk.
With this policy, btrbk creates a new snapshot only when the source subvolume has changed since the previous snapshot. According to the btrbk documentation, this is implemented using the "Btrfs generation counter", which allows the tool to detect changes efficiently without comparing every file in the subvolume with the previous snapshot.
Hence the question: Does bcachefs happen to offer a similar mechanism that could be exploited for this purpose?
More specifically, is there some kind of generation ID, transaction ID, change counter, or other metadata that can be queried to determine whether a subvolume differs from an existent snapshot.
I am looking for an efficient check that does not require walking the entire directory tree or comparing all files between the current subvolume and the latest snapshot or relies on "inotifying" a whole subvolume.
My goal is to retain only snapshots whose filesystem state actually differs from the preceding snapshot to avoid multiple identical (hourly) snapshots.
Furthermore, I want to prevent the hard drives from spinning up unnecessarily just to create a snapshot that is identical to an already existing one. Could this second problem possibly be solved simply by pinning the metadata to the SSDs?