Ubuntu 14.04 LTS supports TRIM on SSD drives

msataWe have been writing about “5 crucial optimizations for SSD usage in Ubuntu Linux” in the past. Today everybody is using SSD’s and the usage of the Linux “fstrim” command and the fstab “discard” options are well-known. Still it is interesting when the real guru’s talk about this technology. Martin Pitt and Colin King are such real gurus, they work with Canonical on very cool and very techy Linux things 😉 So when they speak about SSD support in Ubuntu, we are certainly listening!

TRIM support in Ubuntu 14.04 LTS

In the past 4 days there has been an interesting discussion on the SSD support in Ubuntu. It started with Martin Pitt who anounced that Ubuntu 14.04 LTS will have out of the box support for TRIM commands on SSD drives. Read the interesting parts of the discussion here:

Martin Pitt: “Finally, SSDs are now being trimmed automatically out of the box. Embarrassingly late, but at least in time for 14.04 LTS.”

Robert Bruce Park: “So, should I take ‘discard’ out of my fstab then?”

Martin Pitt: “You can keep it if you prefer (the cron job will ignore mounts with “discard”), but on a desktop it seems generally preferrable to run from cron.”

David James:  “How much of a performance/battery life penalty is there running discard?”

Colin King: “It’s hard to say as it depends on the SSD and firmware, but we did see mass file deletions (such as removing entire kernel source trees) taking significantly longer with discard on some devices that don’t support queued TRIM.   Also, some actions like heavy random file extend/shrink with ftruncate() were 3.5-4 x slower with discard on ext4.   Generally speaking though, discard overhead was minimal, but it does seem more efficient to batch up discards with periodic use of fstrim .”

Derek Dickerson: “I thought TRIM support with modern controllers causes ext IO\premature ware and tear and that garbage collection was something done on chip for modern SSD’s? Can someone tell me why everyone thinks the kernel should be worrying about this what the drives do by themselves? ”

Martin Pitt: “@Derek Dickerson , the drive has no idea about which blocks the OS considers as unused. Disk drives don’t “think” in terms of file systems, just in terms of reading and writing blocks.”

Matthew Eaton: “My only concern with this is fstrim will cause a good 1-2 minutes of heavy I/O activity causing the system to slow down while the user has no idea what is going on or why.”

Source: Martin Pitts Google+ page

About “swappiness” and “noatime”

It is good that TRIM will be enabled by default in the future. But this does not mean that Ubuntu will configure your SSD as it should. It is only one of the “5 crucial optimizations for SSD usage in Ubuntu Linux“. Other things – like “swappiness” and “noatime” – are also important to get the best performance and the longest endurance out of your solid state disk.


8 thoughts on “Ubuntu 14.04 LTS supports TRIM on SSD drives”

  1. Well, and let’s not forget one SSD lifetime optimization that has to be done manually: don’t hibernate. It will take out 4GB or similar off your SSD’s lifetime every time. For similar reasons, don’t use suspend to both RAM and disk.

  2. @James: Hibernating and swapping will do many writes to the disk and this is probably what David is pointing out. The OS does not matter, unless you know something we don’t 😉

  3. Are you implying an OS that does not allow you to customize such settings (or even able to make use of them) is superior? Or simply that most people are better off not having choices they probably wont understand?

Leave a Reply

Your email address will not be published. Required fields are marked *