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 ==="```
  • talkingpumpkin
    link
    fedilink
    arrow-up
    11
    ·
    17 hours ago

    how is my maintenance script?

    Most probably, unnecessary :)

    Doesn’t your distro have systemd units that run that stuff on a timer for you on?

    • Ewoks Are Based@lemmy.mlOP
      link
      fedilink
      arrow-up
      1
      ·
      17 hours ago

      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.

      • warcat@lemmy.ml
        link
        fedilink
        arrow-up
        6
        ·
        16 hours ago

        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).

      • talkingpumpkin
        link
        fedilink
        arrow-up
        3
        ·
        16 hours ago

        fstrim is 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: run systemctl 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 running btrfs balance weekly though (with values far below your 50; see sources available at https://github.com/kdave/btrfsmaintenance)

      • BCsven@lemmy.ca
        link
        fedilink
        arrow-up
        2
        ·
        16 hours ago

        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