You are trying to start a virtual machine in Hyper-V and you may even have enough RAM to start it theoretically, yet Hyper-V complains and won’t let you start the VM. It reports, just like a C64 used to do often, ‘ran out of memory”:
PS C:\Users\Administrator> start-vm -vmname ‘my virtual server’
start-vm : ‘my virtual server’ failed to start.
Not enough memory in the system to start the virtual machine my virtual server.
Could not initialize memory: Ran out of memory (0x8007000E).
‘my virtual server’ failed to start.
Not enough memory in the system to start the virtual machine my virtual server with ram size 2048 megabytes.
‘my virtual server’ could not initialize memory: Ran out of memory (0x8007000E).
At line:1 char:1
+ start-vm -vmname ‘my virtual server’
+ CategoryInfo : FromStdErr: (:) [Start-VM], VirtualizationException
+ FullyQualifiedErrorId : OutOfMemory,Microsoft.HyperV.PowerShell.Commands.StartVM
Obviously you need to make some room to make the VM fit in memory. Did you know that RAM also can get fragmented? So even if enough RAM is there, it might not be contiguous. Also, the system uses RAM for disk caching and that’s where it may consume a lot of RAM and not release it again.
The fix is you need a tool called RAMKICK. RamKick will try to force the OS to release as much RAM as possible, especially disk cache buffers that are not needed at the moment. Once the VM boots, the OS will eventually take again whatever RAM it needs for caching. So RamKick will persuade the OS to drop whatever it doesn’t absolutely need at the moment in RAM, so you have more space to get your VMs accommodated. Isn’t that nice?
How to configure it? It accepts a percentage of RAM as a parameter. Drop that adequately low and it will attempt the RAM cleanup as soon as that limit is hit. You could set it to 10% for example and then after one cycle close the tool or set the limit to 90% again, to force a quick, short-term “ram kick”.
Hyper-V Backup Solution
Naturally if you are dealing with VMs on Hyper-V, you need a good tool like a good Hyper-V backup software to make sure all risks are covered. Otherwise your VMs might not start one day 🙂