One of the easiest ways to find if your Linux system has any RAID arrays currently in use is to view the contents of the /proc/mdstat file. It's a file that will definitely be present on your Linux system even if you don't have any actual RAIDs configured yet.
Empty mdstat configuration
This is how it will look on a system without RAID arrays configured:
[email protected]:~ $ cat /proc/mdstat Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath] [faulty] unused devices: <none>
/proc/mdstat showing configured RAID arrays
And here's an example from a system which has a number of arrays configured:
[[email protected] ~]$ cat /proc/mdstat Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath] [faulty] md1 : active raid1 sdb1 sdc1 sda1 10238912 blocks [3/3] [UUU] md2 : active raid5 sdb2 sdc2 sda2 280804352 blocks level 5, 512k chunk, algorithm 2 [3/3] [UUU] bitmap: 1/2 pages [4KB], 65536KB chunk md4 : active raid5 sdb4 sdc4 sda4 10236928 blocks level 5, 512k chunk, algorithm 2 [3/3] [UUU] unused devices: <none>
Understanding the /proc/mdstat
First line of the output says Personalities, and this tells you all the possible RAID configurations that your Linux kernel supports:
- raid0 – striped volume
- multipath – not really a RAID type but instead just support for additional paths (using fiber channel cards) to the same storage.
Next you will have active RAID arrays listed and documented, if there are any.
Her'es how to read a RAID configuration example:
md4 : active raid5 sdb4 sdc4 sda4 10236928 blocks level 5, 512k chunk, algorithm 2 [3/3] [UUU]
- md4 is the name of a RAID array device
- RAID type is raid5
- array consists of 3 devices (sdb4/sdc4/sda4)
- RAID block size is 512K (this is different from your Linux I/O block size, but should be considered and configured together for best performance)
- all 3 devices are up (that's why it says [UUU]). if any of the disks would be missing or faulty, I believe it would show which one by replacing U with _ – so [U_U] would mean the second disk (probably sdc4) is down
That's it for now! I'll be posting a full tutorial on creating RAID arrays in Linux soon, so stay tuned! Leave a comment or join my Facebook group to ask questions.