Wednesday, February 18, 2009

Configuring RAID

RAID (Redundant Array of Inexpensive Disks) lets you configure multiple physical disks into a single virtual disk, thereby taking advantage of multiple disks and I/O channels working in parallel on a disk I/O operation. Many Linux distributions, especially enterprise versions, now provide RAID support. The easiest way to configure RAID is during installation. However, RAID can be configured on a preinstalled system as well. Here's how:

1.If new partitions are created, modify /etc/fstab appropriately. If the root and /boot partitions are on these new partitions, modify the /boot/grub/menu.lst file accordingly.
2.If existing partitions are combined to create a new RAID partition:
* Verify that the raidtools package is present:

mkraid V

*Verify that RAID support is compiled into the kernel:

cat /proc/mdstat

*Create or modify /etc/raidtab. Create the following entry for each of the RAID devices:

/* Create RAID device md0 */
raiddev /dev/md 0 /* New RAID device */
raid-level 0 /* RAID 0 as example here */
nr-raid-disk 2 /* Assume two disks */
/* Automatically detect RAID devices on boot */
persistent-superblock 1
chunk-size 32 /* Writes 32 KB of data to each disk */
device /dev/hda1
raid-disk 0
device /dev/hdc1
raid-disk 1

Large chunk sizes are better when working with larger files; smaller chunk sizes are more suitable for working with smaller files.
3.Create the RAID device:

mkraid /dev/md0

4.View the status of the RAID devices:

cat /proc/mdstat

5.Format the RAID device with the ReiserFS file system, for example:

mkreiserfs /dev/md0

6.Modify /etc/fstab to indicate which partition(s) are on the RAID device. For example, to have /usr on the RAID device /dev/md0, make sure that the /usr line in /etc/fstab points to /dev/md0.

To squeeze the most performance out of the disk I/O subsystem, make sure that DMA and 32-bit transfers are enabled. This can be done via the hdparm utility, as follows (all commands are examples only):

1.Verify that DMA is enabled:

hdparm d /dev/hda

2.If DMS is not enabled, enable it by issuing the following command:

hdparm dl /dev/hda

3.Verify that 32-bit transfers are enabled:

hdparm c /dev/hda

4.If 32-bit transfers are not enabled, enable them by issuing the following command:

hdparm cl /dev/hda

5.Verify the effectiveness of the options by running simple disk read tests as follows:

hdparm Tt/dev/had

So far, we have discussed how best to set up the disk I/O subsystem for optimal performance. Now we need to look at two key configurable kernel features that are available on the 2.6 kernel. These 2.6 kernel features can impact performance for some application workloads.

No comments: