High disk usage by VMEM file after suspending VMware virtual machine. Here’s a simple fix so your machine won’t crawl with high write activity.
I use VMware all the time to virtualize Windows 10 and other operating systems. In fact, that is my primary way to test different settings and configurations in Windows. The best thing about virtualization is that it allows you to play with the guest operating system without hurting the host operating system. If you mess up the VM, you can restore the snapshot and the VM will work as if nothing happened. In addition to that, a virtual machine gives you the choice to suspend the machine, much like Hibernation or Sleep. This allows you to pick up the work where you left off without booting the machine from start.
In VMware, suspending a virtual machine is a great feature. However, I recently found myself in a situation where VMware’s disk usage is very high after suspending the virtual machine. In fact, the disk usage is so high that the system is unresponsive or crawling to do simple things.
When I opened the Resource Monitor tool in Windows, I can see that VMware is writing data to .vmem file by delegating the task to a system process called ntoskrnl.exe. As long as the system process is writing data to the .vmem file, the system just slow and unresponsive. This happens even after you completely close the VMware application.
Why is VMware VMEM File’s Disk Usage So High?
When you suspend a virtual machine, VMware writes the contents of the RAM or Memory to a special VMEM file to save the VM state. When you turn on the virtual machine again, VMware will read this file and resumes the workflow. As I said earlier, this writing task is delegated to the system process called ntoskrnl.exe. For the most part, this is not an issue for a majority of users.
However, this process can sometimes go haywire. When that happens, the system process only writes about 1Mb to 2Mb per second. This spikes the disk usage and makes the system slow and unresponsive. This continues as long as the system process is writing to .vmem file. Depending on how much RAM you allocated to the VM, the time can vary for the system process to complete the writing operation. For example, I allocated 4GB memory to Windows 10 VM and it took around 15 minutes to complete the writing operation. For that 15 minutes, my system is just an unresponsive or sluggish mess.
Thankfully, it is quite easy to fix the issue. Follow the below steps and you will be good.
Fix VMware VMEM File High Disk Usage
1. First, make sure the virtual machine is turned off. If it is not, open VMware, right-click on the virtual machine name and select “Power → Power Off”. This action will turn off the VM.
2. Now, open the virtual machine folder on the host operating system. To do that, right-click on the virtual machine name and select the “Open VM Directory” option.
3. In the virtual machine folder, find the .vmx file. Right-click on it and select the “Open with → Notepad” option to open the file with Notepad. If you want to, you can use any text editor you want. In my case, I’m using the VS code.
4. In the file, scroll all the way down and copy and paste the below snippet at the end. Save the file by pressing the Ctrl + S shortcut. This is how it looks like once you add the lines.
mainMem.useNamedFile = "false"
mainMem.writeZeroes = "true"
5. Close the file.
That is all. From now on, whenever you suspend the VM, the disk usage shouldn’t be high for too long. Keep in mind that by adding the above lines, it will take a bit longer to suspend the VM. This is because the VM’s paging file is being written to the host’s paging file. That being said, it is much faster than when writing to the VMEM file.
If you have multiple virtual machines that are behaving in the same way, add the snippet to all virtual machines. Alternatively, you can add the above snippet to the VMware’s
config.ini file. You can find the file at the below location.
Note: If there is not config.ini file in the below location, create one and then add the snippet shared above.
Adding the snipped directly to the VMware config file applies the changes to all virtual machines.
Hope that helps. If you are stuck or need some help, comment below and I will try to help as much as possible. If you like this article, do check out how to boot into VMware BIOS.