Updated : Dec 17, 2016 in Linux

Enable TRIM for SSD in Linux

Introduction:
Although some new SSDs are capable of TRIMming themselves for the ones that can’t you can enable the ‘discard’ option in the kernel for the SSDs in the system. This will do two things:
– Enable a regular TRIMming of the SSD for each mountpoint you enabled in the /etc/fstab
– Allow to run manually the ‘fstrim’ command to force an immediate TRIM of the mounted partition.

Steps:
Edit /etc/fstab and ad the option ‘discard’ for each mountpoint in which the partition involved is located on an SSD drive: eg.
UUID=60662e55-26b9-45ab-9ca1-8ab6cc0404cb / ext3 errors=remount-ro,discard 0 1
To run/force the TRIM manually: For example for the root partition:
fstrim -v /
For forcing TRIM in all the ‘Trimmable’ partitions:
fstrim -v -a
NOTE: If you installed a SAMSUNG SSD make sure you read this article(especially at the end) before you enable the ‘discard’ in the /etc/fstab.
https://blog.algolia.com/when-solid-state-drives-are-not-that-solid/

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: