kdave / btrfsmaintenance

Scripts for btrfs maintenance tasks like periodic scrub, balance, trim or defrag on selected mountpoints or directories.
GNU General Public License v2.0
897 stars 79 forks source link

is_btrfs() returns incorrect value for btrfs filesystems directly on LUKS volumes #109

Open sten0 opened 2 years ago

sten0 commented 2 years ago

Affects master branch an[d] current stable release 0.5.

  1. On a system where a btrfs filesystem exists directly on a LUKS volume.
  2. Where this fs is mounted using /dev/mapper/foo in /etc/fstab.
  3. btrfsmaintenance-functions:L21 returns '/dev/mapper/foo' rather than a mount point.
  4. Which means 'stat -f --format=%T' in is_btrfs() returns tmpfs.
  5. This means 'BTRFS_SCRUB_MOUNTPOINTS="auto"' in the config file skips all filesystems that match conditions one and two.
  6. The user expectation for "auto" to work properly is not met.
  7. Unfortunately, the is_btrfs check at btrfs-scrub.sh:39 means 'BTRFS_SCRUB_MOUNTPOINTS="/mount/point/for/LUKS_btrfs_fs"' will also fail, and thus cannot be used as a workaround. Additionally the expectation that an explicitly specified mount point will be scrubbed is not met.

Please fix this :)