磁盘故障的 LVM 镜像无法修复

磁盘故障的 LVM 镜像无法修复

我正在尝试帮助某人在运行 Fedora 20 (lvm2-2.0.2.106、linux 3.19.8-100) 的旧服务器上恢复 RAID1 镜像 LVM 逻辑卷。镜像中的一个磁盘已损坏。该磁盘属于名为 systemvg 的 VG。vgchange 说:

vgchange -a y --partial systemvg
  PARTIAL MODE. Incomplete logical volumes will be processed.
  PV qtva6m-iBhc-q3Zt-At1U-FiWH-iZd8-tjpR0u not recognised. Is the device missing?
  device-mapper: reload ioctl on  failed: Input/output error
  1 logical volume(s) in volume group "systemvg" now active

(“ioctl on failed” 令人费解,但无论如何。)

现在我们尝试修复该 VG 中名为“home”的 LV:

lvconvert --repair systemvg/home
  PV qtva6m-iBhc-q3Zt-At1U-FiWH-iZd8-tjpR0u not recognised. Is the device missing?
Attempt to replace failed RAID images (requires full device resync)? [y/n]: y
  device-mapper: create ioctl on systemvg-home_rmeta_2 failed: Device or resource busy
  Failed to suspend systemvg/home before committing changes
  Failed to replace faulty devices in systemvg/home.
  Device '/dev/sdc' has been left open (1 remaining references).
  Device '/dev/sda1' has been left open (1 remaining references).
  Internal error: 2 device(s) were left open and have been closed.

现在情况变得复杂了,因为我们(愚蠢地?)使用 vgextend 向 systemvg 添加了一个新的 PV(新的空白磁盘),希望这会有所帮助。但事实并非如此,现在我们无法从 systemvg 中删除该磁盘。

lsblk 当前显示:

sda                                  8:0    0  7.3T  0 disk 
└─sda1                               8:1    0  7.3T  0 part 
  ├─systemvg-home_rmeta_2          253:9    0    4M  0 lvm  
  └─systemvg-home_rimage_2         253:10   0  5.5T  0 lvm  
sdc                                  8:32   0  5.5T  0 disk 
├─systemvg-home_rmeta_0            253:2    0    4M  0 lvm  
└─systemvg-home_rimage_0           253:3    0  5.5T  0 lvm  
systemvg-home_rmeta_1-missing_0_0  253:4    0    4M  0 lvm  
└─systemvg-home_rmeta_1            253:5    0    4M  0 lvm  
systemvg-home_rimage_1-missing_0_0 253:6    0  5.5T  0 lvm  
└─systemvg-home_rimage_1           253:7    0  5.5T  0 lvm  

sdc 是镜像剩余的原始一半。sda 是我们添加到 systemvg 的新空磁盘。

/dev/mapper 包含:

systemvg-home_rimage_0
systemvg-home_rimage_1
systemvg-home_rimage_1-missing_0_0
systemvg-home_rimage_2
systemvg-home_rmeta_0
systemvg-home_rmeta_1
systemvg-home_rmeta_1-missing_0_0
systemvg-home_rmeta_2

但没有“/dev/mapper/systemvg-home”。

我们如何从剩下的一半镜像中恢复数据?

相关内容