在生产环境中,RAID磁盘阵列部署后一般不会被轻易停用。但还是要知道怎么将磁盘阵列删除。前面那种RAID 5+热备盘损坏的情况是比较复杂的,所以以这种情形来进行讲解是再好不过了。

本次实验是承接上文raid5

停用所有磁盘

首先,需要将所有的磁盘都设置成停用状态:

[root@53 ~]# mdadm /dev/md0 -f /dev/sdc
mdadm: set /dev/sdc faulty in /dev/md0
[root@53 ~]# mdadm /dev/md0 -f /dev/sdd
mdadm: set /dev/sdd faulty in /dev/md0
[root@53 ~]# mdadm /dev/md0 -f /dev/sde
mdadm: set /dev/sde faulty in /dev/md0
[root@53 ~]# mdadm /dev/md0 -f /dev/sdb
mdadm: set /dev/sdb faulty in /dev/md0

逐一移除磁盘

[root@53 ~]# mdadm /dev/md0 -r /dev/sdb
mdadm: hot removed /dev/sdb from /dev/md0
[root@53 ~]# mdadm /dev/md0 -r /dev/sdc
mdadm: hot removed /dev/sdc from /dev/md0
[root@53 ~]# mdadm /dev/md0 -r /dev/sdd
mdadm: hot removed /dev/sdd from /dev/md0
[root@53 ~]# mdadm /dev/md0 -r /dev/sde
mdadm: hot removed /dev/sde from /dev/md0

查看磁盘阵列组状态

[root@53 ~]#  mdadm -D /dev/md0
/dev/md0:
           Version : 1.2
     Creation Time : Wed Jul 27 02:40:56 2022
        Raid Level : raid5
        Array Size : 41908224 (39.97 GiB 42.91 GB)
     Used Dev Size : 20954112 (19.98 GiB 21.46 GB)
      Raid Devices : 3
     Total Devices : 0
       Persistence : Superblock is persistent

       Update Time : Wed Jul 27 03:18:15 2022
             State : clean, FAILED 
    Active Devices : 0
    Failed Devices : 0
     Spare Devices : 0

            Layout : left-symmetric
        Chunk Size : 512K

Consistency Policy : resync

    Number   Major   Minor   RaidDevice State
       -       0        0        0      removed
       -       0        0        1      removed
       -       0        0        2      removed

停用整个磁盘阵列

[root@53 ~]# mdadm --stop /dev/md0
mdadm: stopped /dev/md0
[root@53 ~]# ls /dev/md0
ls: 无法访问/dev/md0: 没有那个文件或目录

注释fstab

[root@53 ~]# vi /etc/fstab 
# /etc/fstab
# Created by anaconda on Thu May  6 03:04:18 2021
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
/dev/mapper/centos-root /                       xfs     defaults        0 0
UUID=087c7d4c-a364-4f57-8803-ac2927618cca /boot                   xfs     defaults        0 0
/dev/mapper/centos-home /home                   xfs     defaults        0 0
/dev/mapper/centos-swap swap                    swap    defaults        0 0
#/dev/storage/vo  /dosbat  ext4  defaults 0  0
#/dev/md0 /RAID10 ext4 defaults 0 0
#/dev/md0 /RAID5 ext4 defaults 0 0  #注释启动项

#后记

最后修改:2022 年 07 月 27 日
如果觉得我的文章对你有用,请随意赞赏