First, the expansion of virtual machine host system disk
surroundings | File system |
---|---|
CentOS 7 | XFS |
1.1 View Virtual Machine (following on the host)
[root@office-prd-kvm-01 ~]# virsh list
4 office-com-ldap-01 running
View 1.2 virtual machine system disk
[root@office-prd-kvm-01 ~]# virsh domblklist office-com-ldap-01
目标 源
------------------------------------------------
vda /home/office-com-ldap-01/office-com-ldap-01.system.qcow2
hda -
1.3 size of the original system disk
[root@office-prd-kvm-01 ~]# qemu-img info /home/office-com-ldap-01/office-com-ldap-01.system.qcow2
virtual size: 15G (16106127360 bytes)
[root@office-prd-kvm-01 ~]# virsh shutdown office-com-ldap-01 很重要要先关闭虚拟机
1.4 after expansion
[root@office-prd-kvm-01 ~]# qemu-img resize /home/office-com-ldap-01/office-com-ldap-01.system.qcow2 +5G
[root@office-prd-kvm-01 ~]# qemu-img info /home/office-com-ldap-01/office-com-ldap-01.system.qcow2
virtual size: 20G (21474836480 bytes)
[root@office-prd-kvm-01 ~]# virsh start office-com-ldap-01
Second, the virtual machine View (following in the virtual machine kvm)
2.1 to see if increased
2.2 unallocated space to partition
2.3 refresh partition table
[root@office-com-ldap-01 ~]# partprobe
2.4 added to volume group (dev / centos / root)
[root@office-com-ldap-01 ~]# pvcreate /dev/vda3
Physical volume "/dev/vda3" successfully created.
[root@office-com-ldap-01 ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/vda2 centos lvm2 a-- <9.00g 0
/dev/vda3 lvm2 --- 5.00g 5.00g
[root@office-com-ldap-01 ~]# vgextend centos /dev/vda3
Volume group "centos" successfully extended
[root@office-com-ldap-01 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
centos 2 2 0 wz--n- 13.99g <5.00g
[root@office-com-ldap-01 ~]# lvextend -l +100%FREE /dev/mapper/centos-root
New size given (1279 extents) not larger than existing size (2047 extents)
[root@office-com-ldap-01 ~]# xfs_growfs /dev/mapper/centos-root
[root@office-com-ldap-01 ~]# df -Th
Three, windows open Disk Manager Click consolidated volume on it simpler than linux