Situation:
Need to raise the amount of RAM in a VMWare VM without rebooting.
Solution:
– In VMWare interface: Raise the amount of RAM for the VM
– In the Linux VM: Run the following script:
#!/bin/bash
# This script enables in system the unrecognized RAMs
deleteline () {
echo -ne $dellineup
}
### check preconditions ###
if ! type -P $modprobe > /dev/null; then
echo -e "'modprobe' package is not installed! \n z.B. apt-get install modprobe"
fi
### check if there is any offline RAM ###
RAMOFFLINE=`grep offline /sys/devices/system/memory/*/state|wc -l`
if [ $RAMOFFLINE -gt 0 ]; then
echo "RAMs found that are not yet recognized by the system. Enable RAMs live recognition? (y/N)" ; read yesno ; deleteline
case "$yesno" in
[yY])
echo -e "Recognition of unused RAMs will now be enabled"
modprobe acpiphp
modprobe acpi_memhotplug
for i in $(grep -l offline /sys/devices/system/memory/*/state);do echo online > $i;done
echo -e "\n\n"
free -m
;;
*)
echo -e "Process cancelled"
;;
esac
else
echo "No Unrecognized RAMs present."
fi
Check the new amount of RAM:
free | grep Mem
XEN NOTE: With XEN environment it appears that the System/Kernel immediately recognizes the new amount of RAM dynamically without the need to run this above script.