About Me

Curriculum Vitae

A brief list of my current skill set

Bloggybits

Gosh This Site Is Old
Thursday, 18th November 2021, 22:08

I might update this one day, but until I do take a lot of it with a pinch of salt!

Automatically Cropping Images is Hard
Monday, 21st October 2013, 19:00

But maybe we can use face detection?

The Git Cheat Sheet
Friday, 6th September 2013, 11:30

for github, bitbucket, that kinda stuff

CoffeeScript and TypeScript are a Burden
Saturday, 17th August 2013, 11:21

Be sure you understand the cons as well as the pros

Changing the Order of the jQuery Event Queue
Wednesday, 3rd July 2013, 20:27

It's just a push to the left

How Do Spammers Get My Email Address?
Wednesday, 15th May 2013, 18:03

I think these days I have a pretty good idea

XSLT, node.js 0.10 and a Fun Two Days of Native Modules and Memory Leaks
Thursday, 25th April 2013, 17:14

documentation makes things less cryptic, so lets not write much of it

Fixing CentOS high cpu usage when running as a virtual machine under VirtualBox
Sunday, 21st April 2013, 20:28

innotek rocks! I mean Sun... I mean Oracle...

Repairing a dK'Tronics Keyboard and Scoping Out a ZX Spectrum 48k - Part One
Sunday, 17th March 2013, 23:51

What signals inside of it actually look like

Tabs vs Spaces and Why You Should Always Use Tabs
Monday, 4th March 2013, 19:51

Spaces are bad, just real bad

Why you should ban Amazon's Cloud IPs
Thursday, 27th December 2012, 14:50

And how to do it in nginx, Merry Christmas Amazon

Building Better jQuery DOM Inserts
Thursday, 20th December 2012, 15:18

Break it down baby

SEO Companies - Don't Waste Your Money
Wednesday, 12th December 2012, 16:16

Spammers by any other name

Pulse Width Modulation and How 1-bit Music Works
Wednesday, 5th December 2012, 23:34

Beep beep multi-channel!

Making PDFs from HTML on your webapp in CentOS
Thursday, 29th November 2012, 14:00

Not as easy as it should be

Projects and Sillyness

MAME Cabinet Diary

How I built my own arcade cabinet

Loading Screen Simulator

I don't miss the ZX Spectrum, I still use it!

The Little Guy Chat Room

It's a Pitfall inspired chat room

GPMad MP3

A fully featured MP3 player what I wrote

GP Space Invaders

My first little emulator

GP32 Development Page

Some info and links about this cute little handheld

Disney Nasties

Uncensored images, you must be 18 to view them

Diary of a Hamster

Learn about how hamsters think, first hand

Utilities

Time Calculator

A simple little online utility for working out how many hours to bill a client

A Few Links

Fixing CentOS high cpu usage when running as a virtual machine under VirtualBox
Sunday, 21st April 2013, 20:28

Wow I've been insanely busy since the beginning of this year, and have only just managed to force myself into a blog entry for the first time since March. For that I feel very bad, poor site being neglected, the RSPCW's might take it away from me if I'm not careful.

Maybe a quick entry will keep them at bay for a short while!

To the point...

I recently moved a website from VMware Player to Sun... I mean Oracle VirtualBox. The process was a bit annoying for two reasons, the first of which involved the VM just refusing to get very far with booting.

As a general rule, I'm a big fan of CentOS for servers, because it is a very server oriented flavour of Linux and most importantly each release has a very long support cycle. Desktop users don't tend to care about support cycles very much, but when it comes to servers their importance is critical.

The last thing you want to do is a complete reinstall on a server box, when there is no real reason not to other than the fact security and stability updates are no longer being made available for it.

But there is one thing about it that irritates me, and that is the boot up process. Remember how Windows XP would blue screen if you did something drastic like change the motherboard? Well CentOS does something similar, it refuses to boot very far.

Migrating CentOS from VMWare to Virtualbox

So the first thing you need to do, is solve this issue. One of the first parts of the whole CentOS boot process is the loading of a RAM disk image which is used to initialise parts of the hardware before it loads the rest. This isn't a big generic monster which handles every piece of hardware you can think of, oh no. It's a custom created machine specific RAM disk that was made for your specific machine during installation.

Only we just changed our virtual hardware didn't we, so it doesn't work does it.

But it's not the hardest thing in the world to fix thankfully, and you can do it using this helpful webpage on the CentOS website.

You will need the first install CD image to boot to, and you'll also have to work out what the right .img file in the /mnt/sysimage directory applies to your current system, since after a year or two of yum updates, you'll have a fair few out of date ones in there.

Done that? Now to fix the high CPU!

In theory, at this stage you are now booting into a working CentOS installation, though you may have to tweak things like network set-up. The easiest thing to do there though is to make sure your VirtualBox machine has the same MAC address for any network cards you were using in VMware Player.

But you'll probably be hitting a snag about now, whilst the idle CPU usage for your host machine when running this VM under VMware was... well pretty idle, suddenly you are probably finding VirtualBox is going a bit nuts even when the VM itself is showing it's CPU to be doing nothing.

Don't panic! The fix for this is easy.

Boot up your CentOS VM, log in and type edit the file /etc/grub.conf with the text editor of your choice. VI if you like, or Joe if you are like me and prefer an editor without cryptic (or at least less cryptic) keyboard shortcuts.

Now, find the line which starts with kernel and lists that long filename which you probably already worked out when re-making the RAM disk above. It will most likely be the top entry. And then add the argument divider=10 on the end.

Here is mine for reference:

kernel /vmlinuz-2.6.18-348.3.1.el5 ro root=/dev/VolGroup00/LogVol00 vga=791 divider=10

With that done, all you need to do now is reboot and your CPU should be lower once more!

Want to know what you just did? Well the Kernel was trying to create interrupts at 1,000 per second, at least I think that is the rate it does it by default, feel free to correct me if I'm wrong.

The divider line changes that to 100 times a second, which is a lot less, and a lot less hassle for VirtualBox. :)

Comments

Add Your Own Comment