How to create RAID5 with spare device in RHEL/CentOS? What is Spare device in CentOS/RHEL?

In this article, I will explain, ‘How we can create Raid5 with the spare disks?’ So here you will learn, what are the requirements to create RAID5 and you will also know about spare devices. Already I have discussed about Raid and its levels in my previous post. You can read it. Click here.

In this article, First of all, I will tell you about spare devices. ‘What are Spare Disk/Devices?’

Spare Disks are those which are not the primary disk of Raid level combination. These are secondary disk used for the purpose when a disk failures occur. As we all know disk failure is very harmful for every organization. So to prevent such damages Companies use Spare Disk. These disks look like normal disks. But these have little change in their functioning. Whenever a disk failure happens it can cause big harm to the company’s data so the company adds some extra inactive disk for storage. And when the disk failure occurs these inactive disks replace the faulty disk and become active for storage. So basically the function of these disks is that it replaces the failed device/disk by itself.

Now in this article, we will learn the process of configuring RAID5 step by step. So as per the requirements of the Raid5 level, we need 4 physical disks and these disks must have the same size. I’m performing this with a spare disk so I will need one more disk. You can add spare devices of your choice. Here I’m performing this task on virtual partitions of Linux. So I will create 3 partitions in Redhat Linux. You have to be very careful while performing this task. Let’s start our topic to watch all the steps very carefully.


1. To Check your disk information

[ root@rdsaini ~]# fdisk -l

2. Create Partitions in Linux 

[ root@rdsaini ~]#fdisk /dev/sda
  • Command (m for help)= n (type n here)
  • e or p ( type either e for extended partition and p for primary partition )
  • 2,3,4,…… ( type your partition no.)
  • First cylinder (XXXX-XXXX , default XXXX ) = press enter
  • +500M ( write size according to your wish or available size of disk)
  • command (m for help)= t (type t for change type of disk )
  • command (m for help)= w (type w for write disk changes)
  • command (m for help)= p (type p for to whether your disk partition is created or not)

3. Now You have to Reboot your system.

(reboot will be done by giving this command)

[ root@rdsaini ~]#partprobe /dev/sda

4. Create Raid Level Raid5 with Spare disk.

[ root@rdsaini ~]#mdadm --create /dev/md0 --level=0 --raid-devices=4 /dev/sda{5,6,7,8} --spare-devices=2 /dev/sda{2,3}

Full form of MDADM is “manage MD devices aka Linux Software RAID” ( according to mdadm manual page in linux ) 

  •  mdadm –create = It is the command to create RAID.
  • /dev/md0 = Name given to raid disk.
  •  –level = Level of disks.
  •  –raid-devices = No, of devices/disks.
  • /dev/sad{5,6,7,8} = Name and Location of disk partitions.
  •  –spare-devices = No. of spare devices.
  • /dev/sda{2,3} = Name and Location of Spare devices.

5. Check Raid level started or not?

[ root@rdsaini ~]#mdadm --details /dev/md0

6. Now, Format with a suitable format.

[ root@rdsaini ~]#mkfs.ext3 /dev/md0

7. Make a New Directory to Mount it.

[ root@rdsaini ~]#mkdir /Raid

8. Mount it on a directory.

[ root@rdsaini ~]#mount /dev/md0 /Raid

9. How to Remove Raid device.

[ root@rdsaini ~]#mdadm --stop /dev/md0
[ root@rdsaini ~]#mdadm --remove /dev/md0


In this post, we have learned how to create Raid5 with Spare devices. Guys if you have doubts or any queries with this post then don’t hesitate to contact me. And if you have any suggestions for me then please write to me in the comment box. If you like my posts please share it with your friends.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s