Skip to main content

Questions about RAID Creation [Resolved]

I'm currently working on a project that requires me to write a script to identify a set of drives added for the purpose of storage and install them as a RAID array. I'm having trouble finding information on the actual creation process though beyond the commands necessary.

  1. Do the drives I create the RAID from need to be formatted and partitioned first? Or does mdadm --create do this for you?

  2. I'm told that the project will support a variable number of drives. My boss suggested using RAID level 5, but unless I'm misunderstanding RAID levels, RAID level 5 requires at least 3 drives, where I think we're targeting using 2 to start. Do specific RAID levels have a minimum drive count?

  3. To add the RAID array to my fstab file, do I just assemble it? Or do I also need to mount it before/after it's assembled?

I've found a few tutorials on the setup process, but beyond that, I haven't really been able to dig up this information.

Question Credit: Darin Beaudreau
Question Reference
Asked March 17, 2019
Posted Under: Network
1 Answers

  1. If the disks have existing filesystems, you should remove them so you can start with disks without filesystems. First you create the array using mdadm, then you create the filesystem.
  2. RAID level 1 is 'mirroring' and you can create one with only 2 drives. RAID 5 requires a minimum of 3 drives as you have already stated, and RAID level 10 requires 4. RAID levels 0 and 1 only require a minimum of 2 drives.
  3. To add the array to /etc/fstab, just add a line like this: /dev/md0 /mnt/md0 ext4 defaults,nofail,discard 0 0

credit: Bert
Answered March 17, 2019
Your Answer