Making linked virtual machines in vSphere 6.7

Making linked virtual machines allows multiple (possible infinite) VMs to share the same boot disk with only changes being stored seperately, giving huge benefits to storage. For some reason, VMWare decided that this shouldn't be a nice easy UI button to do.

Use the script here (https://github.com/pddenhar/esxi-linked-clone) with the following changes:

  • Don't put spaces in the clone output argument
  • Don't put a slash at the end of the input argument
  • Don't bother making a snapshot from the root VM - the created linked disk is NOT from the snapshot

After doing this, it should appear in EXSi. To add it to vSphere, navigate to the datastore where you created the new vm, find the .vmx file and click "Register VM"

You can then consolodate the disks to free up even more space!

If you get the error: An error occurred while consolidating disks

Failed - An error occurred while consolidating disks: The parent virtual disk has been modified since the child was created. The content ID of the parent virtual disk does not match the corresponding parent content ID in the child.

If you get this error, just ignore it. See below what happens if you try to fix it

So from information from https://kb.vmware.com/s/article/1007969

"The Content ID (CID) value of a  virtual machine disk descriptor file aids in the goal of ensuring  content in a parent virtual disk file, such as a flat or base disk, is  retained in a consistent state.
The child delta disks that derive  from that base disk's snapshot contain all further writes and changes.  These changes depend on the source disk to remain intact."

E.g. the clone we made has caused some disk IDs to mismatch and it can't determine what snapshot is from what VM.

I tried removing all the snapshots first and re-consolidating and then got Detected an invalid snapshot configuration.

The fix was (from https://communities.vmware.com/thread/563964):

.vmsd
.vmsdhttps://kb.vmware.com/kb/1026043.vmx

One of these steps then re-created the vmdk with no content (i.e. it was only 314 bytes instead of the full 32GB image) and unable to boot loosing all data.