3

I have a removable disk in my CentOS8, but I can't reduce the volume group:

[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.

I found the lvextend command in my bash history:

lvm lvextend -l +100%FREE /dev/cl/root
benxymr
  • 41
  • 4

3 Answers3

1

Finally I found the solution:

  1. Backup the good .vg file in /etc/lvm/archive (where only 1 PV, without the unknown PV)
  2. Boot live cd
  3. Copy the .vg
  4. vgreduce cl --removemissing --force (delete /cl/root successfully)
  5. vgcfgrestore -f backedup.vg cl
benxymr
  • 41
  • 4
0

cl/root spans both PVs; you need both disks for the volume to be usable. Presumably cl/root is mounted at /. You can't reduce this LV away, and it can't be unmounted, as it contains most of your system.

I assume the file system has already been extended, and is XFS so cannot be reduced.


Back up any data you want to keep.

Attach the missing PV if possible. Add another PV of at least the size of the missing one with vgextend. Move the extents off the bad disk with pvmove. Empty PVs don't need to be forced: vgreduce --removemissing cl

If that didn't work, rebuild. Create a new VG and restore data. As this was the root, reinstall a new OS instance.


Consider creating data LVs separate from the OS. Makes it possible to unmount and remove partial LVs in the future. And enables several useful things LVM can do with LVs.

John Mahowald
  • 30,009
  • 1
  • 17
  • 32
0

Thanks John!

The missing PV is there, but corrupted. I think it's because of the wrong order of commands. First added the PV (/dev/sdb), extend VG and LV, after create a partition with fdisk.

I reproduced the problem in virtualbox, and added a disk (same size). Pvcreate ok, but vgextend failed:

[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)

Any other tips? Live CD magic, or UUID change?

benxymr
  • 41
  • 4