How to Shrink Memory baloon in guest ?

tytanick

Renowned Member
Feb 25, 2013
97
3
73
Hi.
About balloonin.
Guest had min 2GB and max 15GB of ram.
Over high usage it grows ram up to 15GB of max size. And it it working ok.
But now i want so shrink this balloon back, how can i do this ?
i am dooing
echo 1 > /proc/sys/vm/drop_caches
echo 2 > /proc/sys/vm/drop_caches
echo 3 > /proc/sys/vm/drop_caches

in gues machine. and the real usage of memory is 4GB / 15 GB

How can i shrink balloon so that Proxmox will only use 4GB and free up the rest 11GB ?
 
I've seen the memory usage level go down on a VM, but I do not know what conditions make it happen. My guest is FreeBSD 10.2 and has the virtio_balloon driver loaded, which as far as I can determine is how the hypervisor and VM communicate about the memory usage. This part of my knowledge is fuzzy due to opaque documentation on the topic.
 
you can set shares=0, to force the shrink.

with default shares values, it's only shrinking when host memory is near full.

(shares is a weight to known which vm you need to shrink the most)
 
you can set shares=0, to force the shrink.

with default shares values, it's only shrinking when host memory is near full.

(shares is a weight to known which vm you need to shrink the most)

That's really useful information. I haven't seen it in either of the books or anywhere on the wiki...

Anyhow, is my assumption right that the guest OS needs a virtio balloon driver as well for this to work?
 
Thanks. I run FreeBSD in my VMs, and have loaded the virtio_balloon.ko module into the kernel. It appears to work based on observation over time.