笺注:这是在 CentOS7.8安装KVM 的基础上进行的。
VMware Workstation给虚拟机添加一块硬盘:
笺注:虚拟机重启后,才能识别新硬盘。
查看硬盘分区结构:
lsblk
查看第二块硬盘的分区情况:
fdisk -l /dev/sdb
查看系统默认的卷组:
[root@ser1 ~]# vgdisplay
--- Volume group ---
VG Name centos
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 5
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 4
Open LV 4
Max PV 0
Cur PV 1
Act PV 1
VG Size 59.80 GiB
PE Size 4.00 MiB
Total PE 15309
Alloc PE / Size 15308 / <59.80 GiB
Free PE / Size 1 / 4.00 MiB
VG UUID D1f1Nn-Y4qc-ZPqS-QpSk-mbHb-SQmZ-Gd1R72
查看系统所有的逻辑卷:
[root@ser1 ~]# lvdisplay
--- Logical volume ---
LV Path /dev/centos/swap
LV Name swap
VG Name centos
LV UUID dqH4dF-Yfc1-OYDo-Mcku-jKc0-S367-F5Xoh5
LV Write Access read/write
LV Creation host, time ser1.q7.com, 2020-08-11 01:38:35 +0800
LV Status available
# open 2
LV Size 8.00 GiB
Current LE 2048
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:1
--- Logical volume ---
LV Path /dev/centos/var
LV Name var
VG Name centos
LV UUID qHu29I-pckv-X6eo-0PgS-ni1P-iNdG-O3rp3O
LV Write Access read/write
LV Creation host, time ser1.q7.com, 2020-08-11 01:38:35 +0800
LV Status available
# open 1
LV Size 10.00 GiB
Current LE 2560
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:2
--- Logical volume ---
LV Path /dev/centos/home
LV Name home
VG Name centos
LV UUID o7ZXdE-8XmF-Wrmc-rvo9-YutT-a5e5-I8ZfIH
LV Write Access read/write
LV Creation host, time ser1.q7.com, 2020-08-11 01:38:36 +0800
LV Status available
# open 1
LV Size 18.00 GiB
Current LE 4608
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:3
--- Logical volume ---
LV Path /dev/centos/root
LV Name root
VG Name centos
LV UUID fA593N-3bE5-8dgo-Yabg-bcuM-mMQL-7Rm4Lu
LV Write Access read/write
LV Creation host, time ser1.q7.com, 2020-08-11 01:38:36 +0800
LV Status available
# open 1
LV Size <23.80 GiB
Current LE 6092
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0
查看某个的逻辑卷:
[root@ser1 ~]# lvdisplay /dev/centos/var
--- Logical volume ---
LV Path /dev/centos/var
LV Name var
VG Name centos
LV UUID qHu29I-pckv-X6eo-0PgS-ni1P-iNdG-O3rp3O
LV Write Access read/write
LV Creation host, time ser1.q7.com, 2020-08-11 01:38:35 +0800
LV Status available
# open 1
LV Size 10.00 GiB
Current LE 2560
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:2
创建物理卷:
[root@ser1 ~]# pvcreate /dev/sdb
Physical volume "/dev/sdb" successfully created.
扩大卷组:
[root@ser1 ~]# vgextend centos /dev/sdb
Volume group "centos" successfully extended
扩展逻辑卷(不能把空间全部分完,要留0.1G!)
[root@ser1 ~]# lvextend -L +29.9G /dev/centos/var
Rounding size to boundary between physical extents: 29.90 GiB.
Size of logical volume centos/var changed from 10.00 GiB (2560 extents) to 39.90 GiB (10215 extents).
Logical volume centos/var successfully resized.
刷新xfs文件系统:
xfs_growfs /var
/var分区扩展成功:
[root@ser1 ~]# df -hT
文件系统 类型 容量 已用 可用 已用% 挂载点
devtmpfs devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs tmpfs 1.9G 13M 1.9G 1% /run
tmpfs tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/mapper/centos-root xfs 24G 3.9G 20G 17% /
/dev/sda1 xfs 197M 147M 51M 75% /boot
/dev/mapper/centos-home xfs 18G 37M 18G 1% /home
/dev/mapper/centos-var xfs 40G 223M 40G 1% /var
tmpfs tmpfs 378M 24K 378M 1% /run/user/0
备注:/var分区扩展无需重启系统;重启系统后,系统也正常。
相关文章:
CentOS8_LVM_扩大根分区
#################################
#################################
亲,学习研究也要劳逸结合哦,来我微店逛逛,买点东西好好犒劳犒劳自己和家人吧^_^^_^
苏泊尔多功能电热锅韩式电火锅8-10人家用电炒锅不粘锅电锅电烤锅
苏泊尔电火锅多功能家用电热锅不沾锅一体电煮锅宿舍4-6人
|