Btrfs-scrub.timer not in Scheduled Tasks?

Hello,

I have created this topic because I’m not sure whether it is my misunderstanding, a bug, oversight, or a separate thing altogether.

I’ve installed Rockstor 4.1.0-0 generic, then rebooted. (Sorry, couldn’t wait any longer for the impending Leap 15.4 Rockstor release :slight_smile:)

I’ve created a raid1 pool and a share.
Then I’ve seen the Scheduled Task page empty, which prompted me to check for active system jobs.
I’ve noticed that the btrfs-scrub.timer job seems to have been already activated and triggered on a bi-monthly basis.

So what is the difference between defining a scrub job via Web-UI, or leaving the existing job running as-is?
If the underlying scrubbing job is the same, why isn’t it displayed on the Web-UI?

Hi @aremiaskfa,

I would say the latter.
The btrfs-scrub.timer comes with our underlying OS (openSUSE Leap) and is part of their default Btrfs optimizations. You may have already seen it but for others or just for the record:
This timer defines the following:

$ systemctl cat btrfs-scrub.timer 
# /usr/lib/systemd/system/btrfs-scrub.timer
[Unit]
Description=Scrub btrfs filesystem, verify block checksums
Documentation=man:btrfs-scrub

[Timer]
OnCalendar=monthly
AccuracySec=1h
Persistent=true

[Install]
WantedBy=timers.target

itself used by the corresponding service:

$ systemctl cat btrfs-scrub.service 
# /usr/lib/systemd/system/btrfs-scrub.service
[Unit]
Description=Scrub btrfs filesystem, verify block checksums
Documentation=man:fstrim
After=fstrim.service btrfs-trim.service

[Service]
Type=simple
ExecStart=/usr/share/btrfsmaintenance/btrfs-scrub.sh
IOSchedulingClass=idle
CPUSchedulingPolicy=idle

It thus runs the /usr/share/btrfsmaintenance/btrfs-scrub.sh script on a monthly basis.
In this script, the actually Btrfs mount points on which the scrub will be conducted are defined as part of the /etc/sysconfig/btrfsmaintenance config (also provided by the OS itself):

## Path:        System/File systems/btrfs
## Type:        string
## Default:     "/"
#
# Which mountpoints/filesystems to scrub periodically.
# (Colon separated paths)
# The special word/mountpoint "auto" will evaluate all mounted btrfs
# filesystems
BTRFS_SCRUB_MOUNTPOINTS="/"

As you can see, my best understanding is that it thus runs the following command once a month:

btrfs scrub start -Bd /

The following is part of @phillxnet’s expertise, so he’ll correct me if needed, but I thus believe it would thus only scrub the system disk (Pool labeled ROOT in the webUI).

If my statement above is correct, using the webUI is thus the easy way to schedule a scrub at your desired frequency, on any of the Pools you have created in Rockstor.

That is a very good question/point. We might actually want to resurface those in our webUI. Again, this is part of @phillxnet’s expertise, but I do know that it can be difficult to resurface to our webUI some of the OS-defined btrfs tasks like that. I know, for instance, that it required a lot work to have Rockstor be aware and thus resurface Btrfs balance triggered “internally” by the Btrfs filesystem following some pool operations.
I do think think it would be beneficial if we could resurface this OS-defined scrub task, though, so it may be worth looking into what it would entail and see how it would be integrated.

3 Likes

Ah yes, that brings more light into the situation and also my understanding as well :blush:

IIRC, @phillxnet wants to hide everything related to the system disk.
So in keeping with the project’s vision, consider automatically creating the scrub scheduled task for data disks, if applicable.