How can we remove RAID in Linux?

How can we remove RAID in Linux?

Redundant array of inexpensive disk is abbreviated as RAID. Here, the disk word is replaced with drive hence, represented as redundant array of inexpensive drives. In those days, it’s been shopped in high cost even if you want to buy a small amount of disk. But now, it is available for the same cost to buy high amount of disk. To make volume logically, you can mention as a pool of disk collection

In this article, let us see how to do RAID removal in Linux:

You would have created RAID 5 software in Linux before also placed it in directory for storage purpose. So, it is easy to do RAID removal by deactivating it simply.

Let us look on the setup status:

Code:
Operating system : CentOS release 6.5 (Final)

RAID device : /dev/md0

: md0 : active raid5 sdd1[4] sdc1[3] sdb1[1] sda1[0]
Status of RAID:

You will have anfour disk active known as md0 device.

Code:
[email protected] ~]# cat /proc/mdstat
Personalities : [raid6] [raid5] [raid4]
md0 : active raid5 sdd1[4] sdc1[3] sdb1[1] sda1[0]
      4189184 blocks super 1.2 level 5, 512k chunk, algorithm 2 [4/4] [UUUU]

unused devices:

[[email protected] ~]#mdadm --detail /dev/md0
/dev/md0:
Version : 1.2
  Creation Time : Wed Apr 21 01:47:10 2021
     Raid Level : raid5
     Array Size : 4189184 (4.00 GiB 4.29 GB)
  Used Dev Size : 2094592 (2045.84 MiB 2144.86 MB)
   Raid Devices : 4
  Total Devices : 4
Persistence : Superblock is persistent

    Update Time : Wed Apr 21 21:59:48 2021
State : clean
Code:
 Active Devices : 4
Working Devices : 4
Failed Devices : 0
  Spare Devices : 0

Layout : left-symmetric
    Chunk Size : 512K

Name : srv6:0  (local to host srv6)
UUID : 4e7c1751:cd467d3f:8e86a6a1:3c88f6a4
Events : 139

    Number   Major   Minor   RaidDevice State
       0       8        1        0      active sync   /dev/sda1
       1       8       17        1      active sync   /dev/sdb1
       3       8       33        2      active sync   /dev/sdc1
       4       8       49        3      active sync   /dev/sdd1
Let start the process of removing RAID 5 here:

It is a same process like as usual. Do take the RAID backup if needed and empty the space from filesystem.

Code:
[[email protected] ~]#df -hTP /raid5_disk/
FilesystemType  Size  Used Avail Use% Mounted on
/dev/md0       ext4  5.9G  213M  5.4G   4% /raid5_disk
[[email protected] ~]#umount /raid5_disk
[[email protected] ~]#sed -i '/md0/d' /etc/fstab
Now, execute the below command to remove RAID:

Code:
[[email protected] ~]#mdadm --stop /dev/md0
mdadm: stopped /dev/md0
Remove the device by executing below command:

Code:
mdadm --remove /dev/md0
More cases, you can’t easily remove the md device because it’s been stopped with the command of stop already:

Code:
[[email protected] ~]#mdadm  --stop /dev/md0
mdadm: stopped /dev/md0

[[email protected] ~]# cat /proc/mdstat
Personalities : [raid6] [raid5] [raid4]
unused devices:

[[email protected] ~]# ls -l /dev/md0
ls: cannot access /dev/md0: No such file or directory

[[email protected] ~]#mdadm --remove /dev/md0
mdadm: error opening /dev/md0: No such file or directory
Take a look on superblocks removal which is connected with the all the disk:

Code:
[[email protected] ~]#mdadm --zero-superblock /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1
Hence, it is not that much difficult activity to remove RAID 5 from Linux. Just by executing the command you can remove RAID easily from disk associated.
Author
kumkumsharma
Views
1,419
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from kumkumsharma

Top