Where is the software RAID information actually written?

Like title says, where is the actual information which specifies which disks are being used, what order, etc...?

I noticed while installing a linux distro that it was detecting a RAID array without a RAID controller which must indicate that the info is not in some file in the OS, instead somewhere on the disks. Am I right?

Also, a second question: If I create a software RAID0 using 2 disks, format that new device as ext2, then get the disks and put them in a different box, will the second box be able to see that device created by the 2 disks as a RAID array (md0 or something) and be able to mount it?


Solution 1:

Linux MD RAID info is most often written to the RAID superblock on each device, making it intrinsic to the array. This is the reason, why an array created by one installation can easily be found and started by another installation.

There is the possibility of a non-superblock array, that must be assembled by using outside knowledge, but this is rather a specialist feature.

If you create a RAID with a superblock (which is the normal case) moving those disks to another system will typically make it easy to use it there. With most distros, this RAID will be automatically found and started in read-only mode, so you can mount it read-only or run mdadm --read-write /dev/mdXXX to put it in read-write mode and mount it read-write.