6

Btrfs scrub takes the mountpoint as its target. We can identify the possible btrfs targets by:

while read d m t x
do
  [[ $t != "btrfs" ]] && continue
  echo "To be scrubbed: $m"
done < /proc/mounts

However, we can mount a btrfs subvolume like a regular device. As we can have many subvolumes on the same device, scrubbing all mount points with btrfs file system type may lead to many duplicate examinations.

If btrfs scrub examines the underlying device when the mountpoint is given, we could filter the /proc/mounts output unique by device path:

<(cat /proc/mounts | sort -u -k1,1)

Is scrub intended to run per device or per subvolume?

1 Answer 1

1

As noted by the docs, the scrub command operates on a whole filesystem. This refers to the entire filesystem that was created with mkfs. Although subvolumes can be mounted on their own, they are still part of the main filesystem, some options and operations such as scrub are only valid for the whole filesystem, not just a specific subvolume:

Subvolumes belong to a single filesystem and as implemented now all share the same specific mount options

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .