Online Book Reader

Home Category

Managing RAID on Linux - Derek Vadala [60]

By Root 1358 0
and processes. Here is also where you look for current information on active RAID devices. Virtual files under /proc provide information in real time. By default, the kernel is configured to support the /proc filesystem. However, to be certain that your kernel supports /proc, look for its entry in the File systems subsection of the kernel configuration:

File systems --->

...

[*] /proc file system support

...

Files located in /proc are usually displayed using the cat command, but you can use any program in which you can view a text file. Most of the files in /proc merely provide information (they are read-only), but some actually offer the means to manipulate the way a running kernel operates. In that case, administrators usually write new values to a file using the echo command.

/proc/mdstat

/proc/mdstat provides a way to examine the state of the md driver, including information about active software arrays. When no arrays are running, displaying /proc/mdstat simply shows which RAID levels the kernel supports.

# cat /proc/mdstat

Personalities : [linear] [raid0] [raid1] [raid5]

read_ahead not set

unused devices:

In this example, there are no active arrays, but this kernel supports linear, RAID-0, RAID-1, and RAID-4/5. The read_ahead value is not currently set, because no arrays are active. read_ahead defines the number of sectors the kernel should cache during sequential reads. Finally, unused devices is also empty, because there are no devices in the md subsystem that are not currently in use by an array.

If arrays are defined, /proc/mdstat provides detailed information about them, as shown in the following code:

# cat /proc/mdstat

Personalities : [linear] [raid0] [raid1] [raid5]

read_ahead 1024 sectors

md2 : active raid1 sde1[1] sdd1[0]

17920384 blocks [2/2] [UU]

md1 : active raid0 sdc1[1] sdb1[0]

35840768 blocks 64k chunks

First, note that read_ahead is now set to 1024 sectors. That means that during sequential reads, the kernel will attempt to cache a maximum of 1024 sectors worth of data, or about 512 K (1024 sectors, with approximately 512 bytes per sector). The default value of 1024 sectors is a hard limit set by the md driver. Next, each array is listed, with the most recently activated array first. In this case, /dev/md2, a RAID-1, is listed first because it was activated most recently. Let's examine /dev/md2 one line at a time to get a better understanding of the information reported:

md2 : active raid1 sde1[1] sdd1[0]

The first line is fairly straightforward. The array /dev/md2 is an active RAID-1 containing two member disks: /dev/sde1 and /dev/sdd1. The numbers in square brackets ([ ]) following each member disk indicate the index number of that member disk. The information corresponds to either a raid-disk entry in /etc/raidtab or to the order in which member disks were listed on the command line using mdadm. Here, /dev/sdd1 is the first raid-disk and /dev/sde1 is the second.

17920384 blocks [2/2] [UU]

This line shows information about the state of the array and its size. This array contains 17920384 blocks. Blocks reported in /proc/mdstat are always 1 KB in size. The next data element [2/2] shows that there are two disks in the array and that both are active. The final field [UU] shows that both disks are error-free and operating normally. If a disk had failed, these fields would indicate that disks were missing from the array and which disks had failed. For example:

17920384 blocks [2/1] [_U]

Notice that there are two member disks, but only one disk is currently operational ([2/1]). The next field ([_U]) uses the underscore to indicate that the first disk has failed.

Depending on what type of array is defined, slightly different information is available through /proc/mdstat.

md1 : active raid0 sdc1[1] sdb1[0]

35840768 blocks 64k chunks

This example describes a RAID-0 at /dev/md1. The first line provides the same information that the RAID-1 example provides, but the second line omits information about the status of member disks and instead includes information about

Return Main Page Previous Page Next Page

®Online Book Reader