Last login: Mon Feb 25 04:53:40 2019 from 10.0.0.3
[root@vmhzpmysql ~]# df -hl
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 4.4G 3.5G 962M 79% /
devtmpfs 483M 0 483M 0% /dev
tmpfs 496M 0 496M 0% /dev/shm
tmpfs 496M 7.0M 489M 2% /run
tmpfs 496M 0 496M 0% /sys/fs/cgroup
/dev/sda1 1014M 156M 859M 16% /boot
tmpfs 100M 0 100M 0% /run/user/0
[root@vmhzpmysql ~]# df -hl /home
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 4.4G 3.5G 962M 79% /
[root@vmhzpmysql ~]# cd /
[root@vmhzpmysql /]# du -h -x --max-depth=1
35M ./etc
40K ./root
405M ./var
0 ./tmp
3.0G ./usr
0 ./home
0 ./media
0 ./mnt
0 ./opt
0 ./srv
3.4G .
[root@vmhzpmysql ~]# ls /dev/sd*
/dev/sda /dev/sda1 /dev/sdb /dev/sdb1
[root@vmhzpmysql ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root centos -wi-ao---- 4.39g
swap centos -wi-ao---- 616.00m
[root@vmhzpmysql ~]# vgs
VG #PV #LV #SN Attr VSize VFree
centos 1 2 0 wz--n- <5.00g 0
[root@vmhzpmysql ~]#
---在虚拟机上新增一块2G硬盘,后重启系统:
[root@vmhzpmysql /]# reboot
Last login: Mon Feb 25 05:48:49 2019 from 10.0.0.3
[root@vmhzpmysql ~]# ls /dev/sd*
/dev/sda /dev/sda1 /dev/sdb /dev/sdb1 /dev/sdc
[root@vmhzpmysql ~]# pvcreate /dev/sdc
Physical volume "/dev/sdc" successfully created.
[root@vmhzpmysql ~]# vps
-bash: vps: command not found
[root@vmhzpmysql ~]# vgs
VG #PV #LV #SN Attr VSize VFree
centos 1 2 0 wz--n- <5.00g 0
[root@vmhzpmysql ~]# vgextend centos /dev/sdc
Volume group "centos" successfully extended
[root@vmhzpmysql ~]# vgs
VG #PV #LV #SN Attr VSize VFree
centos 2 2 0 wz--n- 6.99g <2.00g
[root@vmhzpmysql ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root centos -wi-ao---- 4.39g
swap centos -wi-ao---- 616.00m
[root@vmhzpmysql ~]# lvextend -L +2G /dev/mapper/centos-root
Insufficient free space: 512 extents needed, but only 511 available
[root@vmhzpmysql ~]# lvextend -L +1.9G /dev/mapper/centos-root
Rounding size to boundary between physical extents: 1.90 GiB.
Size of logical volume centos/root changed from 4.39 GiB (1125 extents) to <6.30 GiB (1612 extents).
Logical volume centos/root successfully resized.
[root@vmhzpmysql ~]# vgs
VG #PV #LV #SN Attr VSize VFree
centos 2 2 0 wz--n- 6.99g 96.00m
[root@vmhzpmysql ~]# xfs_growfs /dev/mapper/centos-root
meta-data=/dev/mapper/centos-root isize=512 agcount=4, agsize=288000 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0 finobt=0 spinodes=0
data = bsize=4096 blocks=1152000, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=0
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 1152000 to 1650688
[root@vmhzpmysql ~]# df -hl
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 6.3G 3.5G 2.9G 55% /
devtmpfs 483M 0 483M 0% /dev
tmpfs 496M 0 496M 0% /dev/shm
tmpfs 496M 7.0M 489M 2% /run
tmpfs 496M 0 496M 0% /sys/fs/cgroup
/dev/sda1 1014M 156M 859M 16% /boot
tmpfs 100M 0 100M 0% /run/user/0