Updated : May 22, 2015 in Bash

Extending dynamically Linux RAMs in VMWare VM without rebooting

Need to raise the amount of RAM in a VMWare VM without rebooting.

– In VMWare interface: Raise the amount of RAM for the VM
– In the Linux VM: Run the following script:

# 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"
### 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
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"
echo "No Unrecognized RAMs present."

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.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: