Wednesday, May 19, 2010

Oracle VM memory issue

After some first baby steps with Oracle VM I wanted to push this thing a little bit further. So my idea was to have more than a couple of VM's running simultaneously.
The Oracle VM told me however that I had not enough memory to do this.
So I was sitting in front of my dedicated laptop and told the screen that there should be 4 GB inside. The laptop however had one of his funny days and told me (using free and top) that really nothing more than 572 MB would be inside the machine.

Hmm - when a machine tells me something I am the first to listen. So I shutdown everything, got my screwdriver, opened the memory compartment and had a look. Indeed 1 bank of 2GB. I didn't check the second bank as this is hidden underneath the keyboard. Closing the machine and powering it up, I prepared myself for another round of telling it that it should recognize a little bit more than 572 MB.

I examined the dmesg and still it told me that there was only 572 MB inside.

Now imagine, you have just seen 2 GB inside (and hope that 3 or 4 are in there) while the Oracle VM keeps telling me that only a very limited part of that memory was there.

So friends and neighbors, there are two possibilities:
a) The memory was KAPUT
b) Something prevents Linux to see/use it all.

As I could not prove or examine option a) I had a look at option b).

A long long time ago I was pretty good with low level Linux (baking my own kernels and so on). And then I remembered that with Xen it is possible to fool around with the memory during boot time.

Checking the menu.lst of the GRUB I found the following:

# 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/sda2
# initrd /initrd-version.img
#boot=/dev/sda
# Detect64 claims this is 64 bit box
default=2
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Oracle VM Server-ovs (xen-3.4.0 2.6.18-128.2.1.4.9.el5ovs)
root (hd0,0)
kernel /xen-32bit.gz dom0_mem=572M
module /vmlinuz-2.6.18-128.2.1.4.9.el5xen ro root=UUID=ad545ccc-b2bb-450b-a048-a58b22c51cc4
module /initrd-2.6.18-128.2.1.4.9.el5xen.img
title Oracle VM Server-ovs serial console (xen-3.4.0 2.6.18-128.2.1.4.9.el5ovs)
root (hd0,0)
kernel /xen-32bit.gz console=com1,vga com1=57600,8n1 dom0_mem=572M
...

Gotcha!

dom0_mem=572M

So I found the reason for the lack of memory (an amnesic laptop ;-)

Off we go - with a modified menu.lst:

# 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/sda2
# initrd /initrd-version.img
#boot=/dev/sda
# Detect64 claims this is 64 bit box
default=2
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Oracle VM Server-ovs (xen-3.4.0 2.6.18-128.2.1.4.9.el5ovs)
root (hd0,0)
kernel /xen-32bit.gz dom0_mem=572M
module /vmlinuz-2.6.18-128.2.1.4.9.el5xen ro root=UUID=ad545ccc-b2bb-450b-a048-a58b22c51cc4
module /initrd-2.6.18-128.2.1.4.9.el5xen.img
title Andreas VM Server-ovs (xen-3.4.0 2.6.18-128.2.1.4.9.el5ovs)
root (hd0,0)
kernel /xen-32bit.gz dom0_mem=2048M
module /vmlinuz-2.6.18-128.2.1.4.9.el5xen ro root=UUID=ad545ccc-b2bb-450b-a048-a58b22c51cc4
module /initrd-2.6.18-128.2.1.4.9.el5xen.img
title Oracle VM Server-ovs serial console (xen-3.4.0 2.6.18-128.2.1.4.9.el5ovs)
root (hd0,0)
kernel /xen-32bit.gz console=com1,vga com1=57600,8n1 dom0_mem=572M
...

I added the "Andreas Server-ovs" stanza, to prevent me from a re-installation if something would not work.

So after a reboot my laptop tells me that it has the large amount I was hoping for.

As this part of the memory is just the amount Xen is using there is some more in it.

Checking what really is in there:

[root@ovm ~]# xm info | grep memory
total_memory : 3447
free_memory : 1363
node_to_memory : node0:1363

This looks better.
Well i keep it like this for a while and play with my 2GB for now.

1 comment:

Jacco H. Landlust said...

Just a hint: try to set your grub.conf back to what is was and hit "xm list | grep total_memory" ;)