Virtualization Tips

Screen resolution of CentOS guests

In the /etc/X11/xorg.conf file add the following section:

Section "Monitor"
Identifier "Monitor0"
HorizSync 31.5-90
EndSection

Text only

and in the Screen section add the following line:

Monitor  "Monitor0"

Once restarted the X-server (for instance after a log-out) you will be able to set the screen resolution by going to the menu “System” -> “Preferences” -> “Screen resolution”.

Resizing volumes

On fedora: First stop the VM, then install the package libguestfs-tools. Finally use the tool virt-resize. For more info check the man page. This tool doesn’t correctly copy the GRUB install, to install GRUB2 start the vm with a recovery disk (in the install disc of CentOS) and chroot to the installed system and finally run grub-install /dev/vda.

Adding a pool with disk images

First create an xml file as follows:

<pool type="dir">
<name>virtimages</name>
<target>
<path>/var/lib/virt/images</path>
</target>
</pool>

XML

Then run the command:

virsh pool-create file.xml