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 ==="```
you are viewing a single comment's thread
view the rest of the comments
[–] 1 point 1 hour ago

Btr is one of those things you kinda don’t need to be using unless you know exactly why you’re doing it for this reason. Because best practices and received wisdom are actively shifting (although the internet search change between COVID and now has given It the short end of the stick) it may be better to do something different instead.

Also as another user pointed out it’s likely not necessary to do anything to limit your ssd writes. Nand write failure manifests itself in the form of lack of recall when unpowered. More writes means a shorter time unpowered will surface a lack of recall. If the system is a server or other type of always on computer then the write failure will likely never happen, since the drive isn’t unpowered enough to matter.

Do be aware of read fatigue though, blocks which are read many times will return stranger values that the ssd’s controller recognizes with crc and retries. This manifests as slowness to the user. If something seems laggy or slow it’s a good idea to run a program called spinrite on its “lvl 3” mode, which reads every block on the drive and rewrites it. You can do similar things with programs like dd or crystal but I tend to point people at spinrite because it’s hard to fuck up and very consistent.

  • source
  • parent