I have spent some time over the last few weeks getting familiar with mdadm and software RAID on Linux, so I thought I would write down some of the commands and example syntax that I have used while getting started.
1)If we would like to create a new RAID array from scratch we can use the following example commands:
RAID1-with 2 Drives:
RAID5-with 5 Drives:
RAID6-with 4 Drives with 1 spare:
2)If we would like to add a disk to an existing array:
# mdadm –grow /dev/md0 -n [new number of active disks – spares] (grow the size of the array)
3)If we would like to remove a disk from an existing array:
First we need to ‘fail’ the drive:
Next it can be safely removed from the array:
4)In order to make the array survive a reboot, you need to add the details to ‘/etc/mdadm/mdadm.conf’
# mdadm –detail –scan >> /etc/mdadm.conf (Everyone else)
5)In order to delete and remove the entire array:
First we need to ‘stop’ the array:
Next it can be removed:
6)Examining the status of your RAID array:
There are two options here:
or
# mdadm –detail /dev/md0