Forrest logo
back to the qemu-img tool

qemu-img:tldr:8bc51

qemu-img: Increase or decrease image size.
$ qemu-img resize ${image_name-img} ${gigabytes}G
try on your machine

The command "qemu-img resize ${image_name-img} ${gigabytes}G" is used to resize a disk image file in the QEMU (Quick Emulator) hypervisor.

Here's a breakdown of the command components:

  • "${image_name-img}" is a placeholder representing the name and path of the disk image file you want to resize. You need to replace it with the actual name and path of your image file.
  • "${gigabytes}" is also a placeholder representing the desired size for the resized image file. You need to replace it with the actual size you want, specified in gigabytes.

The resize command instructs qemu-img, a command-line tool for manipulating disk images, to increase or decrease the size of the specified image file.

Example usage: Let's say you have an Ubuntu disk image file named "ubuntu.qcow2" located in your /home/user/images directory, and you want to resize it to 20 gigabytes. The command would be:

qemu-img resize /home/user/images/ubuntu.qcow2 20G

After executing the command, QEMU will modify the disk image file to the desired size, effectively resizing it.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the qemu-img tool