Like smartd, Debian installs btrfsmaintenance in a disabled state.

One day, when consensus on the most useful and safe default
configuration has been reached, maintenance operations will be
automatically enabled.  It also seems wise to wait until
btrfsmaintenance supports something like upower, so that these IO and
CPU intensive jobs can be paused if a system switches to battery, or
deferred until AC power is available.  At present btrfsmaintenance is
not power-state aware on either laptops or servers with
uninterruptible power supplies.

Configuration is found at /etc/default/btrfsmaintenance

This configuration can be reloaded and its maintenance operations
rescheduled by running btrfsmaintenance-refresh.service every time a
systemd-enabled system is booted in multi-user mode.  To manually
reload configuration after editing it run:

  systemctl restart btrfsmaintenance-refresh.service

To refresh maintenance schedule automatically whenever the system is
booted (see below for one caveat) run:

  systemctl enable btrfsmaintenance-refresh.service

Enabling that service may also enable btrfsmaintenance-refresh.watch,
particularly when enabled by a normal user who then authenticates for
org.freedesktop.systemd1.manage-unit-files (root).  Refresh.path
watches /etc/default/btrfsmaintenance and applies scheduling changes
whenever this file is modified.  To disable this automatic behaviour
run:

  systemctl disable btrfsmaintenance-refresh.watch

Finally, enable systemd timers:

  systemctl enable btrfs-balance.timer  # [1]
  systemctl enable btrfs-defrag.timer   # [2]
  systemctl enable btrfs-scrub.timer    # [3]
  systemctl enable btrfs-trim.timer     # [4]

[1] This rewrites all data that is not excluded by a filter.  Periodic
    balancing is not useful, nor recommended, for the vast majority of
    workloads.  If a corner case is found where balancing is useful,
    this case (with steps to reproduce) should be reported upstream.
[2] See wiki.debian.org/Btrfs for issues with defrag eg: out of space errors,
    complications when using snapshots, fewer more fine-grained paths are
    better, etc.  This is also workload-dependent.  Directories with logs,
    databases, and VM images benefit the most.
[3] Recommended; however, battery life will be reduced during a scrub.
[4] Prefer fstrim.timer to this option and leave btrfs-trim.timer disabled,
    in case fstrim.timer is someday enabled by default for non-rotational
    disks.

For the time being, users who forgo systemd can enable roughly
equivalent behaviour by running the following script directly:

  /usr/share/btrfsmaintenance/btrfsmaintenance-refresh-cron.sh

To enable this on every boot, add it to /etc/rc.local.  To refresh
configuration every hour, run:

  cd /etc/cron.hourly
  ln -s ../../usr/share/btrfsmaintenance/btrfsmaintenance-refresh-cron.sh ./

Btrfsmaintenance must not be configured to use both the systemd and
cron methods (see upstream README).  One day, when systemd units for
btrfsmaintenance are automatically activated, those who choose not to
use systemd will still need to manually activate the refresh-cron
script, because upstream maintains that providing automatic scheduling
with cron conflicts with automatically enabled scheduling with
systemd.

 -- Nicholas D Steeves <sten@debian.org>, Thu,  2 Mar 2023 19:46:36 -0500
