6

I read that Linux doesn't issue automatic TRIM commands (the discard mount option), due to performance problems. I've added fstrim -a in my crontab to TRIM once a week.

Does issuing fstrim too often reduce the lifespan of the drive ? Are TRIM commands equivalents to write operations ? Or can I run fstrim more often, as once a day ?

1
  • 1
    The whole point to TRIM is to extend the life of the drive, I dont see any reason to not run it every day. In windows 7 it uses the trim command every time you delete or move a file...en.wikipedia.org/wiki/Trim_(computing)#Operation
    – Moab
    Apr 10, 2016 at 18:08

3 Answers 3

7

No (most likely), the TRIM command simply tells the SSD that you're no longer using this file. What the SSD does with that information is up to the SSD, which is why I included the "most likely." The point of TRIM is to improve write performance. How does it improve write performance? By letting the SSD know you're no longer using particular files, the SSD don't have to waste time copying those files to a new location when it needs to free up space. In other words, you're improving write performance by eliminating unnecessary internal write operations. Doesn't this also extend the life of the drive? Yes it does, but most SSD have internal wear leveling features that is responsible for the bulk of "life extending" aspect. Use TRIM as much as you like. If the SSD is good, you will get both performance, and longer life.

1

No

TRIM is a hint to the drive that the specified blocks are no longer in use and are safe to erase. The drive is not required to erase those blocks immediately and in fact is allowed to ignore the hint altogether. Hence, sending lots of TRIM commands should not reduce the life of any SSD that has reasonably well-designed garbage-collection algorithms.

1

Probably not

There is a claim in fstrim(8) that

Running fstrim frequently, or even using mount -o discard, might negatively affect the lifetime of poor-quality SSD devices

The thing is, no good source corroborates it. Gentoo and LoginVSI are just making references to the single claim in the man page. Wikipedia claims that some drives do a copying GC cycle on TRIM, which would be a reasonable explanation, except that it also has no citation.

Is is possible? Yes, immature small manufacturers exist. Is it likely enough to concern you? Probably not, especially when your SSD controller is reasonably popular.

(Please post on the Internet if your SSD happens to be bad at TRIM. A possible test setup is SMART before and after readonly mount + fstrim. The problem is that you just don't get super fine-grained FTL write statistics on SMART except from Micron.)

2
  • I think Wikipedia suggests the CG cycle may impact performance, not lifespan per se. In general I think TRIM has positive effect on lifespan and so that answer in general (to OP), is no, rather the opposite. May 16, 2023 at 13:17
  • @JoepvanSteen I was thinking that a terrible controller may decide to consolidate across some pages during the TRIM-triggered GC cycle, like how idle-time GC usually works. Since consolidation writes new pages, I believe we can get some kind of write amplification out of it if it's done untimely. May 24, 2023 at 6:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .