Use fdisk to create a single primary partition on sd[cde] of type fd (linux raid)
If you create raid volume initially with all but one disk (you have to do minimum of 3 initially) – then you can see how to add a disk to the raid after the fact. At any rate – here’s how to do the initial setup. Afterwards, I’ll show you how to add a disk to the raid.
mdadm --create --verbose /dev/md2 --level=5 --auto=yes --raid-devices=3 /dev/sd[cde]1
Wait for the initial build to complete (150 minutes with 750GB drives with SATA-300, ~80MB/s)
watch cat /proc/mdstat
Install xfs File system (you can dynamically expand it without unmounting )
yum install xfsprogs xfstools kmod-xfs
Create xfs partition in the raid
mkfs.xfs -f /dev/md2
Mount it … copy some files … do with it what you will. You now have a raid 5 partition!
Expanding by 1 disk:
Create a single partition (fdisk) as before – type fd (linux raid)
Add it to the existing array as a spare
mdadm --add /dev/md2 /dev/sdf1
Grow the array from 3 to 4 disks
mdadm --grow /dev/md2 --raid-devices=4
Allow the array to reshape. (As a reference … I went from 4x 750GB drives to 5x 750GB – it took me somewhere between 7 and 8 days to reshape … I was only reshaping @ 1MB/s due to a bad SATA controller.)
When it finishes, grow the xfs to fill the newly expanded array.
xfs_grow /dev/md2
*** Note: Any time you resize your raid — be sure to re-create /etc/mdadm.conf… I have good horror stories of what happens when you don’t
cat /etc/mdadm.conf | grep -v md2 > ~/tempfile; mdadm --detail --scan | grep md2 >> ~/tempfile; mv /etc/mdadm.conf /etc/mdadm.conf.old; mv ~/tempfile /etc/mdadm.conf