SDB:Disable btrfsmaintenance

Jump to: navigation, search


Situation

Disabling the btrfsmaintenance cron jobs, and running the scripts manually, is desired.

Procedure

Disabling scheduled maintenance

In /etc/sysconfig/btrfsmaintenance set the following to "none"

## Type:           string(none,daily,weekly,monthly)
## Default:        "weekly"
## ServiceRestart: btrfsmaintenance-refresh
#
# Frequency of periodic balance.
BTRFS_BALANCE_PERIOD="none"
## Type:        string(none,weekly,monthly)
## Default:     "monthly"
## ServiceRestart: btrfsmaintenance-refresh
#
# Frequency of periodic scrub.
BTRFS_SCRUB_PERIOD="none"
## Type:           string(none,daily,weekly,monthly)
## Default:        "none"
## ServiceRestart: btrfsmaintenance-refresh
#
# Frequency of periodic trim. Off by default so it does not collide with
# fstrim.timer . If you do not use the timer, turn it on here. The recommended
# period is 'weekly'.
BTRFS_TRIM_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.

If no longer needed, this can be disabled by

 # systemctl stop btrfsmaintenance-refresh.service
 # systemctl disable btrfsmaintenance-refresh.service

It can be enabled by

 # systemctl enable btrfsmaintenance-refresh.service
 # systemctl start btrfsmaintenance-refresh.service

Performing manual maintenance

Balance, scrub and trim can be run manually (e.g. once a month) in the following order:

# sh /usr/share/btrfsmaintenance/btrfs-balance.sh
# sh /usr/share/btrfsmaintenance/btrfs-scrub.sh
# sh /usr/share/btrfsmaintenance/btrfs-trim.sh

To run them by name (e.g. btrfs-balance), you can create symbolic links:

# ln -s /usr/share/btrfsmaintenance/btrfs-balance.sh /root/bin/btrfs-balance
# ln -s /usr/share/btrfsmaintenance/btrfs-scrub.sh /root/bin/btrfs-scrub
# ln -s /usr/share/btrfsmaintenance/btrfs-trim.sh /root/bin/btrfs-trim

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

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

/usr/sbin/fstrim -Av

btrfs-trim won't trim the default xfs /home partition. Therefore, if you disable this timer, you might want to manually run the command above or

fstrim -v /home

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

http://man7.org/linux/man-pages/man8/fstrim.8.html

See also

Related articles

External links