Any tips for btrfs on an SSD

I just formatted I fairly cheap SSD with btrfs, was wondering if I should do anything to increase the longevity of it. My mount options in /etc/fstab are noatime,discard,compress=zstd. Is there anything else I should do? Also should I remove the discard flag?

Not an expert here - but I don’t think I would want the discard flag on. I am not sure I would even run it ‘directly’ without more research! WIthout being a BTRFS expert, I would suspect that there is a lot of drive access involved that I am not sure I would wish to be on an SSD (though they are much better than they were).

I have discard=async among the mount options in fstab.

https://wiki.archlinux.org/title/Btrfs#SSD_TRIM

:thinking:

I’ve read it’s better to trim manually every week or so (I think).

In which case you should remove

:wink:

You should also consider adding the ssd option as that is intended for SSDs.

according to dmesg btrfs already detected an ssd. Wouldn’t that make that redundant?

Maybe?

Check the current mount options to see if it has been applied automatically, e.g. mount | grep btrfs .

1 Like

These are the btrfs mount options I use:
defaults,noatime,space_cache,autodefrag,compress=lzo
I run fstrim once per week, via the fstrim.timer systemd unit. I also installed btrfsmaintenance and enabled these units (run once a month):
btrfs-balance.timer, btrfs-defrag.timer, btrfs-scrub.timer.

This setup worked great on Linux Mint for well over a year.

Just in case you’re not aware, zstd is an option here and offers better performance in most cases.

Very little thing, if you set no options then defaults is needed for the fstab to be valid, but otherwise this isn’t needed.

e.g.

UUID=blah / btrfs defaults 0 0
UUID=blah / btrfs noatime 0 0

will both work. The first is the filesystem defaults, the second is the defaults except for noatime.

https://btrfs.wiki.kernel.org/index.php/Compression

1 Like

Thanks for pointing that out, I was worrying about that as well.