[Linux]LVM扩展卷 (2)

pvcreate

-----查询当前PV------------------------- [root@Nexus3 ~]# pvdisplay --- Physical volume --- PV Name /dev/sda2 VG Name centos PV Size <19.00 GiB / not usable 3.00 MiB Allocatable yes (but full) PE Size 4.00 MiB Total PE 4863 Free PE 0 Allocated PE 4863 PV UUID 2MrxDf-dTQK-I7iK-5VUs-bcrv-Af2t-fVaAiL -----创建新的PV------------------------- [root@Nexus3 ~]# pvcreate /dev/sda3 Physical volume "/dev/sda3" successfully created. [root@Nexus3 ~]# pvdisplay --- Physical volume --- PV Name /dev/sda2 VG Name centos PV Size <19.00 GiB / not usable 3.00 MiB Allocatable yes (but full) PE Size 4.00 MiB Total PE 4863 Free PE 0 Allocated PE 4863 PV UUID 2MrxDf-dTQK-I7iK-5VUs-bcrv-Af2t-fVaAiL -----这个是我们创建的------------------------- "/dev/sda3" is a new physical volume of "80.00 GiB" --- NEW Physical volume --- PV Name /dev/sda3 VG Name PV Size 80.00 GiB Allocatable NO PE Size 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID kfO9Yc-ToQb-2vnf-8muc-MNsZ-oxJV-vi1vVe 扩展卷组

vgextend

-----查看当前VG------------------------- [root@Nexus3 ~]# vgdisplay --- Volume group --- -----VG Name需要用到------------------------- VG Name centos 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 <19.00 GiB PE Size 4.00 MiB Total PE 4863 Alloc PE / Size 4863 / <19.00 GiB Free PE / Size 0 / 0 VG UUID Wx79ds-a3LO-VhXo-HJdk-fr0X-C9UX-KOqfSK -----扩展卷组------------------------- [root@Nexus3 ~]# vgextend centos /dev/sda3 Volume group "centos" successfully extended 逻辑卷扩展

lvextend -l +100%free /mapper/centos-root> #前面df -hT看到的信息

-----查看逻辑卷------------------------- [root@Nexus3 ~]# lvdisplay --- Logical volume --- LV Path /dev/centos/swap LV Name swap VG Name centos LV UUID bgsynr-YUZE-LX2j-NIgG-sqqU-wVxb-GIZDg7 LV Write Access read/write LV Creation host, time localhost, 2019-11-22 14:16:37 +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 lkRm4c-8g6X-ZWm2-Y86h-aKXs-i2lN-ZKdGaD LV Write Access read/write LV Creation host, time localhost, 2019-11-22 14:16:37 +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@Nexus3 ~]# lvextend -l +100%free /dev/mapper/centos-root Size of logical volume centos/root changed from <17.00 GiB (4351 extents) to 96.99 GiB (24830 extents). Logical volume centos/root successfully resized. 动态格式化扩容磁盘 [root@Nexus3 ~]# xfs_growfs /dev/mapper/centos-root meta-data=http://www.likecs.com/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 25425920 验证 [root@Nexus3 ~]# df -hT Filesystem Type Size Used Avail Use% Mounted on devtmpfs devtmpfs 3.9G 0 3.9G 0% /dev tmpfs tmpfs 3.9G 0 3.9G 0% /dev/shm tmpfs tmpfs 3.9G 8.9M 3.9G 1% /run tmpfs tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup -----100G------------------------- /dev/mapper/centos-root xfs 97G 1.2G 96G 2% / /dev/sda1 xfs 1014M 136M 879M 14% /boot tmpfs tmpfs 799M 0 799M 0% /run/user/0 END

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/zyxyfs.html