vsphere虚拟机下的Linux在线移除硬盘后的报错处理(基于LVM)

1)故障描述( vmware虚拟机,在线移除一块被设置为pv格式的硬盘后,提示unknown device错误):

说明:/dev/sdb1 /dev/sdc1 /dev/sdd1是组成/dev/vg_test/lvm_test的PV,这里我们模拟/dev/sdd1硬盘被直接断电了

[root@docker mnt]# pvdisplay 
  /dev/sdd: read failed after 0 of 4096 at 0: Input/output error
  /dev/sdd: read failed after 0 of 4096 at 21474770944: Input/output error
  /dev/sdd: read failed after 0 of 4096 at 21474828288: Input/output error
  /dev/sdd: read failed after 0 of 4096 at 4096: Input/output error
  /dev/sdd1: read failed after 0 of 512 at 21467824128: Input/output error
  /dev/sdd1: read failed after 0 of 512 at 21467938816: Input/output error
  /dev/sdd1: read failed after 0 of 512 at 0: Input/output error
  /dev/sdd1: read failed after 0 of 512 at 4096: Input/output error
  /dev/sdd1: read failed after 0 of 2048 at 0: Input/output error
  Couldn't find device with uuid 166hLZ-2POl-GIsv-ELGh-8YVT-Zcoa-ZcLXzp.
  --- Physical volume ---
  PV Name               /dev/sdb1
  VG Name               vg_test
  PV Size               19.99 GiB / not usable 1.43 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              5118
  Free PE               0
  Allocated PE          5118
  PV UUID               fuQdIY-qkJw-fZJB-AauO-Zqpj-91RI-S1GG0X
   
  --- Physical volume ---
  PV Name               /dev/sdc1
  VG Name               vg_test
  PV Size               19.99 GiB / not usable 1.43 MiB
  Allocatable           yes 
  PE Size               4.00 MiB
  Total PE              5118
  Free PE               5116
  Allocated PE          2
  PV UUID               TRlpMQ-snM6-u24f-cMHa-oiVt-XJ3w-6fjAbp
   
  --- Physical volume ---
  PV Name               unknown device
  VG Name               vg_test
  PV Size               19.99 GiB / not usable 1.43 MiB
  Allocatable           yes 
  PE Size               4.00 MiB
  Total PE              5118
  Free PE               5118
  Allocated PE          0
  PV UUID               166hLZ-2POl-GIsv-ELGh-8YVT-Zcoa-ZcLXzp

2)处理步骤:

[root@docker mnt]# vgreduce --removemissing vg_test
  /dev/sdd: read failed after 0 of 4096 at 0: Input/output error
  /dev/sdd1: read failed after 0 of 2048 at 0: Input/output error
  /dev/sdd: read failed after 0 of 4096 at 21474770944: Input/output error
  /dev/sdd: read failed after 0 of 4096 at 21474828288: Input/output error
  /dev/sdd: read failed after 0 of 4096 at 4096: Input/output error
  /dev/sdd1: read failed after 0 of 512 at 21467824128: Input/output error
  /dev/sdd1: read failed after 0 of 512 at 21467938816: Input/output error
  /dev/sdd1: read failed after 0 of 512 at 0: Input/output error
  /dev/sdd1: read failed after 0 of 512 at 4096: Input/output error
  Couldn't find device with uuid 166hLZ-2POl-GIsv-ELGh-8YVT-Zcoa-ZcLXzp.
  Wrote out consistent volume group vg_test
[root@docker mnt]# vgchange -a y
  /dev/sdd: read failed after 0 of 4096 at 0: Input/output error
  /dev/sdd1: read failed after 0 of 2048 at 0: Input/output error
  1 logical volume(s) in volume group "vg_test" now active
[root@docker mnt]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda3             193G   14G  170G   8% /
tmpfs                 1.9G  228K  1.9G   1% /dev/shm
/dev/sda1             190M   80M  100M  45% /boot
/dev/mapper/vg_test-lvm_test
                       20G   28M   19G   1% /mnt

测试表明:整个过程都不会影响/mnt中的数据运行

