[CentOS] To discard... or not to discard...

Wed Dec 4 18:20:04 UTC 2013
Akemi Yagi <amyagi at gmail.com>

On Wed, Dec 4, 2013 at 9:20 AM, Leon Fauster <leonfauster at googlemail.com> wrote:
> Am 04.12.2013 um 17:08 schrieb John Doe <jdmls at yahoo.com>:
>> I just recently read a post about SSD triming (discard vs fstrim):
>>  http://www.howtogeek.com/176978/ubuntu-doesnt-trim-ssds-by-default-why-not-and-how-to-enable-it-yourself/So far I used discard on all my SSDs.
>> Now I am wondering if it is really worth it to switch them all to a crontabed fstrim...
>> Anyone made the switch yet?
> https://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html-single/Storage_Administration_Guide/#idm34358800
> "Red Hat recommends batch discard operations ..." (fstrim)
> --
> LF

In addition to the RH doc referenced by LF, I found this web page useful:


"This is the most interesting part. Most people simply add the option
“discard” in the mounting options at /etc/fstab. However, this means
that every time you delete a file, the OS will be reporting in
real-time to the SSD which blocks were occupied by that file and are
not longer in use, and then the SSD will have to perform a
defragmentation and deletion of those internal blocks, operation which
will take an amount of time higher than desired.

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."