3. Software Raid

This brief guide lists the steps you have to take in order to create a software Raid5 array.

Create a Raid5 array

mdadm --create /dev/md0 --level=5 --raid-devices=3 /dev/sdb1 /dev/sdd1 /dev/sde1

Add a device

mdadm /dev/md0 -a /dev/sdc1

Assign the added device to the Raid5 array

mdadm -G /dev/md0 -n4

View the array status

mdadm -Q --detail /dev/md0

Format the array (with XFS)

mkfs.xfs /dev/md0

Mount the array

mount /dev/md0 /mnt/floppy

Expand the XFS filesystem as the array size increases

xfs_growfs /dev/md0

Stop the array

mdadm -S /dev/md0

Find Raid5 disks and mount them after the stop

mdadm --assemble --scan

Start the Raid5 array at system login

Generate mdadm.conf

The device /dev/md0 must exist.

mdadm --detail --scan > /etc/mdadm.conf

Add the raid5 module to autostart

Append the following line to /etc/conf.d/modules:

modules="raid5" 

mdraid autostart

rc-update add mdraid boot
Thank you!