The wikis are now using the new authentication system.
If you did not migrate your account yet, visit https://idp-portal-info.suse.com/

SDB:Disable btrfsmaintenance

Jump to: navigation, search


Situation

Disabling automatic drive maintenance, in favor of manual maintenance, is desired.

Procedure

Disabling scheduled maintenance

In /etc/sysconfig/btrfsmaintenance you can disable balance and scrub by setting the following to "none"

BTRFS_BALANCE_PERIOD="none"
BTRFS_SCRUB_PERIOD="none"

With Leap 15+ and Tumbleweed, there is a systemd unit btrfsmaintenance-refresh.service which gets called (via systemd path unit btrfsmaintenance-refresh.path) when /etc/sysconfig/btrfsmaintenance is changed. This unit automatically refreshes the systemd timers/cron jobs.

fstrim.timer

As noted in /etc/sysconfig/btrfsmaintenance, there is also fstrim.timer, which is not part of btrfsmaintenance. To disable it:

# systemctl disable fstrim.timer
# systemctl stop fstrim.timer

Uninstalling btrfsmaintenance

If you don't want to use the btrfsmaintenance scripts located at /usr/share/btrfsmaintenance you can simply uninstall:

zypper rm btrfsmaintenance

To prevent it from being reinstalled:

zypper al btrfsmaintenance

Performing manual maintenance

Balance

"If there is a lot of allocated but unused data or metadata chunks, a balance may reclaim some of that allocated space. This is the main reason for running a balance on a single-device filesystem."

Using the default openSUSE partitioning, and default btrfsmaintenance settings, btrfs-balance.sh is equivalent to:

btrfs filesystem df /
btrfs balance start -dusage=0 /
btrfs balance start -v -dusage=5 /
btrfs balance start -v -dusage=10 /
btrfs balance start -musage=0 /
btrfs balance start -v -musage=3 /
btrfs filesystem df /

You could add that to a file named "balance" in the /root/bin directory, and to make it executable you would run:

chmod +x /root/bin/balance

Scrub

"btrfs scrub is used to scrub a btrfs filesystem, which will read all data and metadata blocks from all devices and verify checksums. It will automatically repair corrupted blocks if there’s a correct copy available."

Without RAID mirroring your data, thereby supplying that "correct copy", the scrub command does nothing other than tell you there is a problem.

With the default settings, btrfs-scrub.sh is equivalent to:

btrfs scrub start -Bd /

Trim

/usr/lib/systemd/system/fstrim.service calls

fstrim -Av

This will "trim all mounted filesystems mentioned in /etc/fstab on devices that support the discard operation".

"For most desktop and server systems a sufficient trimming frequency is once a week."

See also

Related articles

External links