Avatar of Richard Frank
Richard FrankFlag for Netherlands

asked on 

hyperv centos guest consumes all memory

I enabled in hyper-v 2012 the use of dynamic memory for a centos vm
I followed these guidelines https://www.altaro.com/hyper-v/centos-linux-hyper-v/
I created a file in /etc/udev/rules.d/ named 100-balloon.rules
SUBSYSTEM=="memory", ACTION=="add", ATTR{state}="online"

Open in new window

I setup startup mem 1024, minimal memory 1024 and max 4096

unlike other centos vm's I have it starts consuming all memory
so, i gave it 8Gb .. all memory was consumed
I increased the max memory to 20Gb, and it was consumed

this is meminfo
cat /proc/meminfo
MemTotal:        1012124 kB
MemFree:          103732 kB
Buffers:           57512 kB
Cached:           270100 kB
SwapCached:            0 kB
Active:           532960 kB
Inactive:         194180 kB
Active(anon):     399540 kB
Inactive(anon):    33240 kB
Active(file):     133420 kB
Inactive(file):   160940 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:       2031612 kB
SwapFree:        2031612 kB
Dirty:               124 kB
Writeback:             0 kB
AnonPages:        399552 kB
Mapped:            61676 kB
Shmem:             33252 kB
Slab:              66568 kB
SReclaimable:      33048 kB
SUnreclaim:        33520 kB
KernelStack:        7104 kB
PageTables:        13568 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     2537672 kB
Committed_AS:    1654524 kB
VmallocTotal:   34359738367 kB
VmallocUsed:       31292 kB
VmallocChunk:   34359591288 kB
HardwareCorrupted:     0 kB
AnonHugePages:     77824 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
DirectMap4k:        8128 kB
DirectMap2M:     4317184 kB

Open in new window

top > 
top - 17:28:04 up 11 min,  1 user,  load average: 0.57, 0.40, 0.26
Tasks: 349 total,   1 running, 348 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.4%us,  0.7%sy,  2.9%ni, 95.5%id,  0.5%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   1012124k total,   912916k used,    99208k free,    58476k buffers
Swap:  2031612k total,        0k used,  2031612k free,   266864k cached

 2305 apache    20   0  281m  98m  40m S  0.0  9.9   0:18.13 httpd
 2184 mysql     20   0 1114m  94m 6264 S  0.0  9.6   0:44.22 mysqld
 2302 apache    20   0  258m  87m  38m S  0.0  8.9   0:11.07 httpd
 2295 apache    20   0  561m  73m  37m S  0.0  7.5   0:09.10 httpd
 2298 apache    20   0  239m  63m  32m S  0.0  6.4   0:09.53 httpd
 2362 apache    20   0  312m  39m  29m S  0.0  4.0   0:10.26 httpd
 2456 apache    20   0  312m  37m  27m S  0.0  3.8   0:08.34 httpd
 2893 named     20   0  991m  32m 3056 S  0.0  3.3   0:00.50 named
 2457 apache    20   0  312m  32m  22m S  0.0  3.3   0:09.53 httpd
 2296 apache    20   0  217m  29m  19m S  0.0  2.9   0:15.26 httpd

Open in new window

LinuxVirtualization* CentOSHyper-V

Avatar of undefined
Last Comment
David Favor
Avatar of Philip Elder
Philip Elder
Flag of Canada image

I'm not much for *NIX or *BSD as it's been a long while since I've worked with it.

The bottom list shows very little memory being actually consumed if I'm reading that right. So, the next place to look is behind the scenes. What daemons are setting up a cache of some sort to use for their purposes. Is there a way to see the numbers for all memory a daemon uses?

I suggest installing the vanilla OS with no roles/features enabled at all. I suspect that memory usage would remain as expected that being very minimal.
Avatar of Richard Frank
Richard Frank
Flag of Netherlands image


thanks for your reply
yes.. finding out what's the difference
but I have some 6 other vm's all centos, same setup, and they behave :)
User generated image
Avatar of Philip Elder
Philip Elder
Flag of Canada image

Ah, now I see. Are the other VMs that are behaving also set up with dynamic memory?

Are Integration Services installed and updated?
Avatar of David Favor
David Favor
Flag of United States of America image

Blurred text
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Richard Frank
Richard Frank
Flag of Netherlands image


Thanks David.. always good to learn something new.

I found this link

So you're right.. Linux is fine, managing it's mem inside the box. Only the HV-host thinks the VM neeeds a lot of mem.
I limited it to 4Gb.. like in the picture I posted and the VM runs fine.

Still the question why HV-host thinks the guest needs and uses more RAM
Avatar of Philip Elder
Philip Elder
Flag of Canada image

My suspicion is that the Distro is a bit behind on installing the newest Integration Services for *NIX.

Is there a revision difference between the "misbehaving" VM and the others? Perhaps running a version check against their IS versus this VM's IS to see would help.
Avatar of David Favor
David Favor
Flag of United States of America image

Tip: For starting new projects, use Ubuntu Bionic which has a much newer Kernel (by years) than the CentOS 6.X Distro.

Linux is a UNIX-like open source operating system with hundreds of distinct distributions, including: Fedora, openSUSE, Ubuntu, Debian, Slackware, Gentoo, CentOS, and Arch Linux. Linux is generally associated with web and database servers, but has become popular in many niche industries and applications.

Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews


IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo