Online Book Reader

Home Category

Managing RAID on Linux - Derek Vadala [62]

By Root 1420 0
as array members on the second line. That's because, when this array was built, only two member disks were defined. So the number of member disks will always remain constant. Each failed disk, like active member disks and spare disks, has its own disk index. When a disk in the array fails, it is removed from the raid-disk index and added to the failed-disk index, and that's why the array disk count remains at two.

Once the recovery is complete, remove the old failed disk using raidhotremove or mdadm -r, and the /proc/mdstat entry will return to normal.

md1 : active raid1 sdd1[0] sdc1[1]

17920384 blocks [2/2] [UU]

If the spare disk also fails during recovery, the md driver will halt the reconstruction process and report both failures in /proc/mdstat, unless additional spare disks are available. In that case, the md driver will insert the next available spare disk and restart the recovery process.

md0 : active raid5 sdh1[4](F) sdg1[3] sdd1[2] sdf1[1](F) sdb1[0]

53761152 blocks level 5, 64k chunk, algorithm 2 [4/3] [U_UU]

resync=DELAYED

unused devices:

/proc/sys/dev/raid

The /proc/sys directory provides interfaces for manipulating tunable kernel parameters. These parameters, which affect various aspects of the kernel, can be fine-tuned while the system is running. For more general information about /proc/sys, consult the file in the /usr/src/linux/Documentation/sysctl directory of your kernel source code, as well as /usr/src/linux/Documenation/filesystems/proc.txt.

Two files in the /proc/sys/dev/raid subdirectory provide a way to tune the speed at which array resynchronization (and reconstruction) takes place. speed_limit_min and speed_limit_max define the minimum and maximum speeds at which resynchronization occur. The latter is especially useful on slower, or heavily utilized, systems, where you might find that the resynchronization process slows down the system too much. In that case, you could change the maximum speed—in effect, throttling the resynchronization process to a more suitable level. The md driver does provide its own I/O throttling and will attempt to perform recovery nonintrusively, but using speed_limit_min and speed_limit_max can provide a quick fix if something goes haywire.

You'll need to experiment with your system to see the maximum speed it can handle. Adjusting the minimum speed affects the low-end limit for resynchronization. It might be a good idea to simulate a drive failure and play with these values so that you aren't surprised when a real disk failure happens.

* * *

Tip

You can simulate a disk failure by using the raidsetfaulty or mdadm --fail commands, which are described later in this chapter. You can also simulate a disk failure by disconnecting the cable connected to a drive or by removing a drive from a hot-swap enclosure. Remember, as I warned in the section Hot-Swap in Chapter 2, that you should not disconnect hardware while the system is powered on, unless you have equipment that supports this operation. When simulating a disk failure, the md driver will not register that a disk has failed until an I/O operation is performed. That means you might have to access or create a file on the array before the md driver reports the failure. Running the sync command to flush filesystem buffers from memory to disk might also be required.

* * *

The default limits (100 KB and 100,000 KB, respectively) can be changed by echoing new values into the pseudofiles:

# echo "5000" > /proc/sys/dev/raid/speed_limit_min

# echo "50000" > /proc/sys/dev/raid/speed_limit_max

This changes the low and high limits to 5 MB and 50 MB, respectively. You can add the above commands to your system initialization scripts if you want to change the default values of speed_limit_min and speed_limit_max automatically each time the system boots. Most distributions now provide the configuration file /etc/sysctl.conf to preserve changes to /proc/sys across reboots. For instance, you can alter resynchronization speeds by adding the following lines to /etc/sysctl.conf:

dev.raid.speed_limit_min

Return Main Page Previous Page Next Page

®Online Book Reader