Expanding RAM on a Linux system without rebooting

This assumes that you are running your Linuxsystem as a virtual server on VMWare, KVM, XEN or AHV.

We have been there a couple of times – your application need more RAM. Or just want more RAM in order to have your Minecraft server run smoothly.

  1. First of all, add the amount of RAM to your VM via your hypervisor.
  2. Second, we need to tell the kernel that there is more RAM available for use, we can do that by using this simple script:

for f in /sys/devices/system/memory/memory*/state ; do grep -v -q online $f || continue echo -n "Bringing $f online... " echo online > $f || continue echo OK done

That's all! You can now verify with your favorite way to check RAM usage.