The use of RAID (Redundant Array of Independent Disks) spreads I/O over multiple physical disks. It’s purpose is to enhance data integrity and recover-ability in case of failure. Three essential features of RAID:
a) mirroring: writing the same data to more than one disks
b) stripping: splitting of data to more than one disks
c) parity: extra data is stored to allow problem detection and repair
There are number of RAID specifications of increasing complexity and use:
RAID 0: uses only stripping. Data is spread across multiple disks. However, there’s no redundancy and there’s no stability or recovery capabilities.
RAID 1: uses only mirroring, each disk has a duplicate. At least two disk are required.
RAID 5: uses a rotating parity stripe, a single drive failure cause no data loss. At least 3 disks are required.
RAID 6: has stripped disks with dual parity. It can handle loss of two disks. It requires at least four disks.
RAID 10: is a mirrored and stripped data set. It needs at least four drives.
1. First create two partitions using fdisk utility:
a) fdisk /dev/sdb
b) partprobe -s /dev/sdb; parted /dev/sdb print
2. Create RAID device:
a) mdadm –create /dev/md0 –level=1 –raid-disks=2 /dev/sdb5 /dev/sdb6
3. Format the RAID device:
a) mkfs.ext4 /dev/md0
4. Mount the RAID device:
a) mkdir /mnt/raid
b) echo “/dev/md0 /mnt/raid ext4 defaults 0 0″ >> /etc/fstab
c) mount -a; df -hT
5. Capture the RAID device details to ensure persistence:
mdadm –detail –scan >> /etc/mdadm.conf
6. Verify the RAID device status:
a) mdadm –detail /dev/md0
b) cat /proc/mdstat
Stop RAID device:
mdadm -S /dev/md0