作者:momosu1028_738_636 | 来源:互联网 | 2023-05-26 23:33
(一)虚拟机vmware centos7 扩展磁盘空间[root@aubin ~]# vgdisplay— Volume group —VG Name centosSys
(一)虚拟机vmware centos7 扩展磁盘空间
[root@aubin ~]# vgdisplay
— Volume group —
VG Name centos
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 23.99 GiB
PE Size 4.00 MiB
Total PE 6142
Alloc PE / Size 4863 / <19.00 GiB
Free PE / Size 1279 / <5.00 GiB
VG UUID jasglx-OPLA-G0g2-qpgP-wmS3-nISE-JylLNv
注意这个名字
[root@aubin ~]# mkfs.xfs -f /dev/sda3
meta-data=/dev/sda3 isize=512 agcount=4, agsize=1310720 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=5242880, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
[root@aubin ~]# pvcreate -f /dev/sda3
WARNING: Device for PV dRKew5-i08K-vSGQ-okUo-Qx9M-DY2e-CBGUN6 not found or rejected by a filter.
Couldn’t find device with uuid dRKew5-i08K-vSGQ-okUo-Qx9M-DY2e-CBGUN6.
Wiping xfs signature on /dev/sda3.
Physical volume “/dev/sda3” successfully created.
[root@aubin ~]# vgextend centos /dev/sda3
WARNING: Device for PV dRKew5-i08K-vSGQ-okUo-Qx9M-DY2e-CBGUN6 not found or rejected by a filter.
Couldn’t find device with uuid dRKew5-i08K-vSGQ-okUo-Qx9M-DY2e-CBGUN6.
WARNING: Device for PV dRKew5-i08K-vSGQ-okUo-Qx9M-DY2e-CBGUN6 not found or rejected by a filter.
Volume group “centos” successfully extended
[root@aubin ~]# lvdisplay
WARNING: Device for PV dRKew5-i08K-vSGQ-okUo-Qx9M-DY2e-CBGUN6 not found or rejected by a filter.
Couldn’t find device with uuid dRKew5-i08K-vSGQ-okUo-Qx9M-DY2e-CBGUN6.
— Logical volume —
LV Path /dev/centos/swap
LV Name swap
VG Name centos
LV UUID Xgfxxk-caKK-3PtU-m8Hp-1WVU-N5na-NjytY6
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2019-03-28 02:19:24 +0800
LV Status available
#open 2
LV Size 2.00 GiB
Current LE 512
Segments 1
Allocation inherit
Read ahead sectors auto
-currently set to 8192
Block device 253:1
— Logical volume —
LV Path /dev/centos/root
LV
Name root
VG Name centos
LV UUID P4AJcd-iOZf-sywl-Acrq-Ge7a-QrTx-3GYgkz
LV Write Access read/write
LV Creation host, time localhost.localdomain, 2019-03-2802:19:25 +0800
LV Status available # open
1 LV Size <17.00 GiB Current LE 4351
Segments 1
Allocation inherit
Read ahead sectors auto
-currently set to 8192
Block device 253:0
注意此处的路径(标红的)
[root@aubin ~]# lvextend /dev/centos/root /dev/sd3
WARNING: Device for PV dRKew5-i08K-vSGQ-okUo-Qx9M-DY2e-CBGUN6 not found or rejected by a filter.
Couldn’t find device with uuid dRKew5-i08K-vSGQ-okUo-Qx9M-DY2e-CBGUN6.
Cannot change VG centos while PVs are missing.
Consider vgreduce --removemissing.
Cannot process volume group centos
[root@aubin ~]# vgreduce --removemissing vgname
Volume group “vgname” not found
Cannot process volume group vgnam
[root@aubin ~]# vgreduce --removemissing centos
WARNING: Device for PV dRKew5-i08K-vSGQ-okUo-Qx9M-DY2e-CBGUN6 not found or rejected by a filter.
Couldn’t find device with uuid dRKew5-i08K-vSGQ-okUo-Qx9M-DY2e-CBGUN6.
Wrote out consistent volume group centos.
[root@aubin ~]# vgdisplay
— Volume group —
VG Name centos
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 6
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 38.99 GiB
PE Size 4.00 MiB
Total PE 9982
Alloc PE / Size 4863 / <19.00 GiB
Free PE / Size 5119 / <20.00 GiB
VG UUID jasglx-OPLA-G0g2-qpgP-wmS3-nISE-JylLNv
[root@aubin ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 17G 17G 553M 97% /
devtmpfs 894M 0 894M 0% /dev
tmpfs 910M 0 910M 0% /dev/shm
tmpfs 910M 11M 900M 2% /run
tmpfs 910M 0 910M 0% /sys/fs/cgroup
/dev/sda1 1014M 236M 779M 24% /boot
tmpfs 182M 4.0K 182M 1% /run/user/42
tmpfs 182M 20K 182M 1% /run/user/0
[root@aubin ~]# xfs_growfs /dev/centos/root
meta-data=/dev/mapper/centos-root isize=512 agcount=4,
agsize=1113856 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0 data = bsize=4096 blocks=4455424, imaxpct=25
= sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 ftype=1 log =internal bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0,
rtextents=0
[root@aubin ~]# df -h
Filesystem Size Used Avail Use%
Mounted on /dev/mapper/centos-root 17G 17G 553M 97% / devtmpfs
894M 0 894M 0% /dev tmpfs 910M 0 910M
0% /dev/shm tmpfs 910M 11M 900M 2% /run tmpfs
910M 0 910M 0% /sys/fs/cgroup /dev/sda1 1014M
236M 779M 24% /boot tmpfs 182M 4.0K 182M 1%
/run/user/42 tmpfs 182M 20K 182M 1%
/run/user/0
[root@aubin ~]# lvextend /dev/centos/root /dev/sd3
Physical Volume
“/dev/sd3” not found in Volume Group “centos”.
[root@aubin ~]# lvextend /dev/centos/root /dev/sda3
Size of logical volume centos/root changed from <17.00 GiB (4351 extents) to 36.99 GiB (9470 extents). Logical volume centos/root successfully resized.
[root@aubin ~]# xfs_growfs /dev/centos/root
meta-data=/dev/mapper/centos-root isize=512 agcount=4,
agsize=1113856 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0 data = bsize=4096 blocks=4455424, imaxpct=25
= sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 ftype=1 log =internal bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1 realtime =none extsz=4096 blocks=0,
rtextents=0 data blocks changed from 4455424 to 9697280
[root@aubin ~]# df -h
Filesystem Size Used Avail Use%
Mounted on /dev/mapper/centos-root 37G 17G 21G 45% / devtmpfs
894M 0 894M 0% /dev tmpfs 910M 0 910M
0% /dev/shm tmpfs 910M 11M 900M 2% /run tmpfs
910M 0 910M 0% /sys/fs/cgroup /dev/sda1 1014M
236M 779M 24% /boot tmpfs 182M 4.0K 182M 1%
/run/user/42 tmpfs 182M 20K 182M 1%
/run/user/0