If we want the ultimate size to be 30 GB, we use 30G. You can specify the ultimate size or the size you want to add preceeded by + for adding and – for reducing. I/O size (minimum/optimal): 512 bytes / 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes Check the size of the disk using fdisk fdisk -l /var/lib/libvirt/images/almalinux8.qcow2 Disk /var/lib/libvirt/images/almalinux8.qcow2: 20 GiB, 21478375424 bytes, 41949952 sectors.virsh snapshot-list -domain virsh snapshot-delete -domain -snapshotname You can delete the snapshots from GUI or delete using the command snapshot-delete. Note that you have to have backed up the VM before deleting snapshots. Next, you need to delete the VM snapshots if there are any.The first step is to power off the VM before moving to the next steps.
QEMU IMG RESIZE HOW TO
In this guide, we will see how to extend KVM virtual machine disk size using the first method. Extending a powered-off VM Disk entirely from a host.Shutting down the VM, extending using qemu-img, then start the VM to complete disk expansion.There are different ways in which you can extend KVM virtual machine disk size: You can then power on the clone and extend the disk as follows.
Or clone the current machine state and extend the disk on the cloned VM.Ĭheck our guide on how to clone KVM Virtual Machines. You can make a copy of the qcow2 cp /var/lib/libvirt/images/almalinux8.qcow2 /home/vms/almalinux8-COPY.qcow2 I recommended that you make a backup of the virtual machine you want to the extend the disk before you can proceed to avoid loses in case of any mistake. Vda /var/lib/libvirt/images/almalinux8.qcow2 Let’s locate the disk path of the VM whose disk is to be extended using the following command: virsh domblklist -domain almalinux8Ĭhange the last part (almalinux8) to the name of your VM. In our case, we will be extending the almalinux8 VM. Now select a VM you want to resize from list provided by the command above. You can also use the GUI tool Virtual Machine Manager (VMM) to view the details/state of VMs. You will get a list similar to the following: Id Name State Use virsh command to check the list of all running VMs so as to find the correct name of the VM/domain you need to extend the disk. Get the Correct Name of the Domain/Virtual Machineīefore you proceed, you need to check the properties of the VM you need to extend. Other formarts such as vmdk,qcow,cow, raw e.t.c can be extended in a similar way. In this guide, we will use the qcow2 disk format, which is the default in KVM.