How to Remove mdadm RAID Devices

Step 1: Unmount and Remove all Filesystems
Use umount, lvremove and vgremove to make sure all filesystems have been unmounted and you have exclusive access to the disk.

Removing an Logical Volume

lvremove /dev/2tbdatavg/install-images

Example Output

Do you really want to remove active logical volume install-images? [y/n]: y
Logical volume “install-images” successfully removed

Removing an Volume Group

vgremove 2tbdatavg

Example Output

Volume group “2tbdatavg” successfully removed

Step 2: Determine mdadm RAID Devices

cat /proc/mdstat


Example Output

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>

Be sure to make a note of the disks that are part of your RAID group. You will need the names for step 5.

Step 3: Stop mdadm RAID Device

mdadm --stop /dev/md1

Example Output

mdadm: stopped /dev/md1

Step 4: Remove mdadm RAID Device

mdadm --remove /dev/md1

If you receive the error below continue to Step 5.

mdadm: error opening md1: No such file or directory

Step 5: Remove the Superblocks

mdadm --zero-superblock /dev/sdf1 /dev/sde1

Step 6: Verify RAID Device Was Removed

cat /proc/mdstat

The /dev/md1 RAID device was removed


Personalities : [raid10] [raid1]
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: &lt;none&gt;
文档更新时间: 2023-04-28 06:03   作者:月影鹏鹏
IT运维支持-AIWALY-月影工作室