๐How to activate memory hotplug
Memory hotplug allows you to dynamically add or remove memory from a running virtual machine (VM) or server without requiring a system reboot. This can be a valuable feature for your VPS to efficiently manage resources. In this guide, we will show you how to activate memory hotplug using a custom udev rule in the /etc/udev/rules.d/99-hotplug-cpu-mem.rules
file.
Requirements
a VPS
an OnetSolutions account
Step 1: Create or Edit the udev Rule File
SSH into your VPS server using your preferred terminal emulator.
Navigate to the
/etc/udev/rules.d/
directory, where udev rules are stored:Create or edit the
99-hotplug-cpu-mem.rules
file using a text editor of your choice. You can usenano
,vim
, orgedit
:
Step 2: Add the Memory Hotplug Rule
In the 99-hotplug-cpu-mem.rules
file, add the following rule to enable memory hotplug:
This rule checks for CPU online events (ACTION=="add"
and TEST=="online"
) and sets the online
attribute to 1
for CPUs where online
is currently 0
.
Step 3: Save and Exit
Save the changes and exit your text editor:
For
nano
, pressCtrl
+O
, then pressEnter
to save, and finally pressCtrl
+X
to exit.For
vim
, type:wq
and pressEnter
to save and exit.For
gedit
, click the "Save" option in the GUI and close the editor.
Step 4: Reload udev Rules
To apply the new udev rule without rebooting, you need to reload the udev rules:
Please run also this script:
Step 5: Test Memory Hotplug
You can now test memory hotplug by adding or removing memory from your VPS.
Conclusion
By following these steps and creating the udev rule, you have activated memory hotplug for your VPS. This will allow you to dynamically adjust memory resources on your virtual server, providing greater flexibility and resource management capabilities.
Last updated