No announcement yet.

SSD TRIM and Linux software RAID

  • Filter
  • Time
  • Show
Clear All
new posts

  • SSD TRIM and Linux software RAID

    I am interested in running SSDs on Linux. I understand that the Linux kernel now supports SATA TRIM, but that if I put SSDs on a RAID controller, the TRIM will not make it through the controller out to the drives.

    What about software RAID? will TRIM support work under that?

  • #2
    As best as I can tell, the patch was merged into the 2.6.36 kernel (current is From there, I think you just need a mount option to a file system with support or an argument to swapon.


    • #3
      So, if you use a SSD w/ TRIM (for e.g., w/ Sandforce controller 1200) on a Linux kernel 2.6.36, TRIM will work? Gparted will format the partition with proper alignment?

      I guess RAID requires more tweaking? I'm just curious.


      • #4
        I'm not very well informed on the issue. I just happened to be looking up the information for something else, and exploring the option of cheap SSD's for a database server instead of 15k drives, which are now a similar price for the faster 2.5" drives. However, I'm now curious, since I've been eying SSD's for some time, and I like to be an expert at something before I buy. I cannot personally verify if any of this is correct, since I do not have $100 to spend on an SSD, and our company is a ways from needing any such thing.

        If you're not using RAID, TRIM support was fully functional in kernel 2.6.33 for at least ext4, though I read it was more optimized in 2.6.35. I know swapon currently supports 'discard' (the Linux TRIM command) as an option. I'm pretty sure btrfs and some others support it as well. I found a Ubuntu howto here: The only thing that might be special to Ubuntu is the editor used and how the drive is identified. All they do is add 'discard' to the mount options, which as recently as April 2010, someone documented problems functioning with the data=writeback option.

        Anyone still having problems might do well getting help on the Gentoo forums, as Gentoo users are generally more knowledgeable on details of Linux's inner workings. I suspect the 2011 releases of Linux will feature much more mature support.

        The problem with hardware RAID is that they usually show up as a SCSI device, which uses a much more complex 'PUNCH' command instead of the ATA 'TRIM' command. If it were to issue the SCSI 'PUNCH' command, then the ATA devices wouldn't recognize it. A RAID device that shows up as an (S)ATA device might support TRIM, but it wouldn't surprise me if the fast drives overwhelmed the card. It's surprisingly difficult to find any worthwhile benchmarks, which was my much derailed quest that launched my research.

        Adaptec boasts their newest RAID cards process 2GB/s, but they also list a peak performance that's faster than the card's PCI-e connection. I found a paper on RAID6 using a GeForce 260 GPU, and I think lookup tables, which benchmarks at a peak of >1400 MB/s while using 3 parity disks. (link). I would think using SSE2 XOR on some spare CPU cores for RAID5 would be at least competitive with Adaptec, but the information has been elusive.