Configuring Software RAID on RedHat linux

This document describes how to setup software RAID in linear mode on
a RedHat Linux  system. Linear mode combines the capacity of
multiple
disk partitions into a single large partition with no redundancy.

Step 1: Organise RAID partitions

All data on the constituent partitions will be erased!

Decide which partitions will be used to form the RAID device. The
system
ID on these partitions should be changed to “fd” (Linux Raid Auto) so
that
the RAID device can be automatically restarted after a reboot (and mkraid
sometimes complains if they’re not of type “fd”).  To change a
partition’s
system ID, start fdisk with the name of the physical drive device as an
argument. When prompte, type “t” for “change a partition’s system Id”
and
then select “fd”.

 

Step 2: Create a raidtab configuration file

If /etc/raidtab does not exist, create one using the sample
template
at /usr/share/doc/raidtools-0.90/raidtab.sample.

cp /usr/share/doc/raidtools-0.90/raidtab.sample /etc/raidtab

Note: If an error occurs due to the RAID configuration and
the
machine won’t boot correctly as a result, rename or move the raidtab
file to prevent the init processes from attempting to start the RAID
drivers.
The machine can then be rebooted successfully and further configuration
can be done.

Step 3: Raidtab settings

For linear raid configuration, edit /etc/raidtab to resemble
the
following settings:

#

# linear RAID setup, with no spare disks:

#

raiddev /dev/md0

   
raid-level               
linear


   
nr-raid-disks            
2


    persistent-superblock    
1


   
chunk-size               
32

   
device                   
/dev/hda7


   
raid-disk                
0


   
device                   
/dev/hdb7


   
raid-disk                
1


 

To add another device to the RAID, increment the nr-raid-disks
parameter and add another set of device and raid-disk
parameters.

The persistent-superblock option has to be switched on
(set
to 1) to enable the system to auto-detect the raid device
after
a reboot.

The chunk-size option is meaningless for a linear RAID
configuration
so this can have any value.

Step 4: Initialise the RAID device

Prior to initialising the RAID device, the consistuent partitions must
be unmounted:

umount /dev/hda7

umount /dev/hdb7

Use the mkraid command to initialise the partition:

mkraid /dev/md0

The /proc/mdstat virtual file can be used to check the
status
of the new RAID device.

[root@test big]# cat /proc/mdstat

Personalities : [linear]

read_ahead 1024 sectors

md0 : active linear hdb7[1] hda7[0]

      47664640 blocks 32k rounding

unused devices: <none>

 

Step 5: Create the filesystem

A RAID device does not rely on having a particular type of filesystem.
To create an ext2 filesystem on the new RAID device use the mke2fs
command:

mke2fs /dev/md0

To convert this filesystem to ext3, run the command:

tune2fs -j /dev/md0

 

Step 6: Mount the RAID partition

If the constituent devices are still listed in /etc/fstab
they
should be removed so that they are not mounted during a reboot.

Add a new entry to /etc/fstab for the RAID device as
follows:

/dev/md0        
/big  
ext3   defaults 1 2

Mount the RAID device as follows:

mount /big

Finally, check the size of the RAID device using  df -h:

Filesystem           
Size  Used Avail Use% Mounted on


/dev/hda1            
251M   91M  146M  39% /


/dev/hda6            
121M  6.9M  108M   6% /home


none                 
250M     0  250M   0% /dev/shm


/dev/hda2            
2.0G  354M  1.5G  19% /usr


/dev/hda5            
121M   21M   95M  18% /var


/dev/md0            
45G   20k   42G   1%  /big

Leave a Reply

Your email address will not be published. Required fields are marked *