3

Simple question, I have some servers that were running 10.04 that I upgraded to 12.04.

So they were installed using 10.04 (kernel 2.6.32* I believe) and the version of ext4 that shipped then.

By upgrading to 12.04 and the newer kernel, does that enable TRIM automatically? (Do I need to add 'discard' to the fstab?) Or do I need to do a clean install of 12.04 to get TRIM functionality on those drives.

Jorge Castro
  • 71,754

2 Answers2

3

No, it does not, the only way right now (At least up to 12.10) is to actually add the discard option to your /etc/fstab file like mentioned here: How to enable TRIM?

After rebooting it should be enabled. I tested the only SSD I have right not, an Intel 520 120GB and in 12.04 it does not activate automatically. This also includes the Beta 1 of 12.10. And with this in mind, I might just add that I am thinking that on 12.10 Final, it will be the same, so a manual approach is the only way right now.

The good thing is, after upgrading a kernel in any version of Ubuntu, the discard option stays there. So at least I don't have to turn it on every time I update a kernel.

The real question would be: Why trim is not enabled by default?

And I guess it would actually depend on several factors including:

  • What file system to use? (Not all file systems support TRIM)
  • What SSD to use? (Some are not good with TRIM. Some don't need TRIM)
  • Will RAID be used? (There are several RAID issues when using TRIM)
  • What performance impact will have? (Negative, Positive. This varies depending on SSD and file system in use)

So I guess with all of this doubts, the option for one to test it out ourselves is left with the manual approach and to see if there is an actual benefit. I can say that the benefit in an Intel 520 with and without Trim is very little, at least in my case.

Luis Alvarado
  • 211,503
2

No, upgrading a kernel does not turn it on automatically - it's still off by default for the kernel shipped with 12.04.

Please refer to the manpage of mount:

discard/nodiscard
  Controls whether ext4 should issue discard/TRIM commands to  the
  underlying  block  device when blocks are freed.  This is useful
  for SSD devices and sparse/thinly-provisioned LUNs,  but  it  is |
  off by default until sufficient testing has been done.           | <--
gertvdijk
  • 67,947