给卷组扩容时出现UUID报错找不到对应磁盘问题该如何解决 ?

问题截图

复现操作 :模拟加入卷组的磁盘损坏或者被格式化了,导致卷组找不到这个磁盘了

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
root@ubuntu:~# vgextend ubuntu-vg /dev/sdb
Physical volume "/dev/sdb" successfully created.
Volume group "ubuntu-vg" successfully extended
root@ubuntu:~# pvscan
PV /dev/sda3 VG ubuntu-vg lvm2 [<498.00 GiB / <398.00 GiB free]
PV /dev/sdb VG ubuntu-vg lvm2 [<100.00 GiB / <100.00 GiB free]
Total: 2 [597.99 GiB] / in use: 2 [597.99 GiB] / in no VG: 0 [0 ]
root@ubuntu:~# fdisk -l /dev/sdb
Disk /dev/sdb: 100 GiB, 107374182400 bytes, 209715200 sectors
Disk model: VMware Virtual S
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
root@ubuntu:~# fdisk /dev/sdb

Welcome to fdisk (util-linux 2.37.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

The device contains 'LVM2_member' signature and it will be removed by a write command. See fdisk(8) man page and --wipe option for more details.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x5efa0911.

Command (m for help): d
No partition is defined yet!

Command (m for help): w

The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

root@ubuntu:~# pvscan
WARNING: Couldn't find device with uuid dTLEPv-0Xxv-esSl-d4sq-DNAQ-hWXX-b0nMkJ.
WARNING: VG ubuntu-vg is missing PV dTLEPv-0Xxv-esSl-d4sq-DNAQ-hWXX-b0nMkJ (last written to /dev/sdb).
PV /dev/sda3 VG ubuntu-vg lvm2 [<498.00 GiB / <398.00 GiB free]
PV [unknown] VG ubuntu-vg lvm2 [<100.00 GiB / <100.00 GiB free]
Total: 2 [597.99 GiB] / in use: 2 [597.99 GiB] / in no VG: 0 [0 ]
root@ubuntu:~#

注意调整前打快照备份

解决该情况

1
vgreduce --removemissing vg_mboel6(VG name)
1
2
3
4
5
6
7
8
root@ubuntu:~# vgreduce --removemissing ubuntu-vg 
WARNING: Couldn't find device with uuid dTLEPv-0Xxv-esSl-d4sq-DNAQ-hWXX-b0nMkJ.
WARNING: VG ubuntu-vg is missing PV dTLEPv-0Xxv-esSl-d4sq-DNAQ-hWXX-b0nMkJ (last written to /dev/sdb).
WARNING: Couldn't find device with uuid dTLEPv-0Xxv-esSl-d4sq-DNAQ-hWXX-b0nMkJ.
Wrote out consistent volume group ubuntu-vg.
root@ubuntu:~# pvscan
PV /dev/sda3 VG ubuntu-vg lvm2 [<498.00 GiB / <398.00 GiB free]
Total: 1 [<498.00 GiB] / in use: 1 [<498.00 GiB] / in no VG: 0 [0 ]

解决。