You must have seen my earlier post about replacing faulty disk in Linux raid , however if something goes wrong with system sometimes you need to stop and delete Linux Raid array. We will go first about how we can stop linux raid array. here is sample output of status of Raid array:
[root@rhel1 ~]# mdadm -D /dev/md1 /dev/md1: Version : 1.2 Creation Time : Wed Dec 7 19:05:53 2016 Raid Level : raid5 Array Size : 2087936 (2039.34 MiB 2138.05 MB) Used Dev Size : 1043968 (1019.67 MiB 1069.02 MB) Raid Devices : 3 Total Devices : 3 Persistence : Superblock is persistent Update Time : Wed Dec 7 19:35:56 2016 State : clean Active Devices : 3 Working Devices : 3 Failed Devices : 0 Spare Devices : 0 Layout : left-symmetric Chunk Size : 512K Name : rhel1.lab.com:1 (local to host rhel1.lab.com) UUID : fcef1f48:223e87c7:53e9eecc:d5f55e79 Events : 68 Number Major Minor RaidDevice State 0 8 33 0 active sync /dev/sdc1 4 8 49 1 active sync /dev/sdd1 3 8 65 2 active sync /dev/sde1 [root@rhel1 ~]#
Now stop Linux Raid array using below command:
[root@rhel1 ~]# mdadm -vS /dev/md1 mdadm: stopped /dev/md1 [root@rhel1 ~]#
Now if you check status of array system responds with below message:
[root@rhel1 ~]# mdadm -D /dev/md1 mdadm: cannot open /dev/md1: No such file or directory [root@rhel1 ~]#
Now to delete array you need to stop the array first using below command:
[root@rhel1 ~]# mdadm -vS /dev/md1 mdadm: stopped /dev/md1
Then remove or delete the Raid array using below mdam command:
[root@rhel1 ~]# mdadm --remove /dev/md1
and then finally remove the superblocks from all associated disks with below command:
[root@rhel1 ~]# mdadm --zero-superblock /dev/sdc1 /dev/sdd1 /dev/sde1
You should also remove the partitions created for the RAID array. Don’t forget to use fdisk (or parted) to verify that the partitions have been removed successfully.This is important so that all data can be trashed.