Skip to main content

How to resize KVM virtual machine disk file


In KVM when you create a new virtual machine,  you have to specify the initial size of the disk that the machine is going to use. If later, you realize that initial size is not enough,  you can resize disk image with qemu-img command:

$ qemu-img resize vm-101-disk-1.raw +10G

In the example we have resized the disk image with 10Gb more. The new size can be specified in K for kilobyte, M for megabyte and G for gigabyte.

Inside virtual machine you are going to see new unassigned free space in the disk. If we have partitioned the guest machine with LVM we can easily extend the logical volumes  with the new space we have newly created in the disk. To do that we only have to create a new LVM partition and assign the new partition to the existing volume group.