Sunday, March 6, 2011

VM - Speeding Up A Linux Guest

Recently I was having an issue with a my CentOS guest running slowly in VirtualBox. Evidently this has something to do with the interrupt checking interval of the Linux system being at 1GHz.

To force the guest to use an interrupt check at only 100Hz, the divider=10 kernel option should be set.

Follow these steps:
  • Use the root account (su)
  • Edit the /boot/grub/grub.conf file
  • add "divider=10" to the end of the kernel line
Here is a sample of the modified grub.conf.
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
# initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-194.32.1.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-194.32.1.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet divider=10
initrd /initrd-2.6.18-194.32.1.el5.img
title CentOS (2.6.18-194.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-194.el5 ro root=/dev/VolGroup00/LogVol00 rhgb quiet divider=10
initrd /initrd-2.6.18-194.el5.img

You can use cat /proc/cmdline in order to check if it took.
~ $ cat /proc/cmdline
ro root=/dev/VolGroup00/LogVol00 rhgb quiet divider=10