Last login: Mon Feb 25 04:53:40 2019 from 10.0.0.3
[root@vmhzpmysql ~]# df -hlFilesystem Size Used Avail Use% Mounted on/dev/mapper/centos-root 4.4G 3.5G 962M 79% /devtmpfs 483M 0 483M 0% /devtmpfs 496M 0 496M 0% /dev/shmtmpfs 496M 7.0M 489M 2% /runtmpfs 496M 0 496M 0% /sys/fs/cgroup/dev/sda1 1014M 156M 859M 16% /boottmpfs 100M 0 100M 0% /run/user/0[root@vmhzpmysql ~]# df -hl /homeFilesystem 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=135M ./etc40K ./root405M ./var0 ./tmp3.0G ./usr0 ./home0 ./media0 ./mnt0 ./opt0 ./srv3.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-rootmeta-data=/dev/mapper/centos-root isize=512 agcount=4, agsize=288000 blks = sectsz=512 attr=2, projid32bit=1 = crc=0 finobt=0 spinodes=0data = bsize=4096 blocks=1152000, imaxpct=25 = sunit=0 swidth=0 blksnaming =version 2 bsize=4096 ascii-ci=0 ftype=0log =internal bsize=4096 blocks=2560, version=2 = sectsz=512 sunit=0 blks, lazy-count=1realtime =none extsz=4096 blocks=0, rtextents=0data blocks changed from 1152000 to 1650688[root@vmhzpmysql ~]# df -hlFilesystem Size Used Avail Use% Mounted on/dev/mapper/centos-root 6.3G 3.5G 2.9G 55% /devtmpfs 483M 0 483M 0% /devtmpfs 496M 0 496M 0% /dev/shmtmpfs 496M 7.0M 489M 2% /runtmpfs 496M 0 496M 0% /sys/fs/cgroup/dev/sda1 1014M 156M 859M 16% /boottmpfs 100M 0 100M 0% /run/user/0