Btrfs includes native optimizations for SSD media. To enable
these features, mount the Btrfs filesystem with the -o SSD mount option. These
optimizations include enhanced SSD write performance by avoiding optimization
such as seek optimizations which do not apply to solid-state media.
Asynchronous discard support is available with mount option discard=async, and
is enabled by default as of linux 6.2.
Here list of “safe” commands for btrfs:
Periods for maintenance:
balance - weekly, example: btrfs balance -dusage=50 -dlimit=2
scrub - monthly, with full system backup
check discard=async is enabled by default as of linux 6.2. TODO: check actual
mount options.
btrfs check is not safe, it’s experimental and can corrupt data (2021).
Resize filesystem (root volume) to maximum size
What to do on a failed disk (btrfs) / TODO: NEED review and test…
We then shut down the system, plugged the replacement disk in (actually
the disk we had earlier ruined by double degraded booting, after wiping
the BTRFS partition), booted and then did the usual dance to turn the
now-single BTRFS into a RAID1 again.
Restore gpt partiton from backup to new drive first (partitiontable),
and recommended restore EFI partition too. Instructions above.
As a result, we had a RAID1 again. If you wonder why we did not use
Btrfs replace: We would have to connect the new disk before the second
reboot, which is not always practical. With the method above, once we
have rebalanced the file system to a single one, we can reboot as often
as we like to get the new drive online.