digint / btrbk

Tool for creating snapshots and remote backups of btrfs subvolumes
https://digint.ch/btrbk/
GNU General Public License v3.0
1.58k stars 116 forks source link

Snapshot cleanup broken on Fedora CoreOS #550

Open har7an opened 11 months ago

har7an commented 11 months ago

Hello,

I'm running btrbk on a Fedora CoreOS machine and noticed that snapshot cleanup doesn't work. Snapshots are made on schedule (as configured), but somehow btrbk doesn't recognize old snapshots and hence doesn't apply the retention policy.

Background information

Fedora CoreOS comes with XFS as default filesystem, but I converted it to Btrfs during provisioning. The default FS layout installs everything directly into the root subvolume and bind-mounts /var from /sysroot/ostree/deploy/fedora-coreos/var during boot.

I have created two subvolumes now:

My btrbk config looks like this:

timestamp_format       long
snapshot_preserve_min  96h
snapshot_preserve      96h 21d 16w

#volume /hostfs/
snapshot_dir /hostfs/ostree/deploy/fedora-coreos/var/subvol/@snapshots
subvolume /hostfs/ostree/deploy/fedora-coreos/var/home/hartan

I tried both using a volume section and using absolute paths, but the result remains the same. btrbk is run every 15 minutes from a systemd timer. Using verbose logging I can see that btrbk correctly detects there are >2000 subvolumes in the snapshot directory, but it doesn't recognize any of these as valid snapshots of the configured subvolume.

I tried poking around in the code but it's the first time I'm confronted with perl and I can't figure out what keys are in a HASH-type. Far as I can tell the call to vinfo_subvol_list either comes up empty, or it lists exactly 4 subvolumes:

  1. /var/home/hartan (my homedir)
  2. /var/subvol/@snapshots (the snapshot directory)
  3. /@beeshome (for data deduplication with bees)
  4. The latest snapshot (the one it just recorded)

I'll happily provide more output and logs, or try debugging the code if someone gives me instructions. Thank you in advance!

Additional information