Jul 132014

If you have an SSD drive on your system, you may have added the discard option in /etc/fstab which will discard blocks not in use by the file system. Another way to achieve this is to use the fstrim command. Red Hat recommends use of fstrim over the discard option [1]. There is a nice article about TRIM [2] that explains why:

In order to optimize the performance of the SSD, I strongly advise you to avoid doing the TRIM operation in real time (whenever a file is deleted) because you would be putting an unnecessary extra amount of work over the SSD. In other words: You should not enable the discard option in fstab.
Instead, what I recommend is to run a script periodically to tell the SSD which blocks are free with the command fstrim. Doing this operation daily or weekly is more than enough. This way we do not lose any performance due to TRIM when deleting files and we periodically keep informed the SSD about the free blocks.

The article also describes some other advantages of fstrim.

Unless you really need online discard operations for performance, just discard that ‘discard’ option. đŸ™‚

Note added: there is an article about SSD optimization worth reading [3].

[1] https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/ch02s04.html
[2] http://blog.neutrino.es/2013/howto-properly-activate-trim-for-your-ssd-on-linux-fstrim-lvm-and-dmcrypt/
[3] https://wiki.debian.org/SSDOptimization/