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)
上一篇 2016-07-29 15:23
下一篇 2016-07-29 15:23

相关推荐

  • 利用nginx实现基于传输层的四层负载均衡

    nginx利用ngx_stream_core_module实现四层的负载均衡服务。作为四层负载均衡nginx和lvs的区别在于: lvs工作于内核层,相对来说效率更高,性能更强; nginx工作于用户空间; lvs不会受到套接字数量的限制; nginx作为四层负载均衡也需要监听套接字来和客户端,后台服务器进行连接,会受到套接字数量限制,不过这个问题可以通过k…

    2017-07-03
  • Linux文件管理相关及命令别名、执行状态等

    Linux文件管理相关命令有:cp,mv,rm         文件查看类命令有:cat,tac,head,tail,more,less         接下来,逐个介绍:   &…

    Linux干货 2016-11-04
  • 用户管理类命令

    2018-03-18

    Linux干货 2018-03-18
  • LVS-net模型

    net模型拓扑图 注:rip的网关需指向DIP 搭建LVS net模式 基于httpd服务 首先准备三台主机 主机A 主机B 主机C 主机A(vs主机) 主机A设置两个IP 一个内网一个外网 #yum -y install ipvsadm #echo 1 > /proc/sys/net/ipv4/ip_forward :打开核心转发功能 #iptabl…

    Linux干货 2017-05-17
  • Linux磁盘管理基础

    Linux磁盘管理基础 硬盘结构 文件系统与MBR、GTP 磁盘管理三步骤:分区、格式化、挂载 mount 硬盘结构 硬盘的基本组成材质是盘片,不同容量硬盘的盘片数不等。每个盘片有两面,都可记录信息。盘片表面上以盘片中心为圆心,不同半径的同心圆称为磁道,不同盘片相同半径的磁道所组成的圆柱称为柱面,每个磁道被分成许多扇形的区域,每个区域叫一个扇区,每个扇区可存…

    Linux干货 2016-09-01
  • N25第六周作业

    vim编辑器 基本模式: 编辑模式,命令模式 输入模式 末行模式: 内置的命令行接口;   打开文件: # vim [options] [file ..] +#:打开文件后,直接让光标处于第#行的行首; +/PATTERN:打开文件后,直接让光标处于第一个被PATTERN匹配到的行的行首;   模式转换: 编辑模式:默认模式 编辑模式 &…

    Linux干货 2017-02-15