I bought a laptop with only SSD drives a while ago and based on a limited amount of reading, added the "discard" option to my /etc/fstab file for all partitions and happily went on my way expecting to avoid the performance degradation problems that happen on SSD cards without this setting).

Yesterday, after a several month ordeal, I finally installed SSD drives in one of May First/People Link's servers and started doing more research to find the best way to set things up.

I was quite surprised to learn that my change in /etc/fstab accomplished nothing. Well, not entirely true, my /boot partition was still getting empty sectors reported to the SSD card.

Since my filesystem is on top of LVM and LVM is on top of an encrypted disk, those messages from the files system to the disk were not getting through. I learned that when I tried to run the fstrim command on one of the partitions and received the message that the disk didn't support it. Since my /boot partition is not in LVM or encrypted, it worked on /boot.

I then made the necessary changes to /etc/lvm/lvm.conf and /etc/crypttab, restarted and... same result. Then I ran update-initramfs -u and rebooted and now fstrim works. I decided to remove the discard option from /etc/fstab and will set a cron job to run fstrim periodically.

Also, I learned of some security implications of using trim on an encrypted disk which don't seem to outweigh the benefits.

I walk through this page:

https://sites.google.com/site/easylinuxtipsproject/ssd

every time I configure a new SSD system. I was an early adopter of the Samsung XP941 which at the time was the only way to get an M.2 PCI Express drive. Consequently it was very expensive, and lacking support from Samsung for consumers, so I wanted to make sure I was doing everything as correctly as I could, which led me to this page. That's how I know that discard in fstab was decidedly out of favor as early as Feb of 2015 when I got the drive.

As a side note, I've been conditioned to not install updated firmware on my Asus UEFI motherboard with secure-boot unless I'm emotionally prepared to reinstall my OS from scratch. Clonezilla partition backups wouldn't boot. (thank God for /home partition) Hence, I've had to return to this wonderfully informative page more times than I would like. ;-)

Comment by Anonymous Thu Sep 8 22:51:53 2016