Hot adding memory to a Linux VM

December 3, 2018 - Reading time: ~1 minute

After you have added more memory on your hypervisor level, you still have to get it online. Nicolas Hurion wrote this one-liner to enable all memory in one shot:

grep line /sys/devices/system/memory/*/state | grep -i offline | sed "s/:offline//g" | sed "s/\/sys\//echo online > \/sys\//g" | /bin/bash

And this is mine but it is still 21% slower :)

grep -l offline /sys/devices/system/memory/*/state | xargs -I % sh -c 'echo online > %'

About

Koen Diels




I'm a freelance system and network engineer from Mechelen (BE) and I'm available for ad-hoc and long term projects.

>>my resume<<

Navigation