yum install mdadm
mdadm -E /dev/sd[b-h]
Actually this is optional. If you want to partition first, you should make sure you’re using gpt or others which support larger than 2T.
Please follow the below instructions to create partition on /dev/sdb drive.
- Press ‘n‘ for creating new partition.
- Then choose ‘P‘ for Primary partition. Here we are choosing Primary because there is no partitions defined yet.
- Then choose ‘1‘ to be the first partition. By default it will be 1.
- Here for cylinder size we don’t have to choose the specified size because we need the whole partition for RAID so just Press Enter two times to choose the default full size.
- Next press ‘p‘ to print the created partition.
- Change the Type, If we need to know the every available types Press ‘L‘.
- Here, we are selecting ‘fd‘ as my type is RAID.
- Next press ‘p‘ to print the defined partition.
- Then again use ‘p‘ to print the changes what we have made.
- Use ‘w‘ to write the changes.
After repeating these for all four disks, check for changes in all four drives sdb, sdc, sdd & sde.
mdadm -E /dev/sd[b-e]
Now Check for the RAID blocks in newly created partitions. If no super-blocks detected, than we can move forward to create a new RAID 5 setup on these drives.
mdadm --examine /dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1
mdadm -C /dev/md0 -l 5 -n 4 /dev/sd[b-h]1
After creating raid device, check and verify the RAID, devices included and RAID Level from the mdstat output.
watch -n1 cat /proc/mdstat refresh screen every 1 second.
After creation of raid, Verify the raid devices using the following command.
mdadm -E /dev/sd[b-h]
Next, verify the RAID array to assume that the devices which we’ve included in the RAID level are running and started to re-sync.
mdadm --detail /dev/md0
Create a file system for ‘md0‘ device using ext4 before mounting.
mkfs.ext4 -E lazy_itable_init=0,lazy_journal_init=0 /dev/md0
ext4 are still limited to 16 TB volumes, I decided to use
Now create a directory under ‘/mnt‘ then mount the created filesystem under /mnt/raid5 and check the files under mount point, you will see lost+found directory. If you use xfs filesystem, there’s no lost+directory directory
We need to add entry in fstab, else will not display our mount point after system reboot. To add an entry, we should edit the fstab file and append the following line as shown below. The mount point will differ according to your environment.
Next, run ‘mount -av‘ command to check whether any errors in fstab entry.
mdadm --detail --scan --verbose >> /etc/mdadm.conf