https://onitroad.com 更多教程

解决方案

由于缺少与卷组关联的物理卷,因此无法激活逻辑卷 (/dev/VolGroup/LogicalVolume)。
查看/etc/lvm/archive/VolGroup.cfg:

pv2 {
  id = "s1sKXM-29tw-ArT0-7sKW-C6mE-X8ES-QUbOor"
  device = "/dev/xvdf1" # Hint only <<<<<
  status = ["ALLOCATABLE"]
  flags = ["MISSING"] 
  dev_size = 83881985 # 39.998 Gigabytes
  pe_start = 2048
  pe_count = 10239 # 39.9961 Gigabytes
  }
}

物理卷 /dev/xvdf1 被标记为丢失,导致逻辑卷 VolGroup/LogicalVolume 激活问题,导致 lvm2-activation-net.service 启动失败。

使用 vgextend,恢复标记为丢失的设备。
一旦设备被标记为丢失(例如,如果在扫描期间无法找到它并且卷组在“部分”模式下被激活),则可能需要手动恢复它。
vgextend --restoremissing 命令可以做到这一点。

# vgextend --restoremissing VolGroup /dev/xvdf1
Volume group "VolGroup" successfully extended

激活逻辑卷:

# lvchange -ay /dev/VolGroup/LogicalVolume
[ 1552.936304] systemd-fsck[11319]: DBORA: clean, 182121/3932160 files, 10770808/15728640 blocks

检查 lvm2-acivation-net.service 是否可以正常启动:

# systemctl start lvm2-activation-net.service
# systemctl status lvm2-activation-net.service

重新启动系统:

# shutdown -r now

问题

系统无法正常启动,日志如下:

[ OK ] Started File System Check on /dev/xvdd.
[ OK ] Started File System Check on /dev/xvdg.
[ OK ] Started File System Check on /dev/xvdb.
[ OK ] Started File System Check on /dev/xvdc.
[ OK ] Started File System Check on /dev/disk/by-label/BOOT.
Mounting /boot...
[ OK ] Mounted /boot.
[FAILED] Failed to start LVM2 PV scan on device 202:65. 
无法在设备上启动 LVM2 PV 扫描
See 'systemctl status lvm2-pvscan@202:65.service' for details.

[FAILED] Failed to start LVM2 PV scan on device 202:81.
See 'systemctl status lvm2-pvscan@202:81.service' for details.
[ TIME ] Timed out waiting for device dev-disk-by\x2dlabel-DBORA.device.
[DEPEND] Dependency failed for File System Check on /dev/disk/by-label/DBORA.
[DEPEND] Dependency failed for /u01.

它表明 LVM2 PV 扫描无法启动,并且在等待设备 dev-disk-by\x2dlabel-DBORA.device 时也超时。
在尝试禁用 lvmetad 并重建 initramfs 然后执行重启后,系统启动卡在以下日志中:

Starting Availability of block devices...
[ OK ] Started Availability of block devices.
[FAILED] Failed to start Activation of LVM2 logical volumes. 
[FAILED] 无法启动 LVM2 逻辑卷的激活。

See 'systemctl status lvm2-activation-net.service' for details. 
[ OK ] Reached target Remote File Systems (Pre).
[ OK ] Started Cellirqbalance.
Welcome to emergency mode! After logging in, typGive root password for maintenance

输入root密码后显示systemctl status lvm2-activation-net.service的详细信息:

lvm2-activation-net.service - Activation of LVM2 logical volumes
Loaded: loaded (/etc/lvm/lvm.conf; bad; vendor preset: disabled)
Active: failed (Result: exit-code) since Mon 2020-06-29 22:10:58 EDT; 2min 55s ago
Docs: man:lvm2-activation-generator(8)
Process: 6457 ExecStart=/usr/sbin/lvm vgchange -aay --ignoreskippedcluster (code=exited, status=5)
Process: 6447 ExecStartPre=/usr/bin/udevadm settle (code=exited, status=0/SUCCESS)
Main PID: 6457 (code=exited, status=5)
Jun 29 22:10:58 hostname systemd[1]: Starting Activation of LVM2 logical volumes...
Jun 29 22:10:58 hostname lvm[6457]: Refusing activation of partial LV VolGroup/LogicalVolume. Use '--activationmode partial' to override. 
Jun 29 22:10:58 hostname lvm[6457]: 4 logical volume(s) in volume group "VolGroup" now active
Jun 29 22:10:58 hostname systemd[1]: lvm2-activation-net.service: main process exited, code=exited, status=5/NOTINSTALLED
Jun 29 22:10:58 hostname systemd[1]: Failed to start Activation of LVM2 logical volumes.
Jun 29 22:10:58 hostname systemd[1]: Unit lvm2-activation-net.service entered failed state.
单元 lvm2-activation-net.service 进入失败状态。 《-----

Jun 29 22:10:58 hostname systemd[1]: lvm2-activation-net.service failed.
CentOS/RHEL 7无法启动 Failed to start LVM2 PV
日期:2020-09-17 00:11:59 来源:oir作者:oir