Does btrfs-scrub.service scrub ALL btrfs volumes, or just /?

As per title.

My home server runs on a btrfs root partition, but also has two drives attached that act as DIY NAS. Those are also partitioned as btrfs, but I’m not sure the scheduled btrfs-scrub service is scrubbing those as well (which would be quite important TBH).

Checking the journalctl logs for the past months, I’m afraid that my fears are true:

home-server:/home/home-server # journalctl --since "2024-05-28 00:00:00" | grep "Running scrub"
Jun 01 00:00:19 home-server btrfs-scrub.sh[18950]: Running scrub on /
Jul 01 00:00:33 home-server btrfs-scrub.sh[23917]: Running scrub on /
Aug 01 00:00:37 home-server btrfs-scrub.sh[32476]: Running scrub on /
Sep 01 12:57:45 home-server btrfs-scrub.sh[1213]: Running scrub on /
Oct 01 00:00:00 home-server btrfs-scrub.sh[3847893]: Running scrub on /
Oct 28 17:31:36 home-server btrfs-scrub.sh[2077308]: Running scrub on /

If so, what’s the easiest way to extend scrubbing to all btrfs-formatted partitions?

Thanks

EDIT: as a temporary workaround I will just launch btrfs scrub start <my_device> on both drives

This is getting interesting and kinda scary:

home-server:/home/home-server # btrfs scrub status /media/nas1
ERROR: getting dev info for scrub failed: Input/output error
home-server:/home/home-server # btrfs scrub status /media/nas2
UUID:             853bfcfd-eac2-4b48-b01b-1469ac8a28ac
Scrub started:    Sun Sep  8 15:47:24 2024
Status:           finished
Duration:         0:35:38
Total to scrub:   726.72GiB
Rate:             328.28MiB/s
Error summary:    no errors found

/media/nas1 doesn’t look very healthy :smiley:

And on /media/nas2 I must’ve run it manually a while ago, given the weird timestamp (all the grep matches in the journal happen on the first of the month - the one on Oct 28 was launched by me on /)

Ok I guess that the service only scrubs /.

My laptop also has more than one btrfs partition (I like keeping my /home on its own), and:

andromeda:/home/andrea # systemctl start btrfs-scrub.service

causes the following:

andromeda:/home/andrea # btrfs scrub status /home
UUID:             dbefadad-4645-4427-a53f-9a2e9e068aca
        no stats available
Total to scrub:   60.88GiB
Rate:             0.00B/s
Error summary:    no errors found

While:

andromeda:/home/andrea # btrfs scrub status /
UUID:             430cabcc-8344-45b7-8d7c-cc9cc2a5d7d4
Scrub started:    Mon Oct 28 17:52:18 2024
Status:           running
Duration:         0:00:05
Time left:        0:00:02
ETA:              Mon Oct 28 17:52:25 2024
Total to scrub:   31.09GiB
Bytes scrubbed:   20.51GiB  (65.96%)
Rate:             4.10GiB/s
Error summary:    no errors found

And later:

andromeda:/home/andrea # btrfs scrub status /
UUID:             430cabcc-8344-45b7-8d7c-cc9cc2a5d7d4
Scrub started:    Mon Oct 28 17:52:18 2024
Status:           finished
Duration:         0:00:07
Total to scrub:   31.09GiB
Rate:             4.44GiB/s
Error summary:    no errors found

So, / yes, anything else, no

Still trying to figure out how only / is included here:

It scrubs everything on my machine.

Change BTRFS_SCRUB_MOUNTPOINTS="auto" and others like balance to auto in /etc/sysconfig/btrfsmaintenance.

Ok cool, thanks, will do.

May I ask if you changed that value yourself?

I did a clean install on my laptop last week and it shows:

# Which mountpoints/filesystems to scrub periodically.
# (Colon separated paths)
# The special word/mountpoint "auto" will evaluate all mounted btrfs
# filesystems
BTRFS_SCRUB_MOUNTPOINTS="/"

And also on my home server I haven’t touched that file since install.

I wonder if the distro maintainers have considered using auto as the default value.

btrfs is one of the few FS that takes data integrity seriously (AFAIK), and it’s kind of a pity that it only scrubs / by default.

Although I guess that on a standard install where /home and / are on the same partition, just different subvolumes, the /home contents would be scrubbed as well…

But still, I see a btrfs-scrub maintenance service, I expect it to scrub…btrfs devices, all of them, you know?

WDYT (@maintainers)?

Thanks

They are not reading here…

1 Like

For those looking for a script solution:

sudo sed -i 's|BTRFS_SCRUB_MOUNTPOINTS="/"|BTRFS_SCRUB_MOUNTPOINTS="auto"|g' /etc/sysconfig/btrfsmaintenance

1 Like

Yep, I have it in my setup notes.
My local backups are on another btrfs drive, so not scrubbing = :boom: when in time of need.
I also changed the frequency to weekly.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.