CentOS 6 LVM RAID5,无法激活 VG/LV。“设备映射器:重新加载 ioctl(253:119)失败:输入/输出错误”

CentOS 6 LVM RAID5,无法激活 VG/LV。“设备映射器:重新加载 ioctl(253:119)失败:输入/输出错误”

在一次临时设备故障和在此期间遇到一个坏块后,我发现自己陷入了复杂的 Linux LVM-RAID5 / 设备映射器问题。由于似乎是底层设备映射器错误,逻辑卷现在无法激活。

什么:

  • CentOS 6.10系统
  • 4 个磁盘(SATA)卷组(vg03),/dev/sd[a,b,c,d]
  • RAID5 中的单个逻辑卷(lvol1)。

时间线:我不在,还没来得及解决一个问题,第二个问题又出现了。

  • /dev/sdc 上的物理卷处于离线状态,后来恢复
  • /dev/sdc 出现故障之后,但在恢复之前,/dev/sdb 遇到了离线无法纠正扇区的 SMART 错误。
  • 当时,逻辑卷 /dev/vg03/lvol1 访问失败,所有文件读取均出现 i/o 错误。
  • /dev/sdc 是通过在机箱中物理重新安装来恢复的。
  • 逻辑卷无法再被激活

我做了一个vgextend --restoremissing /dev/sdc成功的,VG 不再抱怨 PV 丢失。但 LV 仍然无法激活。说实话,LVM 整体现在看起来很不错。vg 配置转储报告所有 rimage 和 rmeta 卷可见。事实上,vg 配置转储看起来与一切正常时进行的备份完全相同。

尽管卷组完整且所有 rimage 和 rmeta 组件均可访问,但激活逻辑卷的尝试均会失败,如下所示:

[root@fw log]# vgchange -a y vg03
  device-mapper: reload ioctl on (253:119) failed: Input/output error
  0 logical volume(s) in volume group "vg03" now active
[root@fw log]# lvchange -a y /dev/vg03/lvol1
  device-mapper: reload ioctl on (253:119) failed: Input/output error
[root@fw log]# lvchange -a y --activationmode partial /dev/vg03/lvol1
  PARTIAL MODE. Incomplete logical volumes will be processed.
  device-mapper: reload ioctl on (253:119) failed: Input/output error
[root@fw log]# lvchange -a y --activationmode degraded /dev/vg03/lvol1
  device-mapper: reload ioctl on (253:119) failed: Input/output error

问题似乎出在设备映射器将 rimage 和 rmeta 组件重建为可用的 RAID5 数据集。

我猜测:

  • rimage3 离线后,RAID 阵列性能下降,但仍然可用。
  • 然后 rimage2 遇到了一个不可读的块,并且整个 rimage 被标记为脏
  • rimage3 现已返回,但是由于 RAID 寿命在它离开时继续,因此设备映射器现在认为该 RAID 组件已过时且不可用。

dmesg 输出表明 4 个设备中只有 2 个存在,尽管 vgchange -vvvv 输出显示找到了所有 4 个 rimage 和 rmeta 卷 - 并且我甚至可以dd毫无问题地读取它们的内容。

在底部记录部分内容以免污染叙述。

我看到了类似的情况(但针对的是启动 LV),Max Ehrlich 回答说将以下内容添加到内核参数中以恢复脏的 RAID LV。 md-mod.start_dirty_degraded=1不幸的是,这并没有改变任何行为。

所以..如果有谁更熟悉设备映射器,可以提供任何指导,关于激活具有两个完整组件和一个脏组件或一个陈旧组件的 Linux RAID5 逻辑卷?

在整个时间段内,文件系统上的数据实际上没有变化,而且实际上,即使一个成员上有坏块,我预计它应该可以再次重建。该过时卷仅在时间戳上过时,而不是数据内容。

更改-vvvv-ay

