Just wanted to make sure and ask if this is good enough.
set -e
echo "=== fstrim ==="
fstrim -av
echo "=== BTRFS scrub status before ==="
btrfs scrub status /
echo "=== BTRFS scrub start ==="
btrfs scrub start -B /
echo "=== BTRFS scrub status after ==="
btrfs scrub status /
echo "=== BTRFS balance (50%) ==="
btrfs balance start -dusage=50 /
echo "=== Done ==="```


Most probably, unnecessary :)
Doesn’t your distro have systemd units that run that stuff on a timer for you on?
Got scared in another posts comment section that btrfs needs “so much” maintenance and got suggested that I should use something like this. I use Fedora btw.
Hello, I have been using fedora with btrfs on various old computers for a few years and never had any problems without doing maintenance (aside from backups).
fstrimis most probably already handled.If you are adding a btrfs disk to an existing install you might want to check if there’s a systemd unit that runs
btrfs scrub: runsystemctl list-units '*btrfs*'and see what it prints.For
btrfs balance… I read that you generally don’t want to run it (it can be pretty IO intensive) unless you added/removed disks or are troubleshooting. My tumbleweed does have a service that boils down to runningbtrfs balanceweekly though (with values far below your 50; see sources available at https://github.com/kdave/btrfsmaintenance)If you load a distro that already has btrfs options, they will have maintenance scripts built in. You shouldn’t need to touch btrfs manually on those, other than setting if your snapshots are cleaned up by number, or by time