next up previous contents
Next: Performance Tuning Up: RAID: Redundancy Array of Previous: Setting Up RAID Level   Contents

Setting Up RAID Level 5

  1. Check if the linux kernel already supports software RAID driver
     
    # more /proc/mdstat
    Personalities : [raid5]
    read_ahead 1024 sectors
    unused devices: <none>
    
    However, if RAID level 5 is compiled as a module, the Personalities might be empty. You should try to insert RAID level 5 module
     
    # insmod raid0
    
    and eventually see the same result.

  2. Edit the configuration file /etc/raidtab to add a new RAID device

    An example for RAID level 5 is shown below.

     
    raiddev  /dev/md0
        raid-level              5
        chunk-size              32k
        parity-algorithm        left-symmetric
        persistent-superblock   1
        nr-raid-disks           4
    
        # Spare disks for hot reconstruction
        nr-spare-disks          0
    
        device                  /dev/sdb1
        raid-disk               0
    
        device                  /dev/sdc1
        raid-disk               1
    
        device                  /dev/sdd1
        raid-disk               2
    
        device                  /dev/sde1
        raid-disk               3
    
    where /dev/sdb1, /dev/sdc1 and /dev/sdd1 are free partitions with Linux native or Linux raid autodetect types. The left-symmetric is the parity-algorithm that offers maximum performance on typical disks. Since when you traverse the striping units sequentially, it allows each disk to be accessed once before accessing any disks twice. Left-symmetric and left-asymmetric algorithm are demonstrated in Figures 13.5 and 13.6. See man raidtab for further detail.

    Figure 13.5: Showing how Left-symmetric algorithm operates
    \begin{figure}\begin{center}
\epsfig{file=pics/symmetric.eps,height=2in} \end{center} \end{figure}

    Figure 13.6: Showing how Left-asymmetric algorithm operates
    \begin{figure}\begin{center}
\epsfig{file=pics/asymmetric.eps,height=2in} \end{center}\end{figure}

  3. Initial new RAID device

    All previous data in disk array will be destroyed then RAID superblock is created.

     
    # mkraid --really-force /dev/md0
    
    The RAID device /dev/md0 must be specified in /etc/raidtab.

  4. Start the new RAID device

    The command mkraid also start the RAID device being initialized automatically. Check the started RAID by:

     
    # more /proc/mdstat
    Personalities : [raid5] 
    read_ahead 1024 sectors
    md0 : active raid5 sde1[3] sdd1[2] sdc1[1] sdb1[0] 16780800 blocks 
    level 5, 32k chunk, algorithm 2 [4/4] [UUUU] resync=10.1% finish=588.4min 
    unused devices: <none>
    
    Size of the RAID device is reported by the number of blocks (each block has 1024 bytes). The $ [$4/4$ ]$ means 4 out of 4 disks work normally. If there is a corrupted disk, a letter U in $ [$UUUU$ ]$ will be replaced by the letter _ indicating the corrupted disk, for example $ [$4/3$ ]$ $ [$UUU_$ ]$. When the RAID device is successfully created, the syncronization process begins. The /proc/mdstat shows the progres of syncronization and the approximated remaining time. During syncronization, RAID device can be used for reading/writing but redundancy is not guarunteed.

    However if this is not the case, you can start RAID device manually by command

     
    # raidstart /dev/md0
    

  5. Create a file system on RAID device

    The RAID device will appear to users just like a typical disk partition. The follow command creates ext2 file system on the RAID device.

     
    # mkfs /dev/md0
    

  6. Mount the file system into the directory tree
     
    # mount /dev/md0 <mount point>
    
    Finally, you must edit the /etc/fstab to make the modification persistent as shown below.
     
    LABEL=/              /                    ext2    defaults        1 1
    none                 /proc                proc    defaults        0 0
    /dev/sda5            swap                 swap    defaults        0 0 
    /dev/md0             /RAID5               ext2    defaults        1 2
    


next up previous contents
Next: Performance Tuning Up: RAID: Redundancy Array of Previous: Setting Up RAID Level   Contents
root 2002-09-30