Overview
The VirtIO Balloon driver (virtio_balloon) is a memory management component used by KVM/QEMU virtualization platforms. It allows the hypervisor to dynamically reclaim or return memory from a virtual machine (VM) as needed.
While this feature can improve host memory utilization, some administrators prefer to disable memory ballooning to ensure that the VPS always retains its allocated RAM.
This guide explains how to disable the VirtIO Balloon driver and prevent it from loading after system reboots.
What Is Memory Ballooning?
Memory ballooning is a virtualization technique that allows the hypervisor to adjust the amount of RAM available to a guest operating system without shutting it down.
When the host requires additional memory, the balloon driver inside the guest "inflates," consuming guest memory and effectively returning it to the host. When memory pressure is relieved, the balloon "deflates," returning memory to the guest.
Reasons to Disable VirtIO Ballooning
You may consider disabling the VirtIO Balloon driver if:
-
You want the VPS to always retain its assigned memory allocation.
-
You prefer predictable memory availability for applications and services.
-
You are troubleshooting memory-related performance issues.
-
Your virtualization environment does not actively use memory ballooning.
Disable the VirtIO Balloon Driver
Create a modprobe configuration file that blacklists the driver:
echo "blacklist virtio_balloon" > /etc/modprobe.d/stop-stealing-ram.conf
This prevents the module from being loaded automatically during future boots.
Unload the Driver Immediately
If the module is currently loaded, unload it without rebooting:
modprobe -r virtio_balloon
Verify the Module Status
Check whether the module is still loaded:
lsmod | grep virtio_balloon
If no output is returned, the module is no longer active.
Rebuild the Initramfs (Recommended)
Some distributions may include the driver in the initramfs image. Rebuilding the initramfs ensures the blacklist is respected during boot.
RHEL, AlmaLinux, Rocky Linux, and CentOS
dracut -f
Debian and Ubuntu
update-initramfs -u
After rebuilding, reboot the server:
reboot
Confirm the Driver Remains Disabled
After the reboot completes, verify the module is not loaded:
lsmod | grep virtio_balloon
No output indicates that the VirtIO Balloon driver is successfully disabled.
Check Whether Ballooning Is Being Used
Before disabling the driver, you may wish to determine whether memory ballooning is actively being utilized:
grep -H . /sys/devices/virtual/balloon/* 2>/dev/null
or
dmesg | grep -i balloon
These commands can help identify whether the guest operating system is interacting with the balloon driver.
Important Notes
-
Not all VPS providers use memory ballooning.
-
Some virtualization platforms may ignore the guest-side driver configuration.
-
Disabling the balloon driver does not increase the amount of RAM assigned to the VPS.
-
If your provider actively relies on ballooning for resource management, disabling the driver may not provide any measurable benefit.
Always test changes in a maintenance window and ensure you have console access before modifying kernel module configurations.
