易秋网络旗下全球VPS测评站
云主机测评/独立服务器测评/主机优惠码

LVM扩容磁盘提示/pvcreate 创建pv出现/Can’t initialize physical volume “/dev/sdb1” of volume group physical volume not initialized.

今天易秋网络老易给客户一个机器磁盘做LVM扩容的时候,发现有这个错误提示。2块1TB的磁盘,LVM分区扩容后成2TB。当我敲pvcreate /dev/sdb1是时候,提示:Can’t initialize physical volume “/dev/sdb1” of volume group physical volume not initialized.为什么会出现这个情况呢,大概就是以前做过lvm分区,以前的记录没有删除。如何解决这个问题呢。其实很简单,加个参数类似强制执行的意思,pvcreate -ff -y /dev/sdb1就可以了。下面把操作过程简单说明下。

操作前的一些情况:

[root@E3-1230-265 ~]# df -h
Filesystem                 Size  Used Avail Use% Mounted on
/dev/mapper/rootvg-rootlv  927G  1.4G  926G   1% /
devtmpfs                   7.8G     0  7.8G   0% /dev
tmpfs                      7.8G     0  7.8G   0% /dev/shm
tmpfs                      7.8G  8.7M  7.8G   1% /run
tmpfs                      7.8G     0  7.8G   0% /sys/fs/cgroup
/dev/sda1                  494M  138M  357M  28% /boot
tmpfs                      1.6G     0  1.6G   0% /run/user/0
[root@E3-1230-265 ~]# lsblk
NAME              MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda                 8:0    0 931.5G  0 disk
├─sda1              8:1    0   500M  0 part /boot
└─sda2              8:2    0   931G  0 part
  ├─rootvg-rootlv 253:0    0   927G  0 lvm  /
  └─rootvg-swaplv 253:1    0     4G  0 lvm  [SWAP]
sdb                 8:16   0 931.5G  0 disk
└─sdb1              8:17   0 931.5G  0 part
[root@E3-1230-265 ~]#  pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               rootvg
  PV Size               931.02 GiB / not usable 4.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              238341
  Free PE               0
  Allocated PE          238341
  PV UUID               52lO1Y-coo9-QTVK-Ib4U-y2Fm-7w55-zJ0BlH

  WARNING: Device for PV 1D66dK-SyWK-Vm1I-Rgdx-TyA4-tHXB-0LFEGu not found or rejected by a filter.
  --- Physical volume ---
  PV Name               [unknown]
  VG Name               centos
  PV Size               930.51 GiB / not usable 4.00 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              238210
  Free PE               1
  Allocated PE          238209
  PV UUID               1D66dK-SyWK-Vm1I-Rgdx-TyA4-tHXB-0LFEGu

  --- Physical volume ---
  PV Name               /dev/sdb1
  VG Name               centos
  PV Size               931.51 GiB / not usable 4.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              238466
  Free PE               0
  Allocated PE          238466
  PV UUID               RvJSf5-zrH3-hysf-pQ76-ZQ6U-4lqH-nn8ChC
[root@E3-1230-265 ~]# vgdisplay
  --- Volume group ---
  VG Name               rootvg
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               <931.02 GiB
  PE Size               4.00 MiB
  Total PE              238341
  Alloc PE / Size       238341 / <931.02 GiB
  Free  PE / Size       0 / 0
  VG UUID               i16vp8-vgWX-xsEm-Zf2V-yYrq-QmFu-dAEgjE

  WARNING: Device for PV 1D66dK-SyWK-Vm1I-Rgdx-TyA4-tHXB-0LFEGu 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                3
  Open LV               0
  Max PV                0
  Cur PV                2
  Act PV                1
  VG Size               <1.82 TiB
  PE Size               4.00 MiB
  Total PE              476676
  Alloc PE / Size       476675 / <1.82 TiB
  Free  PE / Size       1 / 4.00 MiB
  VG UUID               mVTKvF-LaJB-hkEl-0h21-lYSB-O3wf-OBRE5G

操作后的一些情况:

[root@E3-1230-265 ~]# pvcreate -ff -y /dev/sdb1
  WARNING: Device for PV 1D66dK-SyWK-Vm1I-Rgdx-TyA4-tHXB-0LFEGu not found or rejected by a filter.
  Physical volume "/dev/sdb1" successfully created.
[root@E3-1230-265 ~]#  vgextend rootvg /dev/sdb1
  Volume group "rootvg" successfully extended
[root@E3-1230-265 ~]# vgdisplay
  --- Volume group ---
  VG Name               rootvg
  System ID
  Format                lvm2
  Metadata Areas        2
  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                2
  VG Size               <1.82 TiB
  PE Size               4.00 MiB
  Total PE              476807
  Alloc PE / Size       238341 / <931.02 GiB
  Free  PE / Size       238466 / <931.51 GiB
  VG UUID               i16vp8-vgWX-xsEm-Zf2V-yYrq-QmFu-dAEgjE
[root@E3-1230-265 ~]# lvextend -l +238466 /dev/rootvg/rootlv
  Size of logical volume rootvg/rootlv changed from <927.02 GiB (237317 extents) to 1.81 TiB (475783 extents).
  Logical volume rootvg/rootlv successfully resized.
root@E3-1230-265 ~]#  xfs_growfs /dev/rootvg/rootlv
meta-data=/dev/mapper/rootvg-rootlv isize=512    agcount=4, agsize=60753152 blks
         =                       sectsz=4096  attr=2, projid32bit=1
         =                       crc=1        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=243012608, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=118658, version=2
         =                       sectsz=4096  sunit=1 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 243012608 to 487201792

[root@E3-1230-265 ~]# df -h
Filesystem                 Size  Used Avail Use% Mounted on
/dev/mapper/rootvg-rootlv  1.9T  1.4G  1.9T   1% /
devtmpfs                   7.8G     0  7.8G   0% /dev
tmpfs                      7.8G     0  7.8G   0% /dev/shm
tmpfs                      7.8G  8.7M  7.8G   1% /run
tmpfs                      7.8G     0  7.8G   0% /sys/fs/cgroup
/dev/sda1                  494M  138M  357M  28% /boot
tmpfs                      1.6G     0  1.6G   0% /run/user/0

[root@E3-1230-265 ~]# lsblk
NAME              MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda                 8:0    0 931.5G  0 disk
├─sda1              8:1    0   500M  0 part /boot
└─sda2              8:2    0   931G  0 part
  ├─rootvg-rootlv 253:0    0   1.8T  0 lvm  /
  └─rootvg-swaplv 253:1    0     4G  0 lvm  [SWAP]
sdb                 8:16   0 931.5G  0 disk
└─sdb1              8:17   0 931.5G  0 part
  └─rootvg-rootlv 253:0    0   1.8T  0 lvm  /
赞(2) 打赏
版权归求VPS所有,未经允许不准转载!求VPS » LVM扩容磁盘提示/pvcreate 创建pv出现/Can’t initialize physical volume “/dev/sdb1” of volume group physical volume not initialized.
【声明】:求VPS,易秋网络旗下专业VPS测评站,主要侧重筛选全球质量比较好的VPS、云主机以及独立服务器,并且进行简单测评,仅供参考。因为全国网络差异较大,求VPS的VPS以及独立服务器测评数据仅对当时的测评环境有效。求VPS不强制网友购买本站介绍的VPS以及独立服务器资源,如果网友购买了本站介绍的资源,风险自担!

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