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.www58058.com/26670

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

相關推薦

  • 馬哥教育網絡班21期+第四周課程練習

    1、復制/etc/skel目錄為/home/tuser1,要求/home/tuser1及其內部文件的屬組和其它用戶均沒有任何訪問權限; [root@localhost /]# cp -r /etc/skel /home/tuser1 [root@localhost /]# chmod&nb…

    Linux干貨 2016-07-22
  • mysql-proxy 讀寫分離

    1. 簡介     mysql-proxy 是官方為此的一個測試,項目, 可以完成讀寫分離。但是項目目前還不是很成熟,這里僅作測試。  2. mysql-proxy安裝部署 # wget http://downloads.mysql.com/archives/get/file/mysql-…

    Linux干貨 2015-12-21
  • bash 循環語句for、while、until

    循環執行 循環執行     定義:將某段代碼有次數或無次數循環執行多次。     構成要素:退出條件和進入條件     循環的三種語句:for、while、until for循環:      &nbs…

    Linux干貨 2016-08-21
  • SecureCRT 8.0的安裝及Linux基本命令介紹

    在CentOS虛擬中安裝并打開圖形界面后,可以在圖形界面和命令行界面之間任意切換。在打開終端后輸入init3可以切換至命令行界面,輸入init5返回到圖形界面。 這里我們用SecureCRT 8.0來遠程的對虛擬機進行操作,對于SecureCRT 8.0的安裝步驟就不詳細介紹,簡單介紹下如何連接到CentOS。 1. 2.點擊完成。   &nbsp…

    2017-07-13
  • PXE實踐

    本篇只以記錄個人部署pxe過程中所遇問題,至于原理,只做部分簡單說明。 pxe部署必要軟件: syslinux (用于提供引導中所必備文件) tftp(用于提供存放vmlinuz,initrd,syslinux.0等引導類文件) dhcp(用于自動獲取IP包括指明去哪個主機獲取syslinux.0文件) 最后還需要一個web或者ftp服務,已提供系統安裝中所…

    Linux干貨 2017-02-05
  • kickstart+ftp+dhcp+tftp實現centos6的無人值守安裝

    環境IP : 172.16.0.32 centos 6.6 一.安裝相關包 安裝圖形界面 [root@localhost ~]# yum groupinstall “Desktop” “X Window System” “Chinese Support” [root@localhost ~]# yum -y install dhcp tftp-server …

    Linux干貨 2017-06-03
欧美性久久久久