Remove software RAID device using mdadm
Removing one mdraid device/partition is quite easy. This process should not require reboot (but it is still recommended). Note: this process will make your data unreadable.
Step 1: Identify the RAID device
First, you need to identify the RAID device that you want to remove. You can list all RAID devices using the following command:
cat /proc/mdstatNote down which RAID device (mdX) you want to remove. Also note its disk partitions (you can also list them using the lsblk command).
Step 2: Unmount the RAID partition (if mounted) and edit /etf/fstab
If the to-be-removed-device contains any partition currently mounted to your system, unmount it.
sudo umount /some/partitionNow remove the partition from /etc/fstab so it the system won’t try to mount it after the next reboot.
Step 3: Stop the RAID Device and remove it from /etc/mdadm/mdadm.conf
Now stop the RAID device using the mdadm tool.
sudo mdadm --stop /dev/mdXNow edit the mdadm config file (/etc/mdadm/mdadm.conf) and remove the device from there.
Step 4: Remove the RAID Device
You can remove the RAID device
sudo mdadm --remove /dev/mdXNote: if this won’t command gives an error about non-existing device, reboot the system and remove the raid afterwards.
Step 5: Remove RAID superblocks
Now you should zero the superblocks on the individual disks that were part of the RAID. This can prevent them from being automatically reassembled into a RAID array in the future. Remember — you do this on the disk partitions (/dev/sdX) and NOT on the RAID device (/dev/mdX).
sudo mdadm --zero-superblock /dev/sdX1 /dev/sdX2Optional: overwrite disks with random data
If you want to try to remove the data from disk, you can rewrite it using dd.
dd if=/dev/urandom bs=4096 of=/dev/sdXNote1: you can use /dev/random on the systems like Debian 11+ and Ubuntu 22.04+, since it is non-blocking there.
Get Simon Berka’s stories in your inbox
Join Medium for free to get updates from this writer.
Note2: this is not a secure way of erasing data, especially on NVMe drives.
This story was originally published on DevOps Advocate — How to remove mdraid.







