Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to write a script similar to 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.

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.