我的CentOS8里有一个可移动磁盘,但是无法减少卷组:
[root@localhost ~]# vgs
WARNING: Couldn't find device with uuid 3GDhRA-KZjA-iDum-8Ut0-s9s0-NnW2-4QQEUv.
WARNING: VG cl is missing PV 3GDhRA-KZjA-iDum-8Ut0-s9s0-NnW2-4QQEUv.
WARNING: Couldn't find all devices for LV cl/root while checking used and assumed devices.
VG #PV #LV #SN Attr VSize VFree
cl 2 3 0 wz-pn- 8,99g 0
[root@localhost ~]# pvs
WARNING: Couldn't find device with uuid 3GDhRA-KZjA-iDum-8Ut0-s9s0-NnW2-4QQEUv.
WARNING: VG cl is missing PV 3GDhRA-KZjA-iDum-8Ut0-s9s0-NnW2-4QQEUv.
WARNING: Couldn't find all devices for LV cl/root while checking used and assumed devices.
PV VG Fmt Attr PSize PFree
/dev/sda2 cl lvm2 a-- <7,00g 0
[unknown] cl lvm2 a-m <2,00g 0
[root@localhost ~]# lvs
WARNING: Couldn't find device with uuid 3GDhRA-KZjA-iDum-8Ut0-s9s0-NnW2-4QQEUv.
WARNING: VG cl is missing PV 3GDhRA-KZjA-iDum-8Ut0-s9s0-NnW2-4QQEUv.
WARNING: Couldn't find all devices for LV cl/root while checking used and assumed devices.
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
home cl -wi-ao---- 1016,00m
root cl -wi-ao--p- <7,20g
swap cl -wi-ao---- 820,00m
[root@localhost ~]# vgreduce --removemissing --force cl
WARNING: Couldn't find device with uuid 3GDhRA-KZjA-iDum-8Ut0-s9s0-NnW2-4QQEUv.
WARNING: VG cl is missing PV 3GDhRA-KZjA-iDum-8Ut0-s9s0-NnW2-4QQEUv.
WARNING: Couldn't find all devices for LV cl/root while checking used and assumed devices.
WARNING: Couldn't find device with uuid 3GDhRA-KZjA-iDum-8Ut0-s9s0-NnW2-4QQEUv.
WARNING: Removing partial LV cl/root.
Logical volume cl/root contains a filesystem in use.
我在我的 bash 历史记录中找到了 lvextend 命令:
lvm lvextend -l +100%FREE /dev/cl/root
答案1
最后我找到了解决方案:
- 备份 /etc/lvm/archive 中的好的 .vg 文件(其中只有 1 个 PV,没有未知的 PV)
- 启动 Live CD
- 复制 .vg
- vgreduce cl --removemissing --force (成功删除 /cl/root)
- vgcfgrestore -f 备份.vg cl
答案2
cl/root 跨越两个 PV;您需要两个磁盘才能使用该卷。据推测 cl/root 安装在 / 上。您无法减少此 LV,也无法卸载它,因为它包含您的大部分系统。
我认为文件系统已经扩展,并且是 XFS,因此无法缩小。
备份您想要保留的所有数据。
如果可能,附加缺失的 PV。使用 添加至少与缺失大小相同的另一个 PV vgextend
。使用 将范围从坏磁盘移出pvmove
。空 PV 不需要强制: vgreduce --removemissing cl
如果这不起作用,请重建。创建一个新的 VG 并恢复数据。由于这是根,请重新安装一个新的 OS 实例。
考虑创建与操作系统分开的数据 LV。这样以后就可以卸载和删除部分 LV。并且使 LVM 能够使用 LV 执行多项有用的操作。
答案3
谢谢约翰!
丢失的 PV 存在,但已损坏。我认为这是因为命令顺序错误。首先添加 PV (/dev/sdb),扩展 VG 和 LV,然后使用 fdisk 创建分区。
我在 virtualbox 中重现了该问题,并添加了一个磁盘(大小相同)。pvcreate 成功,但 vgextend 失败:
[root@localhost ~]# vgextend cl -v /dev/sdc
WARNING: Couldn't find device with uuid 3GDhRA-KZjA-iDum-8Ut0-s9s0-NnW2-4QQEUv.
WARNING: VG cl is missing PV 3GDhRA-KZjA-iDum-8Ut0-s9s0-NnW2-4QQEUv.
WARNING: Couldn't find all devices for LV cl/root while checking used and assumed devices.
Wiping signatures on new PV /dev/sdc.
WARNING: Couldn't find device with uuid 3GDhRA-KZjA-iDum-8Ut0-s9s0-NnW2-4QQEUv.
WARNING: VG cl is missing PV 3GDhRA-KZjA-iDum-8Ut0-s9s0-NnW2-4QQEUv.
WARNING: Couldn't find all devices for LV cl/root while checking used and assumed devices.
WARNING: Couldn't find device with uuid 3GDhRA-KZjA-iDum-8Ut0-s9s0-NnW2-4QQEUv.
There are 1 physical volumes missing.
Archiving volume group "cl" metadata (seqno 6).
Segmentation fault (core dumped)
还有其他建议吗?Live CD magic,还是 UUID 更改?