This wiki was updated to MediaWiki 1.37. If you notice any issues, please report them to admin[at]

SDB:Fix btrfsmaintenance-refresh

Jump to: navigation, search


  1. During boot systemd gets reloaded due to btrfsmaintenance-refresh.service erroneously creating new timers.
  2. Partitions already mounted are unmounted again for no apparent reason.

Modification to btrfsmaintenance-refresh.service

The vendor version erroneously contains an install section. Disable and create a revised system version:

erlangen:~ # systemctl disable btrfsmaintenance-refresh.service
erlangen:~ # systemctl edit --full btrfsmaintenance-refresh.service

Delete the Install section and save the edit session.

Check your modifications

erlangen:~ # systemctl cat btrfsmaintenance-refresh.service
# /etc/systemd/system/btrfsmaintenance-refresh.service
Description=Update cron periods from /etc/sysconfig/btrfsmaintenance

ExecStart=/usr/share/btrfsmaintenance/ systemd-timer
erlangen:~ # 

Check unit files for correct state

Note: btrfsmaintenance-refresh.service is loaded, but inactive while btrfsmaintenance-refresh.path is both loaded and active:

erlangen:~ # systemctl list-units --all btrfsmaintenance-refresh.*
UNIT                             LOAD   ACTIVE   SUB     DESCRIPTION                                             
btrfsmaintenance-refresh.path    loaded active   waiting Watch /etc/default/btrfsmaintenance                     
btrfsmaintenance-refresh.service loaded inactive dead    Update cron periods from /etc/sysconfig/btrfsmaintenance

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

2 loaded units listed.
To show all installed unit files use 'systemctl list-unit-files'.
erlangen:~ # 

Enable btrfsmaintenance-refresh.path. Check states:

erlangen:~ # systemctl enable btrfsmaintenance-refresh.path
erlangen:~ # systemctl list-unit-files btrfsmaintenance-refresh.*
UNIT FILE                        STATE   VENDOR PRESET
btrfsmaintenance-refresh.path    enabled disabled     
btrfsmaintenance-refresh.service static  enabled      

2 unit files listed.
erlangen:~ # 

Verify correct operation during boot

Reboot the machine and view the journal:

erlangen:~ # journalctl -b -u btrfs* -o short-monotonic 
-- Logs begin at Sun 2020-03-29 16:41:11 CEST, end at Tue 2020-04-14 21:16:15 CEST. --
[    4.207500] erlangen systemd[1]: Started Watch /etc/sysconfig/btrfsmaintenance.
[   17.512069] erlangen systemd[1]: Started Balance block groups on a btrfs filesystem.
[   17.512182] erlangen systemd[1]: Started Defragment file data and/or directory metadata.
[   17.512293] erlangen systemd[1]: Started Scrub btrfs filesystem, verify block checksums.
erlangen:~ # 

Note: btrfsmaintenance-refresh.service is not running during boot!