Examining Arrays Using /proc/mdstat
The best way to find out if there are already software arrays connected to your system is to use the /proc filesystem. /proc is an interface to important kernel data structures. You can get valuable information about the state of a running Linux system by looking at special files in /proc. These special files act as a window into the running kernel. The /proc filesystem is essential for monitoring the health of any software array.
Once the RAID patches are applied to a kernel and the system is booted using the new kernel, the pseudofile /proc/mdstat will provide information about the current state of RAID devices and the md driver. Once arrays are configured and activated, information about their status will also be displayed. Initially, /proc/mdstat merely reports the available RAID levels:
$ cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid5]
read_ahead not set
unused devices: <none>This /proc/mdstat indicates that support for linear mode RAID devices, as well as RAID-0, RAID-1, and RAID-4/5, is compiled into the running kernel. There are currently no active arrays. When there are active arrays, information about each one is reported by /proc/mdstat. In this example, there is an active RAID-1 with two member disks (/dev/sdb1 and /dev/sdc1) and one spare disk (/dev/sdd1):
# cat /proc/mdstat Personalities : [linear] [raid0] [raid1] [raid5] read_ahead 1024 sectors md0 : active raid1 sdd1[2] sdc1[1] sdb1[0] 17920384 blocks [2/2] [UU] ...Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access