How to resize a virtual disk of KVM

I test it for qcow2 format. Other formats are TBA.

qemu-img resize kvm1.qcow2 +20G
cp kvm1.qcow2 kvm1-orig.qcow2
virt-resize --expand /dev/sda1 kvm1-orig.qcow2 kvm1.qcow2

Reference: https://fatmin.com/2016/12/20/how-to-resize-a-qcow2-image-and-filesystem-with-virt-resize/

I test it for qcow2 format. Other formats are TBA.

qemu-img resize kvm1.qcow2 +20G
cp kvm1.qcow2 kvm1-orig.qcow2
virt-resize --expand /dev/sda1 kvm1-orig.qcow2 kvm1.qcow2

Reference: https://fatmin.com/2016/12/20/how-to-resize-a-qcow2-image-and-filesystem-with-virt-resize/

Answered by harryxiyou.

One comment:

  1. The right answer is:

    cp kvm1.qcow2 kvm1-orig.qcow2
    qemu-img resize kvm1.qcow2 +20G
    virt-resize –expand /dev/sda1 kvm1-orig.qcow2 kvm1.qcow2

    First copy, second resize the new image, third resize partition.

Leave a Reply

Your email address will not be published. Required fields are marked *