LinuxCentOS7关于PV name券显示[unknown]问题
今天遇见了一个问题,就是本人想要扩展linux的分区容量时,创建的pv卷显示名称为[unknown]????
如下:
[root@bogon ~]# pvs
WARNING: Device for PV NJQyPM-K2N8-vk2O-04IG-GmS8-IGxZ-FJt1rj not found or rejected by a filter.
PV VG Fmt Attr PSize PFree
/dev/sda2 centos lvm2 a-- <19.00g 0
[unknown] centos lvm2 a-m <10.00g <10.00g
这个问题是啥东西啊?我也没有瞎胡创建还是怎么着啊,就是不能正常使用了。
使用pvremove告知如下:
[root@bogon ~]# pvremove [unknown]
WARNING: Device for PV NJQyPM-K2N8-vk2O-04IG-GmS8-IGxZ-FJt1rj not found or rejected by a filter.
Device [unknown] not found (or ignored by filtering).
????这下我就迷糊了,还不能删除。。。
告诉我什么找不到的意思,可是我查询明明是有的。
我又看了眼 发现vg name名称相同,会不会是重名导致的??于是我又vgrename :
[root@bogon ~]# vgrename centos centos01
WARNING: Device for PV NJQyPM-K2N8-vk2O-04IG-GmS8-IGxZ-FJt1rj not found or rejected by a filter.
Cannot change VG centos while PVs are missing.
Consider vgreduce --removemissing.
Cannot process volume group centos
瓦特???还是不行???
它上面让我使用vgreduce --removemissing. 来删除相关的vg卷
于是我照做:
[root@bogon ~]# vgreduce --removemissing centos
/dev/sda2 [unknown]
[root@bogon ~]# vgreduce --removemissing centos [unknown]
Command does not accept argument: [unknown].
这也不行,这可咋整?????
我想是不是把这个分区给格式化了就能恢复?(我这个分区没有数据文件,诸位有数据文件的不要乱格式化。)
[root@bogon ~]# mkfs.ext4 /dev/sdb1
mke2fs 1.42.9 (28-Dec-2013)
文件系统标签=
OS type: Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1310720 inodes, 5242624 blocks
262131 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=2153775104
160 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000
Allocating group tables: 完成
正在写入inode表: 完成
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成
[root@bogon ~]#
[root@bogon ~]# reboot
Connection to 192.168.67.128 closed by remote host.
Connection to 192.168.67.128 closed.
C:\Users\Administrator>ssh root@192.168.67.128
root@192.168.67.128's password:
Last login: Thu Apr 22 20:28:52 2021 from 192.168.67.1
[root@bogon ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:9a:5b:e4 brd ff:ff:ff:ff:ff:ff
inet 192.168.67.128/24 brd 192.168.67.255 scope global dynamic ens33
valid_lft 1721sec preferred_lft 1721sec
inet6 fe80::cca9:5adc:7217:6f3d/64 scope link
valid_lft forever preferred_lft forever
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN qlen 1000
link/ether 52:54:00:30:50:db brd ff:ff:ff:ff:ff:ff
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
valid_lft forever preferred_lft forever
4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN qlen 1000
link/ether 52:54:00:30:50:db brd ff:ff:ff:ff:ff:ff
[root@bogon ~]# fdisk -l
磁盘 /dev/sda:21.5 GB, 21474836480 字节,41943040 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x000ae533
设备 Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 41943039 19921920 8e Linux LVM
磁盘 /dev/sdb:21.5 GB, 21474836480 字节,41943040 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0xfdaab170
设备 Boot Start End Blocks Id System
/dev/sdb1 2048 41943039 20970496 8e Linux LVM
磁盘 /dev/mapper/centos-root:18.2 GB, 18249416704 字节,35643392 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘 /dev/mapper/centos-swap:2147 MB, 2147483648 字节,4194304 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
[root@bogon ~]# vgdisplay
WARNING: Device for PV NJQyPM-K2N8-vk2O-04IG-GmS8-IGxZ-FJt1rj not found or rejected by a filter.
--- Volume group ---
VG Name centos
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 1
VG Size 28.99 GiB
PE Size 4.00 MiB
Total PE 7422
Alloc PE / Size 4863 / <19.00 GiB
Free PE / Size 2559 / <10.00 GiB
VG UUID CNxo7t-Tlzd-rUfJ-EfGP-2ui3-hu8b-f9xVFx
我格式化了空间又重新分区,敲了下vgdisplay 显示为Free PE还有10G空间。。。格式化空间也不好用。。。
准备放弃的时候有一条命令恢复了,就是根据PV的UUID来恢复不正常的pv卷名称:
我先查看PVUUID 可以用pvdisplay查看PVUUID
yes (but full)
PE Size 4.00 MiB
Total PE 4863
Free PE 0
Allocated PE 4863
PV UUID UrT1kL-3iRj-c120-mRF5-SkbV-1ca1-m3SqfI
--- Physical volume ---
PV Name /dev/sdb1
VG Name centos
PV Size <10.00 GiB / not usable 3.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 2559
Free PE 2559
Allocated PE 0
PV UUID NJQyPM-K2N8-vk2O-04IG-GmS8-IGxZ-FJt1rj
也可以查看/etc/lvm/backup/下生成的pv创建备份文件来找到PVUUID:
[root@bogon ~]# vim /etc/lvm/backup/centos
# Generated by LVM2 version 2.02.171(2)-RHEL7 (2017-05-03): Thu Apr 22 20:58:42 2021
contents = "Text Format Volume Group"
version = 1
description = "Created *after* executing 'vgrename centoss centos'"
creation_host = "bogon" # Linux bogon 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64
creation_time = 1619096322 # Thu Apr 22 20:58:42 2021
centos {
id = "CNxo7t-Tlzd-rUfJ-EfGP-2ui3-hu8b-f9xVFx"
seqno = 6
format = "lvm2" # informational
status = ["RESIZEABLE", "READ", "WRITE"]
flags = []
extent_size = 8192 # 4 Megabytes
max_lv = 0
max_pv = 0
metadata_copies = 0
physical_volumes {
pv0 {
id = "UrT1kL-3iRj-c120-mRF5-SkbV-1ca1-m3SqfI"
device = "/dev/sda2" # Hint only
status = ["ALLOCATABLE"]
flags = []
dev_size = 39843840 # 18.999 Gigabytes
pe_start = 2048
pe_count = 4863 # 18.9961 Gigabytes
}
pv1 {
id = "NJQyPM-K2N8-vk2O-04IG-GmS8-IGxZ-FJt1rj"
device = "/dev/sdb1" # Hint only
status = ["ALLOCATABLE"]
flags = []
dev_size = 20969473 # 9.99902 Gigabytes
pe_start = 2048
pe_count = 2559 # 9.99609 Gigabytes
}
}
拿着PVUUID 去恢复pvname名称:
[root@bogon ~]# pvcreate /dev/sdb1 -u NJQyPM-K2N8-vk2O-04IG-GmS8-IGxZ-FJt1rj --restorefile /etc/lvm/backup/centos
Couldn't find device with uuid NJQyPM-K2N8-vk2O-04IG-GmS8-IGxZ-FJt1rj.
WARNING: Device for PV NJQyPM-K2N8-vk2O-04IG-GmS8-IGxZ-FJt1rj not found or rejected by a filter.
WARNING: ext4 signature detected on /dev/sdb1 at offset 1080. Wipe it? [y/n]: y
Wiping ext4 signature on /dev/sdb1.
Physical volume "/dev/sdb1" successfully created.
[root@bogon ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 centos lvm2 a-- <19.00g 0
/dev/sdb1 centos lvm2 a-- <10.00g <10.00g
这里可以看见使用pvcreate指定有问题的pvuuid号重新生成pvname就回复了。。。我的天,真够麻烦的。。
一条命令 我找了半天都没找出恢复pvname的解决方法。。