We use RAID1+0 with md on Linux (currently 2.6.37) to create an md device, then use LVM to provide volume management on top of the device, and then use ext4 as our filesystem on the LVM volume groups.

With SSDs as the drives, we'd like to see the TRIM commands propagate through the layers (ext4 -> LVM -> md -> SSD) to the devices.

It looks like recent 2.6.3x kernels have had a lot of new SSD-related TRIM support added, including lots more coverage of Device Mapper scenarios, but we still can't seem to get it to cascade down properly.

Is this possible yet? If so, how? If not, is any progress being made?

link|improve this question

80% accept rate
See updated serverfault.com/a/229486/67675 :) – poige Apr 7 at 3:30
feedback

4 Answers

up vote 4 down vote accepted

Not possible, cause Linux Soft RAID doesn't support this (yet?).

UPD.: Thanks to Wodin for letting me know — according to lkml.org/lkml/2012/3/11/261 this functional has been added recently.

link|improve this answer
You can still minus this answer, but this wouldn't make LSR support TRIM :) – poige Feb 2 '11 at 2:26
1  
It does now. lkml.org/lkml/2012/3/11/261 – Wodin Apr 6 at 23:29
@Wodin, thanks. – poige Apr 7 at 3:24
feedback

As of 2.6.37, it should be present (source). The kernel doesn't do it in the background, the block discard process is currently designed to be run on demand (cron script!). Dm-crypt support doesn't exist yet.

On January 13th, 2011 a patch was merged into dm-raid1.c that reads:

dm raid1: support discard

Enable discard support in the DM mirror target.
Also change an existing use of 'bvec' to 'addr' in the union.

I'm not 100%, but I think that's the merge-window for 2.6.38.

EXT4 added support a while ago, as did LVM. RAID is the one key that doesn't have support. As of 1/13/2011, it appears support has been added. Look for it in 2.6.38 or maybe 2.6.39.

link|improve this answer
Saw that thread, and the related commits, but like I said in the question - does this mean it'll properly pass through not only LVM (Device Mapper) but also md (Software RAID)? – Don MacAskill Jan 30 '11 at 7:01
1  
This sounds promising, but my understanding is that dmraid is primarily used for so-called 'fakeRAID' hardware RAID controllers. What I'm talking about is a more typical software-only mdadm RAID-1 (+0) array(s) with LVM on top. AFAIK, that setup doesn't benefit from dmraid's new-found ability to handle discards. Right? – Don MacAskill Feb 1 '11 at 21:59
1  
@DonMacAskill The 'raid1.c' file doesn't have any commits referencing TRIM, FITRIM, or 'dispose'. So, looks like mdadm --create RAID support isn't there yet after all. – sysadmin1138 Feb 1 '11 at 22:25
feedback

You can use my MDTRIM script ( https://github.com/Cyberax/mdtrim/ ) to TRIM empty space on ext4/3 level-1 RAIDs. We start it periodically from cron and it works great for us.

Adding support for other RAID levels is possible, but I don't have time (or need) for that.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.