我在生产服务器上的 /dev/sdb 上意外创建了属于的 GPT 标签ubuntu-vg
。
变更前:
$ df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/ubuntu--vg-ubuntu--lv 88G 74G 11G 88% /
$ sudo parted /dev/sda print
Warning: Not all of the space available to /dev/sda appears to be used, you can fix the GPT to use all
of the space (an extra 20971520 blocks) or continue with the current setting?
Fix/Ignore? f
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 85.9GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 2097kB 1049kB bios_grub
2 2097kB 1076MB 1074MB ext4 /boot
3 1076MB 75.2GB 74.1GB ubuntu-vg
$ sudo pvs
PV VG Fmt Attr PSize PFree
/dev/sda3 ubuntu-vg lvm2 a-- <69.00g 0
/dev/sdb ubuntu-vg lvm2 a-- <20.00g 0
改变 :
$ sudo parted /dev/sdb
GNU Parted 3.3
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
Error: /dev/sdb: unrecognised disk label
Model: VMware Virtual disk (scsi)
Disk /dev/sdb: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags:
(parted) mklabel gpt
(parted) p
Model: VMware Virtual disk (scsi)
Disk /dev/sdb: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
(parted) q
Information: You may need to update /etc/fstab.
更改后:
$ sudo pvs
WARNING: Couldn't find device with uuid CdlY5k-IynC-hYTX-hH3h-HaLC-KAqy-n4h38q.
WARNING: VG ubuntu-vg is missing PV CdlY5k-IynC-hYTX-hH3h-HaLC-KAqy-n4h38q (last written to [unknown]).
WARNING: Couldn't find all devices for LV ubuntu-vg/ubuntu-lv while checking used and assumed devices.
PV VG Fmt Attr PSize PFree
/dev/sda3 ubuntu-vg lvm2 a-- <69.00g 0
[unknown] ubuntu-vg lvm2 a-m <20.00g 0
$ sudo pvcreate /dev/sdb
WARNING: Couldn't find device with uuid CdlY5k-IynC-hYTX-hH3h-HaLC-KAqy-n4h38q.
WARNING: VG ubuntu-vg is missing PV CdlY5k-IynC-hYTX-hH3h-HaLC-KAqy-n4h38q (last written to /dev/sdb).
WARNING: Couldn't find all devices for LV ubuntu-vg/ubuntu-lv while checking used and assumed devices.
Device /dev/sdb excluded by a filter.
$ sudo pvs
WARNING: Couldn't find device with uuid CdlY5k-IynC-hYTX-hH3h-HaLC-KAqy-n4h38q.
WARNING: VG ubuntu-vg is missing PV CdlY5k-IynC-hYTX-hH3h-HaLC-KAqy-n4h38q (last written to [unknown]).
WARNING: Couldn't find all devices for LV ubuntu-vg/ubuntu-lv while checking used and assumed devices.
PV VG Fmt Attr PSize PFree
/dev/sda3 ubuntu-vg lvm2 a-- <69.00g 0
[unknown] ubuntu-vg lvm2 a-m <20.00g 0
我尝试了这个:
$ sudo vgck --updatemetadata ubuntu-vg
WARNING: Couldn't find device with uuid CdlY5k-IynC-hYTX-hH3h-HaLC-KAqy-n4h38q.
WARNING: VG ubuntu-vg is missing PV CdlY5k-IynC-hYTX-hH3h-HaLC-KAqy-n4h38q (last written to /dev/sdb).
WARNING: Couldn't find all devices for LV ubuntu-vg/ubuntu-lv while checking used and assumed devices.
WARNING: Couldn't find device with uuid CdlY5k-IynC-hYTX-hH3h-HaLC-KAqy-n4h38q.
WARNING: Couldn't find device with uuid CdlY5k-IynC-hYTX-hH3h-HaLC-KAqy-n4h38q.
$ sudo pvscan --cache
WARNING: Couldn't find device with uuid CdlY5k-IynC-hYTX-hH3h-HaLC-KAqy-n4h38q.
pvscan[1018603] PV /dev/sda3 online.
$ sudo pvcreate --restorefile /etc/lvm/backup/ubuntu-vg --uuid "CdlY5k-IynC-hYTX-hH3h-HaLC-KAqy-n4h38q" /dev/sdb
WARNING: Couldn't find device with uuid 3CHhp6-yMvu-Fnqj-8usZ-EHp8-k88B-Jm8MK3.
WARNING: Couldn't find device with uuid CdlY5k-IynC-hYTX-hH3h-HaLC-KAqy-n4h38q.
WARNING: Couldn't find device with uuid CdlY5k-IynC-hYTX-hH3h-HaLC-KAqy-n4h38q.
WARNING: VG ubuntu-vg is missing PV CdlY5k-IynC-hYTX-hH3h-HaLC-KAqy-n4h38q (last written to [unknown]).
WARNING: Couldn't find all devices for LV ubuntu-vg/ubuntu-lv while checking used and assumed devices.
Device /dev/sdb excluded by a filter.
$ echo $?
5
$ sudo pvck -t /dev/sdb
TEST MODE: Metadata will NOT be updated and volumes will not be (de)activated.
Device /dev/sdb excluded by a filter.
$ sudo pvs /dev/sda3
WARNING: Couldn't find device with uuid CdlY5k-IynC-hYTX-hH3h-HaLC-KAqy-n4h38q.
WARNING: VG ubuntu-vg is missing PV CdlY5k-IynC-hYTX-hH3h-HaLC-KAqy-n4h38q (last written to [unknown]).
WARNING: Couldn't find all devices for LV ubuntu-vg/ubuntu-lv while checking used and assumed devices.
PV VG Fmt Attr PSize PFree
/dev/sda3 ubuntu-vg lvm2 a-- <69.00g 0
$ df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/ubuntu--vg-ubuntu--lv 88G 74G 11G 88% /
$ sudo vgreduce --removemissing --verbose /dev/ubuntu-vg
WARNING: Couldn't find device with uuid CdlY5k-IynC-hYTX-hH3h-HaLC-KAqy-n4h38q.
WARNING: VG ubuntu-vg is missing PV CdlY5k-IynC-hYTX-hH3h-HaLC-KAqy-n4h38q (last written to [unknown]).
WARNING: Couldn't find all devices for LV ubuntu-vg/ubuntu-lv while checking used and assumed devices.
WARNING: Couldn't find device with uuid CdlY5k-IynC-hYTX-hH3h-HaLC-KAqy-n4h38q.
There are 1 physical volumes missing.
Archiving volume group "ubuntu-vg" metadata (seqno 12).
WARNING: Partial LV ubuntu-lv needs to be repaired or removed.
There are still partial LVs in VG ubuntu-vg.
To remove them unconditionally use: vgreduce --removemissing --force.
WARNING: Proceeding to remove empty missing PVs.
WARNING: Couldn't find device with uuid CdlY5k-IynC-hYTX-hH3h-HaLC-KAqy-n4h38q.
There are 1 physical volumes missing.
Creating volume group backup "/etc/lvm/backup/ubuntu-vg" (seqno 13).
administrateur@par-glpinetwork:/var/www/glpi/config$ sudo pvdisplay -m
WARNING: Couldn't find device with uuid CdlY5k-IynC-hYTX-hH3h-HaLC-KAqy-n4h38q.
WARNING: VG ubuntu-vg is missing PV CdlY5k-IynC-hYTX-hH3h-HaLC-KAqy-n4h38q (last written to [unknown]).
WARNING: Couldn't find all devices for LV ubuntu-vg/ubuntu-lv while checking used and assumed devices.
--- Physical volume ---
PV Name /dev/sda3
VG Name ubuntu-vg
PV Size <69.00 GiB / not usable 1.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 17663
Free PE 0
Allocated PE 17663
PV UUID 3CHhp6-yMvu-Fnqj-8usZ-EHp8-k88B-Jm8MK3
--- Physical Segments ---
Physical extent 0 to 17662:
Logical volume /dev/ubuntu-vg/ubuntu-lv
Logical extents 0 to 17662
--- Physical volume ---
PV Name [unknown]
VG Name ubuntu-vg
PV Size 20.00 GiB / not usable 4.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 5119
Free PE 0
Allocated PE 5119
PV UUID CdlY5k-IynC-hYTX-hH3h-HaLC-KAqy-n4h38q
--- Physical Segments ---
Physical extent 0 to 5118:
Logical volume /dev/ubuntu-vg/ubuntu-lv
Logical extents 17663 to 22781
救命,我该如何解决这个问题?