Create a RAID5 array

Create a 10TB RAID5 array using 5x2TB drives

Initial test

Using 5x1GB disks in a virtual machine.

Physically add the disks

mdadm --create --verbose /dev/md0 --level=raid5 --raid-devices=5 /dev/sda /dev/sdb /dev/sdc /dev/sdd /dev/sde && \
watch -n 1 cat /proc/mdstat

wait for the devices to finish sync’ing

fdisk /dev/md0

accept all the defaults and then press ‘w’ to write.

mkfs.ext4 /dev/md0p1
mount /dev/md0p1 /mnt/raid5
df -h

You should see about 4GB of disk space with 5x1GB disks.

Create the 5x2TB drive array

Format the RAID devie

parted /dev/md0

(parted) mklabel gpt
Warning: The existing disk label on /dev/md0 will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes
(parted) unit TB
(parted) mkpart primary 0.00TB 10.00TB
(parted) print

I think you should see about 8TB of disk space with a 10TB RAID5 array.

Add extra disks to a RAID5 array

Add three disks (from an existing RAID0 array) to a new two-disk RAID5 array.

I’m going to destroy the existing RAID0 array and use those disks in a new RAID5 array.

Stop the array with three disks

mdadm --stop /dev/md0

Erase any existing RAID meta-data

mdadm --zero-superblock /dev/sda
(repeat for the other two devices)

Add the disks to the RAID5 array

mdadm --add /dev/md5 /dev/sda /dev/sdb /dev/sdc && \
watch -n 1 cat /proc/mdstat

When the sync’ing finishes grow the array

mdadm --grow /dev/md5 --raid-devices=5 && \
watch -n 1 cat /proc/mdstat

it should say something about “reshaping”. This might take awhile.