- VMware vSAN Automatic Rebalance vs. Proactive Rebalance - Fri, Oct 15 2021
- VMware Tanzu Services overview - Fri, Oct 8 2021
- New features in VMware vSphere 7 Update 3 - Fri, Oct 1 2021
One of the disk modes that we'll talk about today is also a very good alternative to VMware snapshots, so I'd like to talk first about snapshots.
We all know that using snapshots is risky. Many admins have been burned by relying on snapshots, even though we all know that snapshots have a very large impact on performance and availability. So the best thing to do is to avoid using snapshots if you can.
When you delete or commit a snapshot, all data that have temporarily been written to the snapshot file are purged into the VMDK file. During this snapshot commit phase, there is a second snapshot file created, and this one stores the data that is written by the VM during the commit phase.
VMs are often busy with disk writes. During the time of a snapshot, some heavily used VMs can take a very long time for the commit phase and generate a large number of IOs. So you not only penalize the VM itself because this one becomes slow, but you also penalize other VMs running on the same datastore, which might experience high IO reads and writes.
VMware ESXi disk modes ^
VMware ESXi has an option that can expand the possibilities for using a VM. The option lays in the Disk Mode section, where you can pick one of three different options for a VMDK.
Note that this configuration is done when you select VM > Edit settings and is on a "per-disk" basis, so you can have one disk that is dependent, while other disks are configured as independent persistent or non-persistent.
The default option is "dependent," but let's first explain the other options. To start with, you should know that those states only matter when you actually use snapshots and when a virtual machine snapshot is taken. The disk modes act on each individual VMDK, not on a whole VM.
Dependent disk mode
This is the standard virtual disk configured out of the box. When a snapshot is in use, this disk is included in the snapshot. This is not the case for independent disks.
You can see and change the disk mode via the vSphere Web client (via vCenter Server).
You can also change the disk mode via the ESXi host client when you connect directly to your host (without vCenter), which has a different user interface (UI) but can do the same job.
Independent persistent mode
Independent persistent mode is when you create a snapshot, and you see no delta disk created. This means that during snapshot operation, all changes are written directly to the disk.
What happens when you delete the snapshot? All changes are preserved. You cannot go back in time like you could if you had traditional dependent mode configured.
If you change to this disk mode when you are deleting a snapshot of your VM, your data on that particular disk will remain intact if you start or stop the VM.
Independent Non-Persistent Mode
In this mode, the VM creates a redo log that captures all the writes to the disk. The main difference between this mode and the traditional dependent mode is that when you delete the snapshot or shut down the VM, all changes captured to the redo log are gone. Many vSphere admins use snapshots to keep their environment in a certain state after testing patches, etc.
In any case, snapshots should be used only occasionally. I've seen many use cases in which people were using snapshots and wrongly deleted the snapshot when they actually wanted to go back in time. Of course, their initial state was lost.
The other danger of using snapshots is datastore space. In many cases, the snapshots simply fill all datastore space and all VMs are in a suspended state. You can't even delete some snapshots since this operation also needs at least some free space on the datastore, and you don't have any. The usual way out of this problem is to delete a VM or two, which you can quickly restore from a backup later, after cleaning the datastore from overallocation.
Independent, non-persistent disk mode avoids using snapshots while you're still able to safely test patches and changes that are discarded after reboot. This mode basically allows you to do all kind of tests inside of your VM without risking anything, because you know that after reboot, your VM will return to its original state.
You don't need snapshots. Independent, non-persistent mode is a perfectly safe alternative to snapshots, and I'm sure many VMware admins ignore it.
Subscribe to 4sysops newsletter!
You can activate any of these modes on any of the VM disks. However, you can only do it when the VM is powered off.