Sunday, July 30, 2017

Raid1 Cannot Remove Drive From Raid Array


First, check the mdadm status
cat /proc/mdstatus

then, run
lsblsk
to see the available drives ,and after choosing the drives to be part of RAID,let's say sda,sdb
sudo mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sda /dev/sdb
if one hard disk fail and you want to replace it, then you need to flag it as fail part of raid the remove it from the raid array:
    mdadm --manage /dev/md1 --fail /dev/sdb2

then you can remove it from the raid array
    mdadm --manage /dev/md1 --remove /dev/sdb2
if you want to remove Raid1 : Check the Raid status -- these may will give you clear picture :
sudo mdadm --detail /dev/md0
and 
lsblk

Then stop and remove the Raid
mdadm --stop /dev/md0
mdadm --remove /dev/md0

tell the drive sda to forget about raid
sudo mdadm --zero-superblock /dev/sda/

if the system complain for being busy or such then
sudo dd if=/dev/zero of=/dev/sda
finally unmount the raid in the fstab file and comment it in the /etc/mdadm/mdadm.conf

No comments:

Post a Comment