Expanding a QCOW disk image

If you're using qcow VM images and need to expand storage capacity it is very easy. Simply shutdown the VM, and run the following command on the VM image file.

qemu-img resize /mnt/server/server.qcow +10G

This will add an additional 10GB to the image. Next, boot the VM back up and resize the partitions to use the newly added space. As your / partition is usually last you can just delete your existing partition, and immediately create a new partition with the added 10GB of space. Then you can use resize2fs for ext3/ext4 file systems, or xfs_growfs for xfs file systems to expand the partition to file the added space.

Borrowed from positon.org.

Leave A Reply
All content licensed under the Creative Commons License