error: disk `lvmid/ExzA22-yHkV-0ymE-XbMT-zrD6-69Wp-bboRVP/zbB3V2-Kg2Y-EdI6-dbs1-6uSo-e6wk-ZRBJdh' not found. Entering rescue mode... grub rescue> ls (lvm/pve-root) (lvm/pve-swap) (hd0) (hd1) (hd1,gpt3) (hd1,gpt2) (hd1,gpt1)
进入 rescue 模式
搞个 u 盘,把 CentOS 7.9 minimal 的 ISO 烧录进去后,插到 proxmox 的 USB 口子上,开机 F12 选择从 U 盘启动。 选择 Troubleshooting –> Rescue 选中 Rescue a CentOS system ,一直等待,有交互后,选择 3,也就是 3) Skip to shell。
$ pvs PV VG Fmt Attr PSize PFree /dev/sda1 pve lvm2 a-- <931.51g 697.50g /dev/sdb3 pve lvm2 a-- <476.44g 0 $ vgs VG #PV #LV #SN Attr VSize VFree pve 2 23 0 wz--n- 1.37t 697.50g $ lvs LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert base-101-disk-0 pve Vri---tz-k 10.00g data base-106-disk-0 pve Vri---tz-k 20.00g data data pve twi-aotz-- <550.29g 73.93 6.08 root pve -wi-ao---- 146.00g snap_vm-102-disk-0_a20210429 pve Vri---tz-k 30.00g data vm-102-disk-0 swap pve -wi-ao---- 7.00g vm-100-cloudinit pve Vwi-a-tz-- 4.00m data 9.38 vm-100-disk-0 pve Vwi-a-tz-- 10.00g data base-101-disk-0 16.65 vm-100-disk-1 pve Vwi-a-tz-- 7.00g data 0.17 vm-101-cloudinit pve Vwi-a-tz-- 4.00m data 0.00 vm-102-cloudinit pve Vwi-aotz-- 4.00m data 9.38 vm-102-disk-0 pve Vwi-aotz-- 100.00g data 73.78 vm-102-state-a20210429 pve Vwi-a-tz-- <8.49g data 44.03 vm-103-disk-0 pve Vwi-a-tz-- 25.00g data 99.98 vm-104-disk-0 pve Vwi-a-tz-- <2.02g data 99.31 vm-105-cloudinit pve Vwi-a-tz-- 4.00m data 9.38 vm-105-disk-0 pve Vwi-a-tz-- 10.00g data 85.13 vm-106-cloudinit pve Vwi-a-tz-- 4.00m data 0.00 vm-107-cloudinit pve Vwi-a-tz-- 4.00m data 9.38 vm-107-disk-0 pve Vwi-a-tz-- 30.00g data 65.94 vm-108-cloudinit pve Vwi-aotz-- 4.00m data 9.38 vm-108-disk-0 pve Vwi-aotz-- 250.00g data 99.21 vm-200-disk-0 pve Vwi-aotz-- <2.02g data 99.31
激活下 vg 看看:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
$ vgchange -a y /usr/sbin/dmeventd: stat failed: No such file or directory WARNING: Failed to monirot pve/data. /usr/sbin/dmeventd: stat failed: No such file or directory WARNING: Failed to monirot pve/data. /usr/sbin/dmeventd: stat failed: No such file or directory WARNING: Failed to monirot pve/data. /usr/sbin/dmeventd: stat failed: No such file or directory WARNING: Failed to monirot pve/data. /usr/sbin/dmeventd: stat failed: No such file or directory WARNING: Failed to monirot pve/data. /usr/sbin/dmeventd: stat failed: No such file or directory WARNING: Failed to monirot pve/data. ... 20 logical volume(s) in volume group "pve" now active
手动挂载下看看
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
$ mount /dev/mapper/pve-root /mnt/sysimage
# 如果报错 mount: wrong fs type, bad option, bad superblock on /dev/mapper/pve-root, missing codepage or helper program, or other error
In some cases useful info is found in syslog - try dmesg | tail or so. # 建议 pve 的 iso 进入救援模式,去修复上面的分区路径,pve 的 root 分区一般是 ext4 文件系统,所以修复下试试 $ fsck.ext4 -y /dev/mapper/pve-root
# 如果是 centos 的 iso rescue 里使用 e2fsck ,可能会报错版本低: e2fsck 1.42.9 (28-Dec-2013) /dev/mapper/pve-root has unsupported feature(s): metadata_csum e2fsck: Get a newer version of e2fsck!
1 2 3 4 5 6 7 8 9 10 11 12 13
$ cd /mnt/sysimage $ ls -l boot/ total 58496 -rw-r--r-- 1 root root 237698 May 7 2020 config-5.4.34-1-pve drwxr-xr-x 3 root root 4096 Jan 1 1970 efi drwxr-xr-x 6 root root 4096 Feb 18 12:59 grub -rw-r--r-- 1 root root 42573458 Aug 18 2021 initrd.img-5.4.34-1-pve -rw-r--r-- 1 root root 182704 Jun 26 2015 memtest86+.bin -rw-r--r-- 1 root root 184840 Jun 26 2015 memtest86+_multiboot.bin drwxr-xr-x 2 root root 4096 Sep 9 2020 pve -rw-r--r-- 1 root root 4795341 May 7 2020 System.map-5.4.34-1-pve -rw-r--r-- 1 root root 11901312 May 7 2020 vmlinuz-5.4.34-1-pve $ cp etc/lvm/backup/pve root/pve
然后 chroot 进去
1 2 3 4 5 6
mount -o bind /dev /mnt/sysimage/dev mount -o bind /proc /mnt/sysimage/proc mount -o bind /run /mnt/sysimage/run mount -o bind /sys /mnt/sysimage/sys # 上面如果在chroot之前不 mount 会导致一些lstat /dev /proc /sys 的命令报错无法读取这些目录 chroot /mnt/sysimage
# 没选自动挂载的话记得下面这些命令 mount /dev/mapper/pve-root /mnt/sysimage mount -o bind /dev /mnt/sysimage/dev mount -o bind /proc /mnt/sysimage/proc mount -o bind /run /mnt/sysimage/run mount -o bind /sys /mnt/sysimage/sys