Removal of mdadm RAID Devices is quite easy. It involves a quick 6 steps.
As part of our Server Management Sevices, we assist our customers with several Mdadm queries.
Today, let us see how our support techs remove the same.
Removal of mdadm RAID Devices
In order to remove the mdadm RAID Devices our Support Techs recommend the following steps:
Step 1: Unmount and Remove all Filesystems
We need to make sure all filesystems have been unmounted. For that, we use umount. It also ensures we have exclusive access to the disk.
umount /dev/md1
Step 2: Determine mdadm RAID Devices
To do so, we run the following command:
cat /proc/mdstat For example, the output will be like this:
md1 : active raid1 sdf1[1] sde1[0] 2929555456 blocks super 1.2 [2/2] [UU] bitmap: 0/22 pages [0KB], 65536KB chunk md0 : active raid10 sda1[3] sdd1[1] sdb1[0] sdc1[2] 976502784 blocks super 1.2 512K chunks 2 near-copies [4/4] [UUUU] unused devices: <none>
Now, we need to make sure we take a note of the disks that are part of the RAID group.
When we proceed to step 5, we will need the names.
Step 3: Stop mdadm RAID Device
Our next step is to stop the device.
mdadm --stop /dev/md1
For example, the output will look similar to this:
mdadm: stopped /dev/md1
Step 4: Remove mdadm RAID Device
mdadm --remove /dev/md1
At time, we may come across the following error:
mdadm: error opening md1: No such file or directory
Then, we go ahead with the following step.
Step 5: Remove the Superblocks
mdadm --zero-superblock /dev/sdf1 /dev/sde1
Step 6: Verify RAID Device Was Removed
Finally, we use lsblk and cat /proc/mdstat and confirm there are no active RAID devices.
lsblk
cat /proc/mdstat
Furthermore, we have to delete the mount point from /etc/fstab as well as remove the RAID configuration from /etc/mdadm/mdadm.conf to prevent problems in the future.
We can remove the mount point from the /etc/fstab file as seen here:
sudo sed -i '/\/dev\/md1/d' /etc/fstab
The RAID configuration from /etc/mdadm/mdadm.conf can be removed to prevent RAID from being automatically assembled:
sudo rm /etc/mdadm/mdadm.conf
By following these steps, you can safely remove an mdadm RAID device and ensure that it is no longer active or interfering with other disk operations.
[Need further help? We are here to assist you]
Conclusion
To conclude, here, we saw how our Support Techs perform the removal of mdadm RAID Devices.
PREVENT YOUR SERVER FROM CRASHING!
Never again lose customers to poor server speed! Let us help you.
Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.
Great explanation – commendable – short sweet and to the point! However, needed to go to man mdadm to verify that instead of a single dash on the above command options, a double dash is necessary to execute the full command.
You forgot to mention 2 things:
a. Make sure the mount point is also deleted from /etc/fstab
b. Remember to delete /etc/mdadm/mdadm.conf
I remembered the first bit when the server choked after I rebooted it. I remembered the second bit after I rebooted another server and the RAID array miraculously came back 🙂
YOU JUST SAVED ME! I just spent 3 hours hunting how to undo all this. Great tutorial!
Hi Scott,
Thanks for the feedback.We are glad to know that our article helps you solves the issue ?
After stoppping the raid-array the –remove won’t work and –remove is not used to removed raid-devices, but individual members. The step with the zero-superblock gives errors about not being able to open the drive for writing. Better use wipefs there as this will wipe the raid-signature (the superblock) but also any partition/filesystem markers on the device.