TRIM support on encrypted SSD

Recently it came to knowledge that LUKS encrypted SSDs don’t support trimming out of the box. TRIM, as far as I’m aware, is an operation that tells the disk wich blocks are free to use and that helps with mantaining good write speeds. I had to do a bit of searching, so I guess it would be nice to have this here since Cachy offers disk encryption in the install process.

The process is simple: first you’ll need to run lsblk and find the disk assigned crypt in the TYPE column. Now, copy the name of this disk and run cryptsetup refresh --persistent --allow-discards <disk name>.

This is it. You might want to run fstrim -a, but the fstrim.timer service should take care of that.

2 Likes

Cool post, I learned stuff at the right moment over here. Worked great. Thanks