How can I check how much ram available to add to guest OS on libvirt?

Gani Rakhmatov asked:

I have a server with 32 gb ram and there is libvirt. There are 12 gb of ram is used. When I try to add ram to my guest OS it is not possible to add more than 12gb ram. How can I check how much ram available to add to guest OS on libvirt? I want to give all available memory to it.

My answer:


The absolute maximum amount of RAM you can give to a guest is the total amount of RAM available to the host. But of course, if you do that, then you should expect some performance issues, or things will just fail to start or run properly.

That number is displayed both when you create the VM in virt-manager, and by virsh nodememstats.

virt-manager new VM memory

# virsh nodememstats
total  :             32938320 KiB
free   :              1087720 KiB
buffers:              1249844 KiB
cached :              3681120 KiB

This system is using almost all of its memory, so it has little room left for memory for new VMs.

To improve memory usage in KVM, make sure that each Windows guest has the virtio balloon driver installed (Linux already includes this driver), and enable ksm on the host to deduplicate virtual machine memory.


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.