Hot adding memory

I added some ram to a NixOS guest running under VM ware and tried to follow the instructions to make the OS recognize the ram without rebooting.

The first step is to run the following:

grep line /sys/devices/system/memory/*/state

Unfortunately /sys/devices/system/memory doesn’t exist. Does anyone know what I need to add to my configuration file so that my NixOS guests can have ram added without needing to reboot?

Thanks!

https://kb.vmware.com/s/article/1012764

A quick google showed this: Linux Kernel Documentation :: memory-hotplug.txt
So maybe the kernel in NixOS isn’t configured with these flags?

hotplug seems missing:

─ % zgrep CONFIG_SPARSEMEM /proc/config.gz
CONFIG_SPARSEMEM_MANUAL=y
CONFIG_SPARSEMEM=y
CONFIG_SPARSEMEM_EXTREME=y
CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
CONFIG_SPARSEMEM_VMEMMAP=y

╭─[~/git/nixpkgs]
╰─ % zgrep CONFIG_MEMORY_HOTPLUG /proc/config.gz
# CONFIG_MEMORY_HOTPLUG is not set

Mic92 - thank you for confirming!

Issue filed: Cannot hotplug memory on NixOS 18.09 · Issue #53814 · NixOS/nixpkgs · GitHub

I’ve created a PR for this:

https://github.com/NixOS/nixpkgs/pull/54095

I would appreciate if anyone else could test this in any other environments as well. I have confirmed with this kernel I can hotplug memory on a VMWare guest.

Notes on testing: hot-add CPU and memory to Ubuntu guest in VMware – superMaru