Refresh your test and lab VMs without using snapshots
I am often building out machines that I want to change configurations on but would like a quick way to revert them back to an original state quickly. I could do this with snapshots but often I dont want to mess with the snapshots getting large or forgetting I took a snapshot, this is where the “Independent disk” comes into play. Cormac Hogan did a nice job summarizing an Independent disk on his blog but I found a slightly different example, his really focuses on the backup scenario. Mine is in a lab and I dont care about the backups. I want a lab system than no matter what a user does I can simply put it back to the way I set it up with little to no effort, possibly even for multiple machines with a script. I want the user to be able to make changes however and even reboot the system from within the OS or using VMtools integrated reboots. Heres how I did it…
Build the VM with all the virtual disk you would like and install an OS. Keep the defaults as you add disks. If you add additional disks before powering on, make sure they are at the default as shown below.
Make any configuration changes you need within the core OS. If you want things on secondary disks to be static when reset, make those changes now also.
Power Off the VM and Edit Settings. You will now go to all the virtual disks and change the disks to “Independent – Nonpersistent”
Power on the VM.
You can not make any changes you want to the VM, even allowing users to make changes involving multiple disks. To reset the VM to the clean state that you built, simply go to vCenter and power cycle the VM.
Note: If youhave any snapshots you can not change the disk style. You will need to delete all snapshots and consolidate if you want to set this.