ESXi Snapshots

Snapshots can create 1-2 files within the virtual machine’s folder for each individual snapshot:

/vmfs/volumes/4e41f7fc-e22ffd7d-ae49-001b214182b0/VMNAME # ls -laterh
-rw——- 1 root root 72.0G Sun Oct 7 14:59:22 2012 VMNAME-flat.vmdk
-rw——- 1 root root 4.0G Sun Oct 7 15:05:54 2012 VMNAME-Snapshot84.vmsn
-rw——- 1 root root 16.1M Sun Oct 7 15:15:14 2012 VMNAME-000001-delta.vmdk
/vmfs/volumes/4e41f7fc-e22ffd7d-ae49-001b214182b0/VMNAME #

The “*.vmsn” file is a copy of the point-in-time memory contents for the VM. This file will be as large as the vRAM assigned to the VM – so if you have a 4 GB virtual machine, then the memory snapshot file will be 4 GB as well (provided there are no memory reservations in place).

The “delta.vmdk” file is essentially a new virtual hard drive for the virtual machine. Any new data that is written to the server will be written to this file. This can grow very large, and it is not a best practice to leave snapshots on VMs for any extended period of time.

To validate this, I copied a series of files onto the virtual hard disk of a VM, and then compared the sizes of the snapshot delta files each step of the way.

1 Snapshot, No Modifications After Taking Snapshot

/vmfs/volumes/4e41f7fc-e22ffd7d-ae49-001b214182b0/VMNAME # ls -laterh
-rw——- 1 root root 72.0G Sun Oct 7 14:59:22 2012 VMNAME-flat.vmdk
-rw——- 1 root root 4.0G Sun Oct 7 15:05:54 2012 VMNAME-Snapshot84.vmsn
-rw——- 1 root root 16.1M Sun Oct 7 15:15:14 2012 VMNAME-000001-delta.vmdk
/vmfs/volumes/4e41f7fc-e22ffd7d-ae49-001b214182b0/VMNAME #

The snapshot delta file is 16 MB.

1 Snapshot – Copied 124 MB

/vmfs/volumes/4e41f7fc-e22ffd7d-ae49-001b214182b0/VMNAME # ls -laterh
-rw——- 1 root root 72.0G Sun Oct 7 14:59:22 2012 VMNAME-flat.vmdk
-rw——- 1 root root 4.0G Sun Oct 7 15:05:54 2012 VMNAME-Snapshot84.vmsn
-rw——- 1 root root 128.1M Sun Oct 7 15:17:44 2012 VMNAME-000001-delta.vmdk
/vmfs/volumes/4e41f7fc-e22ffd7d-ae49-001b214182b0/VMNAME #

The snapshot delta file is now 128 MB.

2 Snapshots – No Modifications After Taking Snapshot

/vmfs/volumes/4e41f7fc-e22ffd7d-ae49-001b214182b0/VMNAME # ls -laterh
-rw——- 1 root root 72.0G Sun Oct 7 14:59:22 2012 VMNAME-flat.vmdk
-rw——- 1 root root 326 Sun Oct 7 14:59:22 2012 VMNAME-000001.vmdk
-rw——- 1 root root 4.0G Sun Oct 7 15:05:54 2012 VMNAME-Snapshot84.vmsn
-rw——- 1 root root 333 Sun Oct 7 15:19:38 2012 VMNAME-000002.vmdk
-rw——- 1 root root 128.1M Sun Oct 7 15:19:38 2012 VMNAME-000001-delta.vmdk
-rw——- 1 root root 4.0G Sun Oct 7 15:25:59 2012 VMNAME-Snapshot85.vmsn
-rw——- 1 root root 16.1M Sun Oct 7 15:26:04 2012 VMNAME-000002-delta.vmdk
/vmfs/volumes/4e41f7fc-e22ffd7d-ae49-001b214182b0/VMNAME #

The first snapshot file is unchanged. The second snapshot file is 16 MB.

2 Snapshots – Copied 224 MB

/vmfs/volumes/4e41f7fc-e22ffd7d-ae49-001b214182b0/VMNAME # ls -laterh
-rw——- 1 root root 72.0G Sun Oct 7 14:59:22 2012 VMNAME-flat.vmdk
-rw——- 1 root root 4.0G Sun Oct 7 15:05:54 2012 VMNAME-Snapshot84.vmsn
-rw——- 1 root root 333 Sun Oct 7 15:19:38 2012 VMNAME-000002.vmdk
-rw——- 1 root root 128.1M Sun Oct 7 15:19:38 2012 VMNAME-000001-delta.vmdk
-rw——- 1 root root 4.0G Sun Oct 7 15:25:59 2012 VMNAME-Snapshot85.vmsn
-rw——- 1 root root 240.1M Sun Oct 7 15:28:21 2012 VMNAME-000002-delta.vmdk
/vmfs/volumes/4e41f7fc-e22ffd7d-ae49-001b214182b0/VMNAME #

The first snapshot file is unchanged, even after writing new data to the VM. The second snapshot file is now 240 MB.

Summary

If you have multiple nested snapshots, earlier snapshot delta files will not be written to. It is a best practice to delete snapshots shortly after they serve their purpose – they can grow to a very large size, and quickly become unmanageable.

  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: