• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 816
  • Last Modified:

Vmware Swap file

per vmware  whenever a VM is powered on , it creates a swap file with the same size as the dedicated RAM, and if it has memory reservation, then the swap file will be equal to Dediated RAM minus size of reserved RAM.

can someone explain the latter (why when there is memory reserved, the swap file will be smaller)?



Also I wonder if this swap file gets automatically removed without powering off the VM, seeing that VMs swap files can take a lot of disk space, if many of them are powered on.
by the way, is swap file the same as windows memory page (temporary memory)?

i
Thanks
0
jskfan
Asked:
jskfan
  • 2
  • 2
2 Solutions
 
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
Because that is the guaranteed size of memory which is required to start the VM, as you have defined by RESERVING the Memory requirement.

a virtual machine is configured with a reservation then the swap file will be an empty file with the size of (virtual machine memory configuration – VM memory reservation). e.g. , an 8GB virtual machine is configured with a 1024MB memory reservation, the size of the swap file will be 7168MB.

If the VM is Powered OFF, the SWAP file is removed, from the datastore, it's not required.

Remember this SWAP file is emprty, and only EVER used, if there is memory contention on the host, e.g. Host runs out our memory, and the VMs will then swap to disk!

If this happens performance will be poor, never let the host run out of memory.
0
 
jskfanAuthor Commented:
<<>Remember this SWAP file is emprty, and only EVER used, if there is memory contention on the host, e.g. Host runs out our memory, and the VMs will then swap to disk!>

even if it is empty , it will count on the capacity of datastore?

for instance if there is 2 GB disk space free on datastore and you power up a VM that has 4GB of RAM provisioned, VMware will not let it power on.
0
 
Andrew Hancock (VMware vExpert / EE MVE^2)VMware and Virtualization ConsultantCommented:
Correct, the space is allocated, but it's empty!

and it does not contain any zeros, or zeroed out!

see here......

http://frankdenneman.nl/2012/11/14/alternative-vm-swap-file-locations-qa/

for instance if there is 2 GB disk space free on datastore and you power up a VM that has 4GB of RAM provisioned, VMware will not let it power on.

correct, because the hypervisor, cannot create the swap file, because you have no storage space.
0
 
AbhilashCommented:
A swap file is always created when the VM is powered on.
Remember that Swap space = Allocated memory- reserved memory.
It is needed only when the VM runs out of memory and it is the last step VMKernel takes after trying Transparent page Sharing, memory compression and Ballooning.
This is to ensure that guest does not run out of memory.
The swapping causes a high performance degradation so always avoid it.

<<Also I wonder if this swap file gets automatically removed without powering off the VM, seeing that VMs swap files can take a lot of disk space, if many of them are powered on.
by the way, is swap file the same as windows memory page (temporary memory)?>>

Yes swap file goes off when you power off the machine.
As you have already mentioned. If you have enough RAm you can reserve the memory so swap file creation does not take place.

Windows paging is controlled by OS. And happens on the disk assigned to VM. The swapping to the swap file is controlled by kernel and it is triggered by kernel only when it runs out of memory.
They are totally different from one another.
0
 
jskfanAuthor Commented:
Thank you Guys!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now