by August 9, 2003 0 comments



Last month we saw how to configure software RAID 0 (Redundant Array of Independent Disks) on Win XP/2000/2003 systems (Configuring S/W RAID on windows, page 34, PCQuest). Software RAID, unlike hardware RAID, uses kernel or driver-level software, and not a specialized controller, to perform RAID-related functions. This time we will configure RAID on PCQLinux 8.0. RAID arrays can be created in two ways: one, while installing PCQLinux and, the other, when it has been installed. During the installation phase you can only configure RAID levels 0, 1 and 5, while after installation you can configure other RAID levels as well. Having said that, levels 0, 1 and 5 are the most widely used. For RAID 0 and 1, you need at least two disk drives, while for RAID 5 you need at least three disk drives.

The partitioning screen lists the RAID devices and software RAID partitions

RAID during installation
During the normal PCQLinux installation process, RAID arrays can be created during the disk-partitioning phase of the installation. On the Disk Partitioning Setup screen, select Manually Partition with Disk Druid. In Disk Druid, choose New to create a new partition. Choose Software RAID from the File System Type drop-down menu. For Allowable Drives, select the drive on which the partition will be created (you cannot select more than a single drive for the software RAID file system).

Enter the size of the partition. Click on OK to return to the main screen. 

Repeat this process to create as many partitions as needed for your RAID setup. Once you have all your partitions created as 
 software RAID, select the RAID button on the Disk Druid main partitioning screen. A new box will appear, where you select Create a RAID Device. On the next screen, choose your RAID Level. You can choose from RAID 0, RAID 1 and RAID 5.

Select software RAID as the file system type

Leave the RAID device default at md0. Choose the File System Type and the Mount Point. Bootable partition can only be on RAID level 1 or on simple partitions, so if you select Mount Point / and are using RAID level 0 or 5, then you must first create a separate /boot partition on either a RAID 1 partition or on a simple partition. The software RAID partitions you just created appear in the RAID Members list. Select which partitions of these should be used to create the RAID device. When you click on OK, the RAID device will appear in the Drive Summary List of the main partitioning screen. Now you can continue with your installation process.

RAID after installation
Creating a RAID array after PCQLinux has been installed is as easy as doing it during installation. Install your disk drives and configure them properly. Now, using the fdisk utility, create software RAID partitions on them, which will take part in the array. The partition type should be Linux Raid Auto (type fd) and not the default Linux (type 83) or Linux Swap (type 82).

After the partitions are ready, you have to create the /etc/raidtab file that will contain configuration parameters of the RAID device. Following is an example of /etc/raidtab file for a RAID 5 array.

raiddev  /dev/md0

raid-level 
5

nr-raid-disks
5

nr-spare-disks 
1

chunk-size 
128

persistent-superblock 
1

parity-algorithm 
left-symmetric

device 
/dev/hda2

raid-disk 
0

device 
/dev/hdb1

raid-disk 
1

device 
/dev/hdc1

raid-disk 
2

device 
/dev/hde1

raid-disk 
3

device 
/dev/hdg1

raid-disk 
4

device 
/dev/hdd1

spare-disk 
0

In this file, raiddev shows the device file for the RAID array, raid-level defines the RAID level, nr-raid-disks indicates how many disk partitions are to be a part of the array, nr-spare-disks indicates the number of spare disks that can automatically take the place of a malfunctioning disk. If no spare disks are used, leave its count to 0. Chunk-size defines the number of bytes that are written to and read from a disk at one time. A chunk size of 128k is a good default for many general-purpose file system, but as a general rule a small chunk size is good for small files whereas a large chunk size is good for large files. So, see your file size requirements and use the appropriate chunk sizes, such as 32k, 64k or 256k. The persistent superblock option writes a special superblock at the beginning of all disks participating in the array. This makes the RAID array get auto detected on system boot. The device, raid-disk together define the physical partitions that will make the array, the device, spare-disk define the spare disk partitions and is optional. The parity-algorithm option is only for RAID level 5, left-symmetric is one of the many algorithms used to create a RAID 5 array. This algorithm being the best should be used in most cases.

After you have created your disk partitions and saved this file, run the mkraid /dev/md0 command to build the RAID array. If the command runs successfully, the synchronization of drives will start, which will construct the array for the RAID operation.

This process takes up a lot of system resources and the system may become a bit slow while the array is being reconstructed.

However, the reconstruction process is completely transparent and the device is fully functional and can be formatted and used while being reconstructed. To format the device with the ext2 file system, run mke2fs /dev/md0. After this you can mount the RAID device and use it like a normal disk. You can format the RAID device with other file systems also, such as FAT, ReiserFS or ext3.

To see the status of the RAID array, use the command cat /proc/mdstat. This will tell you whether the RAID device is in reconstruction phase or a disk has failed or is in the normal mode with everything working fine. To stop and start your RAID device, you can use the raidstop /dev/md0 and the raidstart /dev/md0 commands, respectively. But, before stopping the device you have to first unmount it.

If /proc/mdstat shows that a fault is generated in your RAID array, use raidhotadd utility to rebuild the array after the problem has been rectified (mostly by replacing the disk). After replacing the disk, partition it and make software a RAID partition identical to those on other disks in the array. Then issue the command raidhotadd /dev/md0 . Replace with the new disk partition (for example, /dev/hdb1). After this, the reconstruction of the array will take place.

Anoop Mangla

Hardware used

We used the following hardware configuration for our RAID setup.

Four Seagate 40 GB Parallel ATA drives

Two Maxtor 120 GB Serial ATA drives

Intel 875PBZ motherboard, having two Serial ATA channels in addition to the Parallel ATA ones

512 MB dual-channel DDR 400 RAM

Intel P4 3.0 GHz processor

Onboard Gigabit Ethernet

The size of a RAID volume depends on the size of the smallest partition taking part in the array. If ‘S’ is the size of the smallest partition and we have ‘N’ partitions of the same size as the smallest partition or more than it, the size of the array will be S*(N-1). So, keep all partitions in the array of same size, otherwise you will waste space in bigger partitions. We had four 40 GB disks and two 120 GB disks, so we made 40 GB partitions on each, which were part of the array. The remaining 80 GB on each 120 GB disk was formatted as a separate partition. These partitions were not a part of the array, and were, therefore, used for storing other data. Theoretically, you can have multiple partitions from the same hard drive forming the RAID array on Linux. Technically, however, this is not a good idea as the hard drive could crash and bring down the array.

For more on RAID, see More Reliability with RAID at www.pcquest.com/content/server_ side/101061801.asp or on this month’s PCQEssential CD (system\cdrom\hotutils\utils\Article
detail.htm).

No Comments so far

Jump into a conversation

No Comments Yet!

You can be the one to start a conversation.

Your data will be safe!Your e-mail address will not be published. Also other data will not be shared with third person.