LHN Ch26 Linux Software RAID is THE manual for softraiding on Linux. There's just no other complete manual over the web!
But after having followed the guide i've been suffering from a very annoying problem: when i add (or remove) drives to my computer, the sd* numbering of drives changes and array won't assemble! I had to update my mdadm.conf every time i add/remove non-raid drives.
Recently i decided to invest some time to overcome this issue. And i've found a solution!
In section "Create the mdadm.conf Configuration File" the command reads:
Solution: remove "--verbose" and that's it!
mdadm --detail --scan --verbose > /etc/mdadm.conf
It's the "--verbose" parameter that defines what /dev/sd* partitions to use. If you don't provide those manually with "--verbose" then... mdadm will find the partitions automatically!
mdadm --detail --scan > /etc/mdadm.conf
This is possible because of two facts:
1) All partitions of a raid array share same UUID. So mdadm doesn't need to know the sd* names to understand what partitions are part of what array.
2) Default mdadm.conf already has the "devices" directive defined with value "partitions". This forces mdadm to scan through all available partitions if none are defined manually.
PS I also suggest either changing "/etc/mdadm.conf" to "/etc/mdadm/mdadm.conf" or making a note that the Ubuntu/Debian users should be aware of the path.