This is meant as a collaborative place for minor topics related to KVM, Libvirt and QEMU that neither fits in another howto or need a howto of its own. Little things you pick up when using these that might be important to other users. Please add things chronologically with a headline(5). Use headline(3) if you need to split it into sections. Leave some empty spaces between each minor topic. The original author will organizer this article better if needed.
In some or most cases when you start the guest OS/VM OS, you will have a lesser resolution than your host OS or what your GPU display allows. To solve this issue AFTER the installation, you can do this with the bootloader. Since I use Grub mostly, this solution is Grub centric, but there should be similar solutions in other bootloaders.
When you start the VM and Grub2 menu shows, press ctrl+c to enter the console. Use these two lines to gather info about your resolution options.
grub> set pager=1 grub> vbeinfo
Note down a resolution you want to use. It would be a good idea to NOT choose the max resolution, but rather something close to the max resolution.
Edit your /etc/default/grub file
GRUB_CMDLINE_LINUX_DEFAULT="nomodeset" GRUB_GFXPAYLOAD_LINUX=1600x900
Then run grub-mkconfig -o /boot/grub/grub.cfg to make the change effective.
Let's say you have a faulty setup for the virtual disk and QCOW2 images. If everything was working (dicard/trim), when you delete things inside the virtual machine, the disk image should shrink to reflect this. If it doesn't work properly, the image will not shrink, even if you freed alot of space inside the virtual machine, the size of the image remains the same. QCOW2 is thinly provisioned, and will increase in size to refect the content inside the image, but it will not shrink unless there are the correct factors to do so. However, there is quick brilliant workaround for this issue.
Always remember to have proper backups (backup your QCOW2 image before proceeding).
1. Inside the virtual machine, write zeroes to a file until the virtual disk is full. In a terminal:
dd if=/dev/zero of=/some/file
2. Delete the new file (/some/file)
3. Shut down the virtual machine
4. You can use the convert image function to basically move the current image into a new image (convert from qcow2 to qcow2), and it will reflect the actual size of content (throw away zeroes). In a terminal:
qemu-img convert -O qcow2 oldimage.qcow2 newimage.qcow2
This is just a workaround. Ideally you should have your virtual machine setup with a functional discard inside the virtual machine to write zeroes to the areas of deleted files/content. If that works, the image will shrink when you delete files.
* Originally started by zeebra