[root@docker mnt]# pvdisplay 
  /dev/sdd: read failed after 0 of 4096 at 0: Input/output error
  /dev/sdd: read failed after 0 of 4096 at 21474770944: Input/output error
  /dev/sdd: read failed after 0 of 4096 at 21474828288: Input/output error
  /dev/sdd: read failed after 0 of 4096 at 4096: Input/output error
  /dev/sdd1: read failed after 0 of 512 at 21467824128: Input/output error
  /dev/sdd1: read failed after 0 of 512 at 21467938816: Input/output error
  /dev/sdd1: read failed after 0 of 512 at 0: Input/output error
  /dev/sdd1: read failed after 0 of 512 at 4096: Input/output error
  /dev/sdd1: read failed after 0 of 2048 at 0: Input/output error
  --- Physical volume ---
  PV Name               /dev/sdb1
  VG Name               vg_test
  PV Size               19.99 GiB / not usable 1.43 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              5118
  Free PE               0
  Allocated PE          5118
  PV UUID               fuQdIY-qkJw-fZJB-AauO-Zqpj-91RI-S1GG0X
   
  --- Physical volume ---
  PV Name               /dev/sdc1
  VG Name               vg_test
  PV Size               19.99 GiB / not usable 1.43 MiB
  Allocatable           yes 
  PE Size               4.00 MiB
  Total PE              5118
  Free PE               5116
  Allocated PE          2
  PV UUID               TRlpMQ-snM6-u24f-cMHa-oiVt-XJ3w-6fjAbp

发现仍旧有I/O的错误出现,找到合适停机窗口,重启了系统,故障得到解决(这里注意重启前检查fstab信息,看下mount -a是否有报错)。

[root@docker ~]# pvdisplay 
  --- Physical volume ---
  PV Name               /dev/sdb1
  VG Name               vg_test
  PV Size               19.99 GiB / not usable 1.43 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              5118
  Free PE               0
  Allocated PE          5118
  PV UUID               fuQdIY-qkJw-fZJB-AauO-Zqpj-91RI-S1GG0X
   
  --- Physical volume ---
  PV Name               /dev/sdc1
  VG Name               vg_test
  PV Size               19.99 GiB / not usable 1.43 MiB
  Allocatable           yes 
  PE Size               4.00 MiB
  Total PE              5118
  Free PE               5116
  Allocated PE          2
  PV UUID               TRlpMQ-snM6-u24f-cMHa-oiVt-XJ3w-6fjAbp

这样,系统就已经没有报错信息了。

原创文章,作者:Net21-冰冻vs西瓜,如若转载,请注明出处:http://www.178linux.com/26670

(1)
Net21-冰冻vs西瓜Net21-冰冻vs西瓜
上一篇 2016-07-29
下一篇 2016-07-29

相关推荐

  • Linux文本处理工具之grep

    简介     grep:Global search regular expression and print out the line.     grep是一种文本搜索处理工具,根据用户指定的文本模式或搜索条件对目标文件进行逐行搜索,并显示能匹配到的行。   …

    Linux干货 2015-05-12
  • 2016/10/14作业

    2016/10/14作业: ##操作类: 1. 设置自己的终端提示符,要求字符终端登录时: a> 需要带颜色  b> 需要显示当前执行到了第几条命令  c> 显示当前登录终端,主机名和当前时间 答:要在用户登录时终端提示符,需要更改当前系统的环境变量: /etc/bashrc文件 #[ "$PS1" …

    Linux干货 2016-10-19
  • 系统启动和内核管理以及几个重要实验

    Centos启动流程:     1.加载BIOS的硬件信息,获取第一个启动设备     2.读取第一个启动设备MBR的引导加载程序(grub)的启动信息     3.加载核心操作系统的核心信息,核心开始解压缩,并尝试驱动所有的硬件设备 &n…

    Linux干货 2017-05-15
  • Linux基础之RAID

    一.RAID介绍 RAID刚开始出现的时候叫做廉价磁盘冗余阵列(Redundant Array of Inexpensive Disks),但在当时磁盘并非像现在这么便宜,反而这种组合方式使得代价非常昂贵,所以后来改名为独立磁盘冗余阵列(Redundant Array of Independent Disks),基本的思想就是组合组合多个便宜的,性能相对较低…

    Linux干货 2016-11-08
  • N26 第六周博客作业

    请详细总结 vim 编辑器的使用并完成以下练习题 ## VIM 使用总结 首先 VIM 是 VI IMproved 的缩写,是 vi 编辑器的增强型。它与 sed awk 并称为文本处理三剑客。其主要作者 Bram Moolenaar 也是个非常有爱心的人,在 vim 的[官网](http://www.vim.org/) 和 在命令行中直接输入 vim 的命…

    Linux干货 2017-03-11
  • 系统基础之vim工具详解

    vim工具详解 作为运维人员,每天要面对大量的文件操作,如何使用一个功能强大,操作快捷的文本编辑器,就至关重要.那天,今天给大家详细的介绍下vim这款编辑器,完全符合我们的要求,下面让我们一起来看看吧! 概论:  文本编辑器:  文本:纯文本信息,   ASCII text:  纯粹的,不加修饰的文字  文本…

    Linux干货 2016-08-10