Change virtual disk size¶
On the hypervisor¶
Display disk partition informations :
qemu-img info /path/to/the/disk/vmname.qcow2
Go to that folder
Stop the VM¶
virsh destroy vmname
Backup the disk¶
cp vmname.qcow2 vmname.qcow2.bak
Show disk size¶
qemu-img info vmname.qcow2
Add or substract size¶
qemu-img resize vmname.qcow2 +10G
Copy the disk¶
cp vmname.qcow2 vmname-orig.qcow2
Extend the disk¶
virt-resize --expand /dev/vda2 vmname-orig.qcow2 vmname.qcow2
Check the changes¶
Option 1 : qemu-img info /space/volumes/vmname.qcow2
Option 2 : virt-filesystems --long -h --all -a vmname.qcow2
Start the VM¶
virsh start vmname
Connect to the VM¶
Display partitions informations¶
df -h
Display logical volume informations¶
lvdisplay
Display group volume informations¶
vgdisplay
Extends filesystem size (centos)¶
option 1 : lvextend -L +10G /dev/mapper/centos-root
option 2 : resize2fs /dev/mapper/centos-root
xfs_growfs /dev/mapper/centos-root
Reboot¶
reboot
On the hypervisor¶
Remove the disk backup¶
rm vmname.qcow2.bak vmname-orig.qcow2