The situation with TRIM in Ubuntu has me utterly confused. I don't know whether I need to manually run it or not. Sources I've found are disparate and unclear.
I have Ubuntu 10.04 with latest updates (including kernel 2.6.32-26). I have an Intel X-25M drive with latest firmware, and it is formatted as ext4.
So, does TRIM support run automatically? If not, how do I check if I need to run it, and then how do I run it if necessary?
According to this bug report TRIM is not supported with the Ubuntu kernel in Ubuntu Lucid (10.04).
All newer versions of Ubuntu come with a kernel which supports TRIM but you will have to manually activate it if you are using the ext4 file system (default).
The Linux kernel supports TRIM as of version 2.6.33.
So the answer is: Yes, Linux, in it's latest version, supports TRIM out of the box. Ubuntu 10.04 doesn't though.
The question is whether the feature will be back ported to 2.6.32 or 10.04 will get an update to 2.6.33+. (see João Pinto's answer)
Of course your SSD has to support it as well. There are also still some issues with some specific SSDs (I think the Indilinx ones may still be a bit wonky for example). The SSDs firmware has to implement everything properly - but, I understand, some SSDs implement TRIM in a way that isn't really conform with the ATA standard. Or at least in a buggy way.
The first generation X-25M from Intel doesn't support trim "Properly" (or not at all - strictly speaking). The second generation Intel X-25M G2 does. I don't know whether the latest firmware adds proper TRIM, the Intel website keeps mentioning it's "Optimised for Windows 7", which could mean it's bolted on as a software feature in the windows driver, and that the disk doesn't do it on it's own because Intel left their homework on the bus again :-)
TRIM support was introduced in Linux 2.6.33 (Ubuntu 10.10), however it is unlikely that Ubuntu 10.04 will ever receive TRIM support. Once acquired, TRIM support must be activated through FSTab.
I see the following pieces in the description of 2.6.32-39 update:
sata_mv: fix broken DSM/TRIM support (v2)
ext4: make trim/discard optional (and off by default)
I assume this means that it is now supported.
It looks like this went in Ubuntu-2.6.32-9.13 as commit 9f3979ef, back in Dec of 2009, so has been available in lucid since it was released.
You do of course, need to mount with the
discard
option to enable it.