How to get the status of a Linux software raid

The current status of a Linux software raid is written to the virtual file /proc/mdstat. You can view the status on the shell easily with the cat command:

cat /proc/mdstat

The output will look similar to this:

Personalities : [raid0] [raid1] [raid6] [raid5] [raid4]
md2 : active raid1 sda3[0] sdb3[1]
726266432 blocks [2/2] [UU]

md1 : active (auto-read-only) raid1 sda2[0] sdb2[1]
4200896 blocks [2/2] [UU]
resync=PENDING

md0 : active raid1 sda1[0] sdb1[1]
2104448 blocks [2/2] [UU]

The above setup is a raid 1 system, this means that the data is mirrored to both disks. If one disk would have failed, you would see [_U] when the first disk has failed or [U_] when the second disk has failed in the output instead of [UU].

Example:

Personalities : [raid0] [raid1] [raid6] [raid5] [raid4]
md2 : active raid1 sda3[0] sdb3[1]
726266432 blocks [2/2] [_U]

md1 : active (auto-read-only) raid1 sda2[0] sdb2[1]
4200896 blocks [2/2] [UU]
resync=PENDING

md0 : active raid1 sda1[0] sdb1[1]
2104448 blocks [2/2] [UU]

In this case, the first disk of the md2 raid partition has failed.