Wednesday, December 29, 2010

How to enable Hot-add Memory in Linux RHEL 5 ?

What if you have Hot-added memory in your RHEL 5 server but it's still displaying Last memory configuration ?

Step : 

1. Check if two modules are loaded properly by,

     #lsmod | grep acpi


                 acpiphp                      43673  0
                 acpi_memhotplug        42199  0

If not loaded, follow below steps;


     #modprobe acpiphp
     #modprobe acpi_memhotplug


2. Now increase your server memory with Hot-add memory module. This will be done by Hardware engineer directly on the server, i am not talking about on OS level.



3. Make a shell script like "memory_online.sh" with below contents,

"for a in /sys/devices/system/memory/memory*/state; 
 do 
 echo 'online' > "$a" 
 done" and then
 "cat /sys/devices/system/memory/memory*/state"

Save it & exit

For Ubuntu you have to try with another script as below,

#!/bin/sh
i=0
while [ $i -lt 4500 ]
do
   if [ -f /sys/devices/system/memory/memory$i/state ]
   then
      if grep "offline" /sys/devices/system/memory/memory$i/state
      then
         echo 'online' > /sys/devices/system/memory/memory$i/state
      fi
   fi
   i=`expr $i + 1`
done

4. Give this script execution permission by,

    #chmod 777 memory_online.sh

5. Next execute it & check memory in either "/proc/meminfo" file or by below command

   #free


Done.

5 comments:

  1. You can check it on VMware's Hardware Compatibility guide " www.vmware.com/go/hcl ".

    ReplyDelete
  2. Not working for me:
    -bash: echo: write error: Operation not permitted

    ReplyDelete
  3. me to having same error??

    echo: write error: Operation not permitted

    any pointers??

    ReplyDelete
  4. just reload acpi_memhotplug module

    ReplyDelete