The disk space required for a virtual machine depends on whether you intend to use Snapshots/Suspending.
Virtual machine without snapshots
Use this general formula to calculate the disk space required:
(Size of virtual machine's hard disk(s)) + (size of RAM for virtual machine) + ( 100 MB for log files per virtual machine) is the minimum space needed for each virtual machine.
For example, you have 8 GB left on your LUN. If you create a virtual machine with a 8 GB hard disk, this virtual machine cannot boot. This is due to the extra space requirements for memory and other miscellaneous files ( logs, vmxf, nvram).
This is illustrated by these examples:
-
Disk space required for a powered off virtual machine:
[root@server1 vm1]# ls -lisah
total 8.1G
281 64K drwxr-xr-x 1 root root 1.6K Mar 6 19:04 .
261 1.0M drwxrwxrwt 1 root root 5.9K Mar 6 10:42 ..
288 8.0G -rw------- 1 root root 8.0G Mar 6 19:04 vm1-flat.vmdk
470 64K -rw------- 1 root root 8.5K Mar 6 18:35 vm1.nvram
287 64K -rw------- 1 root root 396 Mar 6 19:04 vm1.vmdk
284 64K -rw------- 1 root root 436 Mar 6 19:04 vm1.vmsd
282 64K -rwxr-xr-x 1 root root 2.0K Mar 6 19:04 vm1.vmx
283 64K -rw------- 1 root root 258 Mar 6 17:07 vm1.vmxf
704 1.0M -rw-r--r-- 1 root root 154K Feb 21 11:43 vmware-1.log
705 64K -rw-r--r-- 1 root root 29K Feb 25 09:43 vmware-2.log
844 64K -rw-r--r-- 1 root root 31K Mar 4 09:04 vmware-3.log
841 64K -rw-r--r-- 1 root root 30K Mar 6 18:35 vmware.log
-
Disk space required for a powered on virtual machine:
[root@server1 vm1]# ls -lisah
total 9.1G
281 64K drwxr-xr-x 1 root root 1.9K Mar 6 19:07 .
261 1.0M drwxrwxrwt 1 root root 5.9K Mar 6 10:42 ..
849 1.0G -rw------- 1 root root 1.0G Mar 6 19:07 vm1-c8466559.vswp
288 8.0G -rw------- 1 root root 8.0G Mar 6 19:07 vm1-flat.vmdk
470 64K -rw------- 1 root root 8.5K Mar 6 18:35 vm1.nvram
287 64K -rw------- 1 root root 396 Mar 6 19:07 vm1.vmdk
284 64K -rw------- 1 root root 436 Mar 6 19:04 vm1.vmsd
282 64K -rwxr-xr-x 1 root root 2.0K Mar 6 19:07 vm1.vmx
283 64K -rw------- 1 root root 258 Mar 6 17:07 vm1.vmxf
704 1.0M -rw-r--r-- 1 root root 154K Feb 21 11:43 vmware-1.log
705 64K -rw-r--r-- 1 root root 29K Feb 25 09:43 vmware-2.log
844 64K -rw-r--r-- 1 root root 31K Mar 4 09:04 vmware-3.log
851 64K -rw-r--r-- 1 root root 30K Mar 6 18:35 vmware-4.log
850 64K -rw-r--r-- 1 root root 23K Mar 6 19:07 vmware.log
There is a difference of 1 GB due to the presence of a .vswp file.
If you make reservations for your virtual machines that are equal to the amount of RAM assigned to them, swapping and page sharing does not occur. You can overcommit if you are comfortable with poor performance. If you do not set reservations, ESX host creates a .vswp file equal to the difference between the amount of physical memory assigned to the virtual machine and the reservation it has. By default, memory reservations are set to 0. If you have a virtual machine with 2 GB of memory without a reservation, it creates a 2 GB .vswp file when it is powered on. The virtual machine starts using the .vswp file if the server is out of physical RAM. If you set a 1 GB reservation, it creates a 1 GB .vswp file. The .vswp files allow for memory overcommitment.
Virtual machine with snapshots
Ensure to consider whether you are using snapshots with your virtual machine.
Prior to ESX4.0 Update 2, as well as using this formula:
(Size of virtual machine's hard disk(s)) + (size of RAM for virtual machine) + ( 100 MB for log files per virtual machine)
You need to add space for snapshots. Snapshots are usually small at first, under 100 MB if you do not snapshot the virtual machines memory. If you select memory, an additional amount equal to the amount of RAM a virtual machine has is created in the .vmsn file. The growth of snapshots depends on how many disk changes happen on the virtual machine. If few changes are made, they remain small and if many changes are made, they grow larger. It can vary depending on the role of your server. Snapshots of database and exchange servers grow quickly, snapshots of web and active directory servers usually grow slowly. They have the potential to grow up to the maximum size of the virtual machine disk.
For earlier versions prior to VMware ESX 4.0 Update 2, the task of consolidating all snapshots (Remove All Snapshots task) caused unique changes stored only in the second snapshot delta disk to be copied upwards through the snapshot chain and into the first snapshot, or its parent. This effect is recursive for each preceding parent file. For example, a base disk of size 8 GB and 2 levels of snapshots, each of 4 GB each. During a Remove All Snapshot Tasks, the first snapshot delta disk file can grow, worse-case scenario, to 8 GB, as all new blocks from the second snapshot are written. Any common changes stored in both snapshot levels do not require additional space.
In ESX 4.0 Update 2 and later versions, the snapshot mechanism has changed. VMware ESX now incorporates improved consolidation procedures, which lessen the demand for free space. You can consolidate virtual machine delta disks even with minimal free space on your datastore.
Notes:
Additional Information
To limit the number of vmware.log files those are created for a virtual machine:
-
Connect to your VirtualCenter server or directly to your ESX host using VMware Infrastructure (VI) Client.
-
Select the virtual machine you want to edit from the inventory.
-
Power off the virtual machine.
-
Right-click the virtual machine and click Edit Settings.
-
Click the Options tab.
-
Select Advanced.
-
Click Configuration Parameters.
-
Click Add Row.
-
Enter log.keepOld for the Name and as many historical log files as you want to keep for the value (in addition the the original vmware.log file).
-
Click Add Row.
-
Enter log.rotateSize for the Name and a maximum size in bytes for the log files to grow to. For example, 500000 for 500 kb.
-
Click OK.
-
Power on the virtual machine.
Note: It now creates vmware.log files up to the size you specified and also only keep as many as you specified.
-
Alternately, you can disable virtual machine logging by deselecting Enable logging on the Options tab. If you do this, all logging except for VMware Tools logging is disabled.
Note: If you also want to disable VMware Tools logging, you can add an additional row in Configuration Parameters with a name isolation.tools.setinfo.disable with a value of true.
Caution: If you require support at a later time, VMware often needs to examine that log file. You may need to enable logging before you can get receive support.