一.现象
公司数据库服务器磁盘空间不足,通过LVM动态扩容磁盘卷,提示physical volumes missing
二.问题处置
1.登录到服务器,通过pvs查看磁盘
[root@node1 ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 centos lvm2 a-- 99.51g 0
/dev/sdb centos lvm2 a-m 100.00g 0
/dev/sdc centos lvm2 a-- 100.00g 0
/dev/sdd centos lvm2 a-- 30.00g 0
/dev/sde centos lvm2 a-m 100.00g 0
/dev/sdf centos lvm2 a-- 100.00g 100.00g
发现有/dev/sdb 和/dev/sde的Attr的值是a-m,磁盘missing。
2.通过pvdisplay /dev/sde查看详细信息
[root@node1 ~]# pvdisplay /dev/sde
--- Physical volume ---
PV Name /dev/sde
VG Name centos
PV Size 100.00 GiB / not usable 4.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 25599
Free PE 0
Allocated PE 25599
PV UUID Fb9pTJ-cTob-X3Ju-5PL8-rFVx-nP8P-kp2vcL
3.通过fdisk -l查看磁盘状态
[root@node1 ~]# fdisk -l
Disk /dev/sda: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000a2c52
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 209715199 104344576 8e Linux LVM
Disk /dev/sdc: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sdb: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sdd: 32.2 GB, 32212254720 bytes, 62914560 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sde: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/centos-swap: 8455 MB, 8455716864 bytes, 16515072 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/mapper/centos-root: 560.1 GB, 560077996032 bytes, 1093902336 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sdf: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
4.通过vgdisplay -v查看
[root@node1 ~]# vgdisplay -v
Using volume group(s) on command line.
There are 2 physical volumes missing.
There are 2 physical volumes missing.
--- Volume group ---
VG Name centos
System ID
Format lvm2
Metadata Areas 6
Metadata Sequence No 19
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 6
Act PV 4
VG Size 529.49 GiB
PE Size 4.00 MiB
Total PE 135549
Alloc PE / Size 109950 / 429.49 GiB
Free PE / Size 25599 / 100.00 GiB
VG UUID FnFLUR-njbM-M5Z6-W1A0-pere-aMaG-xRsan6
--- Logical volume ---
LV Path /dev/centos/swap
LV Name swap
VG Name centos
LV UUID RHlFJS-dEz0-rTjI-SxuE-Ub8p-xcYg-Q4Idx3
LV Write Access read/write
LV Creation host, time localhost, 2016-09-05 13:57:31 +0800
LV Status available
# open 2
LV Size 7.88 GiB
Current LE 2016
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0
--- Logical volume ---
LV Path /dev/centos/root
LV Name root
VG Name centos
LV UUID TU3T6k-yIWf-DchY-fmaE-Bk00-fWEv-Uzk313
LV Write Access read/write
LV Creation host, time localhost, 2016-09-05 13:57:31 +0800
LV Status available
# open 1
LV Size 421.62 GiB
Current LE 107934
Segments 6
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:1
--- Physical volumes ---
PV Name /dev/sda2
PV UUID eptEUt-8gMK-iK6j-CAa2-Zue7-v4ik-gVlIGM
PV Status allocatable
Total PE / Free PE 25474 / 0
PV Name /dev/sdb
PV UUID eH4HUJ-qYqw-aOsr-WZ5f-gIjn-mM1B-E3xpZS
PV Status allocatable
Total PE / Free PE 25599 / 0
PV Name /dev/sdc
PV UUID 8sHF6m-gkoX-8Wrh-QEDL-nXY9-vXnc-alTSgg
PV Status allocatable
Total PE / Free PE 25599 / 0
PV Name /dev/sdd
PV UUID 07OA0J-VFL7-R5Ym-PbBx-3oHK-HYPI-8yXSg0
PV Status allocatable
Total PE / Free PE 7679 / 0
PV Name /dev/sde
PV UUID Fb9pTJ-cTob-X3Ju-5PL8-rFVx-nP8P-kp2vcL
PV Status allocatable
Total PE / Free PE 25599 / 0
PV Name /dev/sdf
PV UUID kGZf3L-s4xf-6X6G-6bUw-0knQ-bkJs-gtQ9kR
PV Status allocatable
Total PE / Free PE 25599 / 25599
通过以上确认物理磁盘没有问题,只是LVM的VG认为磁盘丢失。
5.恢复处置
[root@node1 ~]# vgextend --restoremissing centos /dev/sde
Volume group "centos" successfully extended
通过vgextend --restoremissing centos /dev/sde即可恢复
6.使用pvs查看发现磁盘恢复正常,可以正常进行扩容LVM了
[root@node1 ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 centos lvm2 a-- 99.51g 0
/dev/sdb centos lvm2 a-- 100.00g 0
/dev/sdc centos lvm2 a-- 100.00g 0
/dev/sdd centos lvm2 a-- 30.00g 0
/dev/sde centos lvm2 a-- 100.00g 0
/dev/sdf centos lvm2 a-- 100.00g 0
磁盘/dev/sde和/dev/sdb的Attr属性值的m已经不存在,恢复正常,可以正常针对lv进行处理了。