# SSD TRIM (discard) problems with ext4 on Crucial C300 SSDs with CentOS 5.5

Playing around with using a modern kernel (2.6.37 currently) on an older OS (CentOS 5.5) so we can get TRIM (discard) working on our SSDs (Crucial C300s).

The most recent hdparm (9.37) concurs that the C300 supports TRIM:

./hdparm -I /dev/sdc | grep TRIM
*    Data Set Management TRIM supported (limit unknown)
*    Deterministic read data after TRIM


But the kernel doesn't seem to agree when I attempt to mount /dev/sdc with the discard option:

EXT4-fs warning (device sdc): ext4_issue_discard:2619: discard not supported, disabling


We're experimenting with other Linux flavors as I type this, but it'd be nice to know what's going on, regardless.

Is this a manifestation of some other ancient component of CentOS 5.5 that's misinforming the kernel? Or maybe is hdparm using a different mechanism than the kernel to determine whether TRIM is supported?

-
Is the SSD connected to a RAID controller? Some controllers don't support passing the command. –  Marshalus Feb 1 '11 at 6:16
Good question. Nope, directly attached to the bus. –  Don MacAskill Feb 1 '11 at 6:16
Daft question, but does it work with the stock kernel? The latest ones support discard for EXT4. –  Matthew Ife Nov 21 '11 at 15:14

The "FITRIM" message is better than "TRIM" for performance on SSD disk. This support comes since 2.6.37 - so "online discard" is replaced by "batch discard". You have to enable it on ext4 with an ioctl command, see the fstrim utility from util-Linux.

It has been improved in 2.6.39 and 3.1 releases.

Moreover the "direct bio layer" feature for ext4 is disabled in 2.6.37 because of file system corruptions. It has been enabled since 2.6.39.

So for SSD performance, you should update to 2.6.39 or even 3.1

-

Don, nice to see ya on here (smugmug pro here)...

You might want to take a look at this post over on the OCZ forum. Which is using 2.6.36 and has some interesting tidbits which may shed some light on your particular setup.

As for the distro question, as you know, CentOS 5.5 is getting pretty ancient. Still have it on a lot of boxes, but looking forward to the major release. 5.6 should be out this week(ish) and 6 should be finished very, very soon. Might have already been done had Red Hat not released 5.6 and 6 at almost the same time. I'm a centos guy for production hardware, but it would be interesting to see what Ubuntu 10.10 server would do given your same setup.

Good luck.

-

I agree with Zeb. You might want to give a live-cd a try just to check what a more recent kernel and newer ext4fs-tools will output.

-

The current recommendation seems to be use batch TRIM, not per delete TRIM. The command fstrim -v / will do this for your mounted root partition.

-