O'Reilly logo

KVM Virtualization Cookbook by Konstantin Ivanov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it...

The next steps demonstrate how to add additional space to the raw image we created earlier, extend the root partition, and resize the filesystem. By the end of this recipe, the original raw image filesystem size should have changed from 10G to 20G.

  1. Obtain the current size of the image:
root@kvm:~# qemu-img info debian.img    image: debian.imgfile format: rawvirtual size: 10G (10737418240 bytes)disk size: 848M    root@kvm:~#
  1. Add additional 10 GB to the image:
root@kvm:~# qemu-img resize -f raw debian.img +10GB    Image resized.    root@kvm:~#
Please note that not all image types support resizing. In order to resize such an image, you will need to convert it to raw image first using the qemu-img convert command.
  1. Check the new size ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required