#libdm-deptree.c:570         Matched uuid LVM-NYeT7Gk1h6roCjIRVRdM3YQAoyuBcECFhAiMp10vcg5xfyRWcZ00bC4Xm7RiPXGv in deptree.
#libdm-deptree.c:570         Matched uuid LVM-NYeT7Gk1h6roCjIRVRdM3YQAoyuBcECFhAiMp10vcg5xfyRWcZ00bC4Xm7RiPXGv in deptree.
#activate/dev_manager.c:2575         Checking kernel supports striped segment type for vg03/lvol1_rmeta_0
#metadata/metadata.c:2516         Calculated readahead of LV lvol1_rmeta_0 is 256
#libdm-deptree.c:570         Matched uuid LVM-NYeT7Gk1h6roCjIRVRdM3YQAoyuBcECFuF9rQHu65xgUwdaP8AmJdLczSgj8dr5m in deptree.
#libdm-deptree.c:570         Matched uuid LVM-NYeT7Gk1h6roCjIRVRdM3YQAoyuBcECFuF9rQHu65xgUwdaP8AmJdLczSgj8dr5m in deptree.
#activate/dev_manager.c:2575         Checking kernel supports striped segment type for vg03/lvol1_rimage_1
#metadata/metadata.c:2516         Calculated readahead of LV lvol1_rimage_1 is 256
#libdm-deptree.c:570         Matched uuid LVM-NYeT7Gk1h6roCjIRVRdM3YQAoyuBcECFJTFmG1s0VFNDeZdEwzOPjpvyiZhkWocv in deptree.
#libdm-deptree.c:570         Matched uuid LVM-NYeT7Gk1h6roCjIRVRdM3YQAoyuBcECFJTFmG1s0VFNDeZdEwzOPjpvyiZhkWocv in deptree.
#activate/dev_manager.c:2575         Checking kernel supports striped segment type for vg03/lvol1_rmeta_1
#metadata/metadata.c:2516         Calculated readahead of LV lvol1_rmeta_1 is 256
#libdm-deptree.c:570         Matched uuid LVM-NYeT7Gk1h6roCjIRVRdM3YQAoyuBcECFbXrEcOcr4bs0ldIuifV0GQchgVd1T3jr in deptree.
#libdm-deptree.c:570         Matched uuid LVM-NYeT7Gk1h6roCjIRVRdM3YQAoyuBcECFbXrEcOcr4bs0ldIuifV0GQchgVd1T3jr in deptree.
#activate/dev_manager.c:2575         Checking kernel supports striped segment type for vg03/lvol1_rimage_2
#metadata/metadata.c:2516         Calculated readahead of LV lvol1_rimage_2 is 256
#libdm-deptree.c:570         Matched uuid LVM-NYeT7Gk1h6roCjIRVRdM3YQAoyuBcECFjKHZikMCfUSAcWsdgoon4zHezd6eP149 in deptree.
#libdm-deptree.c:570         Matched uuid LVM-NYeT7Gk1h6roCjIRVRdM3YQAoyuBcECFjKHZikMCfUSAcWsdgoon4zHezd6eP149 in deptree.
#activate/dev_manager.c:2575         Checking kernel supports striped segment type for vg03/lvol1_rmeta_2
#metadata/metadata.c:2516         Calculated readahead of LV lvol1_rmeta_2 is 256
#libdm-deptree.c:570         Matched uuid LVM-NYeT7Gk1h6roCjIRVRdM3YQAoyuBcECF86L9mwnSyHLlDbDd6YfmwPddLBcQyHYT in deptree.
#libdm-deptree.c:570         Matched uuid LVM-NYeT7Gk1h6roCjIRVRdM3YQAoyuBcECF86L9mwnSyHLlDbDd6YfmwPddLBcQyHYT in deptree.
#activate/dev_manager.c:2575         Checking kernel supports striped segment type for vg03/lvol1_rimage_3
#metadata/metadata.c:2516         Calculated readahead of LV lvol1_rimage_3 is 256
#libdm-deptree.c:570         Matched uuid LVM-NYeT7Gk1h6roCjIRVRdM3YQAoyuBcECFb8QDktJ3UeEXm5d0xAyPjqQOY4anOPLO in deptree.
#libdm-deptree.c:570         Matched uuid LVM-NYeT7Gk1h6roCjIRVRdM3YQAoyuBcECFb8QDktJ3UeEXm5d0xAyPjqQOY4anOPLO in deptree.
#activate/dev_manager.c:2575         Checking kernel supports striped segment type for vg03/lvol1_rmeta_3
#metadata/metadata.c:2516         Calculated readahead of LV lvol1_rmeta_3 is 256
#libdm-deptree.c:570         Matched uuid LVM-NYeT7Gk1h6roCjIRVRdM3YQAoyuBcECFhAiMp10vcg5xfyRWcZ00bC4Xm7RiPXGv in deptree.
#libdm-deptree.c:570         Matched uuid LVM-NYeT7Gk1h6roCjIRVRdM3YQAoyuBcECFval0zTemeWZL2fu7nyWm1MBlktzPjIO6 in deptree.
#libdm-deptree.c:570         Matched uuid LVM-NYeT7Gk1h6roCjIRVRdM3YQAoyuBcECFJTFmG1s0VFNDeZdEwzOPjpvyiZhkWocv in deptree.
#libdm-deptree.c:570         Matched uuid LVM-NYeT7Gk1h6roCjIRVRdM3YQAoyuBcECFuF9rQHu65xgUwdaP8AmJdLczSgj8dr5m in deptree.
#libdm-deptree.c:570         Matched uuid LVM-NYeT7Gk1h6roCjIRVRdM3YQAoyuBcECFjKHZikMCfUSAcWsdgoon4zHezd6eP149 in deptree.
#libdm-deptree.c:570         Matched uuid LVM-NYeT7Gk1h6roCjIRVRdM3YQAoyuBcECFbXrEcOcr4bs0ldIuifV0GQchgVd1T3jr in deptree.
#libdm-deptree.c:570         Matched uuid LVM-NYeT7Gk1h6roCjIRVRdM3YQAoyuBcECFb8QDktJ3UeEXm5d0xAyPjqQOY4anOPLO in deptree.
#libdm-deptree.c:570         Matched uuid LVM-NYeT7Gk1h6roCjIRVRdM3YQAoyuBcECF86L9mwnSyHLlDbDd6YfmwPddLBcQyHYT in deptree.
#libdm-deptree.c:2693     Loading vg03-lvol1_rmeta_0 table (253:111)
#libdm-deptree.c:2637         Adding target to (253:111): 0 8192 linear 8:48 2048
#ioctl/libdm-iface.c:1838         dm table   (253:111) OF   [16384] (*1)
#libdm-deptree.c:2728     Suppressed vg03-lvol1_rmeta_0 (253:111) identical table reload.
#libdm-deptree.c:2693     Loading vg03-lvol1_rimage_0 table (253:112)
#libdm-deptree.c:2637         Adding target to (253:112): 0 7507812352 linear 8:48 10240
#ioctl/libdm-iface.c:1838         dm table   (253:112) OF   [16384] (*1)
#libdm-deptree.c:2728     Suppressed vg03-lvol1_rimage_0 (253:112) identical table reload.
#libdm-deptree.c:2693     Loading vg03-lvol1_rmeta_1 table (253:113)
#libdm-deptree.c:2637         Adding target to (253:113): 0 8192 linear 8:0 2048
#ioctl/libdm-iface.c:1838         dm table   (253:113) OF   [16384] (*1)
#libdm-deptree.c:2728     Suppressed vg03-lvol1_rmeta_1 (253:113) identical table reload.
#libdm-deptree.c:2693     Loading vg03-lvol1_rimage_1 table (253:114)
#libdm-deptree.c:2637         Adding target to (253:114): 0 7507812352 linear 8:0 10240
#ioctl/libdm-iface.c:1838         dm table   (253:114) OF   [16384] (*1)
#libdm-deptree.c:2728     Suppressed vg03-lvol1_rimage_1 (253:114) identical table reload.
#libdm-deptree.c:2693     Loading vg03-lvol1_rmeta_2 table (253:115)
#libdm-deptree.c:2637         Adding target to (253:115): 0 8192 linear 8:16 2048
#ioctl/libdm-iface.c:1838         dm table   (253:115) OF   [16384] (*1)
#libdm-deptree.c:2728     Suppressed vg03-lvol1_rmeta_2 (253:115) identical table reload.
#libdm-deptree.c:2693     Loading vg03-lvol1_rimage_2 table (253:116)
#libdm-deptree.c:2637         Adding target to (253:116): 0 7507812352 linear 8:16 10240
#ioctl/libdm-iface.c:1838         dm table   (253:116) OF   [16384] (*1)
#libdm-deptree.c:2728     Suppressed vg03-lvol1_rimage_2 (253:116) identical table reload.
#libdm-deptree.c:2693     Loading vg03-lvol1_rmeta_3 table (253:117)
#libdm-deptree.c:2637         Adding target to (253:117): 0 8192 linear 8:32 2048
#ioctl/libdm-iface.c:1838         dm table   (253:117) OF   [16384] (*1)
#libdm-deptree.c:2728     Suppressed vg03-lvol1_rmeta_3 (253:117) identical table reload.
#libdm-deptree.c:2693     Loading vg03-lvol1_rimage_3 table (253:118)
#libdm-deptree.c:2637         Adding target to (253:118): 0 7507812352 linear 8:32 10240
#ioctl/libdm-iface.c:1838         dm table   (253:118) OF   [16384] (*1)
#libdm-deptree.c:2728     Suppressed vg03-lvol1_rimage_3 (253:118) identical table reload.
#libdm-deptree.c:1981     Creating vg03-lvol1
#ioctl/libdm-iface.c:1838         dm create vg03-lvol1 LVM-NYeT7Gk1h6roCjIRVRdM3YQAoyuBcECFe2A4KJCjCU5J9sSzIVdJLRh1xF7xntYx NF   [16384] (*1)
#libdm-deptree.c:2693     Loading vg03-lvol1 table (253:119)
#libdm-deptree.c:2637         Adding target to (253:119): 0 22523437056 raid raid5_ls 3 128 region_size 16384 4 253:111 253:112 253:113 253:114 253:115 253:116 253:117 253:118
#ioctl/libdm-iface.c:1838         dm table   (253:119) OF   [16384] (*1)
#ioctl/libdm-iface.c:1838         dm reload   (253:119) NF   [16384] (*1)
#ioctl/libdm-iface.c:1876   device-mapper: reload ioctl on (253:119) failed: Input/output error
#libdm-deptree.c:1022     Removing vg03-lvol1 (253:119)
#libdm-common.c:2338         Udev cookie 0xd4de97c (semid 720905) created
#libdm-common.c:2358         Udev cookie 0xd4de97c (semid 720905) incremented to 1
#libdm-common.c:2230         Udev cookie 0xd4de97c (semid 720905) incremented to 2
#libdm-common.c:2480         Udev cookie 0xd4de97c (semid 720905) assigned to REMOVE task(2) with flags DISABLE_LIBRARY_FALLBACK         (0x20)
#ioctl/libdm-iface.c:1838         dm remove   (253:119) NF   [16384] (*1)
#libdm-common.c:1430         vg03-lvol1: Stacking NODE_DEL [trust_udev]

dmesg 的设备映射器日志输出

md/raid:mdX: device dm-114 operational as raid disk 1
md/raid:mdX: device dm-112 operational as raid disk 0
md/raid:mdX: allocated 0kB
md/raid:mdX: not enough operational devices (2/4 failed)
RAID conf printout:
 --- level:5 rd:4 wd:2
 disk 0, o:1, dev:dm-112
 disk 1, o:1, dev:dm-114
 disk 2, o:1, dev:dm-116
 disk 3, o:1, dev:dm-118
md/raid:mdX: failed to run raid set.
md: pers->run() failed ...
device-mapper: table: 253:119: raid: Fail to run raid array
device-mapper: ioctl: error adding target to table

答案1

我通过手动踢出某些设备(使用 pvremove --force --force 和 vgreduce --removemissing)然后以降级模式激活 LV(使用 lvchange -ay --activationmode degraded ...)成功解决了非常相似的错误。结果 dmesg 是

[298324.769894] md/raid:mdX: raid level 5 active with 3 out of 4 devices, algorithm 2

并且我能够检查并安装文件系统。

相关内容