I am trying to write a script similar to mdtrim (https://github.com/Cyberax/mdtrim) for a raid 0 software raid through mdadm. The mdtrim is for raid 1 only at the moment, and it works by writing a large, mostly empty file to the file system, finding the sector ranges through hdparm --fibmap, and trimming those sectors (+offset) on the individual drives in the mirror array.

My question is about how mdadm maps the virtual LBAs to the physical ones. As an example, for a two disk array, is it as simple as having all even strips contiguously on the first drive (+ some offset) and all odd strips on the second drive? Does it keep an internal map, and is that map constant. I have tried searching the web about details of how mdadm implements raid 0, but to no avail.

link|improve this question
feedback

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
or
required, but never shown

Browse other questions tagged or ask your own question.