Fix display size on libvirt/Qemu guest

Lot of times I find myself of VM that does not correctly resize the screen display and that is literally nuisance. So, here is quick and dirty fix for this.

First you need to find out information about your display with following command:

xrandr -q

And you will see output like this:

Screen 0: minimum 320 x 200, current 1920 x 1080, maximum 8192 x 8192
Virtual-0 connected primary 1920×1080+0+0 0mm x 0mm
1024×768      59.92 +
1920×1200     59.88
1920×1080     59.96*
1600×1200     59.87
1680×1050     59.95
1400×1050     59.98
1280×1024     59.89
1440×900      59.89
1280×960      59.94
1280×854      59.89
1280×800      59.81
1280×720      59.86
1152×768      59.78
800×600       59.86
848×480       59.66
720×480       59.71
640×480       59.38
Virtual-1 disconnected
Virtual-2 disconnected
Virtual-3 disconnected

This tells you the currently configured screens and the resolutions. In my case, the only connected screen as seen above is “Virtual-0“. Now, time to do the magic.

You just need to set the correct display/screen size with following command:

xrandr --output Virtual-0 --mode 1920x1200

Also, if you need to add a new resolution, first you need to create a modeline with following command:

cvt 1200 1024

You will get output like :

# 1200×1024 59.82 Hz (CVT) hsync: 63.59 kHz; pclk: 101.75 MHz
Modeline “1200x1024_60.00”  101.75  1200 1280 1400 1600  1024 1027 1037 1063 -hsync +vsync

 

and then set that with:

xrandr --output Virtual-0 --mode 1200x1024

Hope this helps you do away with some really pathetic display sizes in VM 🙂

Are you swapped? Increase the performance of Linux machine.

With the ever increasing cost of the Hardware, the amount of physical RAM available on the system is increasing day by day. For example, couple of years back, I had a system which was very high end Desktop with 256MB RAM and today I have a 2GB RAM Desktop. So, whats the point.

The Linux systems (right word should be kernel) are desiged to use both RAM and swap partition. Swap partition is a partition on Hard disk and is used mostly like RAM. Problem is that HDD access is always slower than RAM access and hence inherently, the system will work little slower even if you have enough RAM not to use swap. The term \”swappiness\” is used to determine how the kernel should try to seam-balance between the use of RAM and swap. By default, most of the distro\’s have a swappiness of 60. A higher value of swappiness means that the RAM will be swapped out faster.

There are two ways to look at the swappiness:

1) If the user has a higher swappiness then the used memory will be swapped faster to the swap and thus free\’ing the RAM for other useful purposes.

2) A lower value of swappiness would mean that bloaty applications will not be swapped and thus when the user returns to the application, the application would load faster or rather look faster as there will be no swapping from the swap to the RAM.

I personally keep the swappiness to a value of 100 in the Desktop. But then, anyway I kill firefox as soon as I am done and restart when required.

If you see that the RAM is underutilized or feel that the system performance is not that good then you can tickle with this setting and set it to 10-15. How to do it :

Login as roo (\”su -\”)

echo 15 > /proc/sys/vm/swappiness

This will take effect immediately, but if you want to change this value permanently then you can do this(again as root):

echo \”sys.vm.swappiness = 10\” > /etc/sysctl.conf

So play with your swappiness 🙂

\"Enhanced
Enhanced by Zemanta

Access the disk image created by Qemu using guestfish in Fedora.

If you are used to using Qemu for doing some experiments with different distro\’s then you would also understand the problem of having to do ftp/ssh to copy the files from virtual machine to local machine. Also you have to run the machine to do that. How would you like to have a application that can help you copy the files to and from the  image without having to run the VM. That\’s exactly what the guestfish does. How to do it, quick demo here:

sudo yum install guestfish

Now once installed you can run guestfish by typing guestfish. Extensive help is available with help command so I am just giving pointers here to get you started:

First add the drive image with

add-drive <image name>

Start a qemu sub-process inside guestfish

launch

Now mount the drive using

mount /dev/sda1 /

you can list the devices using

list-devices

Now you can use upload, download, ls, mkdir, cat et. al. See help for more details.