Verify the snapshot disk that the Virtual Machine is currently running on:
- From vSphere Client,
- Right-click on the VM within the vSphere client and select "Edit Settings"
- Click on the hard disk(s) to identify the current disk file and datastore. (Note: The datastore name will appear in brackets)
If the virtual disk is running on snapshots, the VMDK should appear with the virtual disk name with a 6 digit number with leading zeros. This is the VMDK descriptor filename. (Example: "VM1-000001.vmdk")
- From console,
- Change directory to the virtual machine configuration file folder
cd /vmfs/volumes/Datastore/VMdirectory
- Run this command to list the virtual disks (with latest snapshots) associated with this machine
grep vmdk *.vmx
Verify the Consistency of the Snapshot Chain
- Locate the host in which the virtual machine is currently registered by opening the "Summary" tab of the VM within the vSphere client
- Select the virtual machine within the vSphere client
- Click the Summary tab
- Locate the Host under the General Pane
- Establish an SSH session into that host.
- Change to the directory in which the virtual disk is located
cd /vmfs/volumes/Datastore/VMdirectory
- Verify the consistency of the snapshot chain for the VMDK by typing this command (Note: ensure the SSH session being used is on the ESXi host that the virtual machine is currently running on to avoid lock errors)
vmkfstools -qv10 <VMDKDESCRIPTORFILE>
The output should show that show the delta disks are successfully opened and closed if the Chain is consistent.
Example:
/vmfs/volumes/########-########-####-############/<server name> # vmkfstools -qv10 <server name>-000001.vmdk
DISKLIB-VMFS : "./<server name>
-000001-delta.vmdk" : open successful (23) size = 86016, hd = 0. Type 8
DISKLIB-VMFS : "/vmfs/volumes/########-########-####-############
/<server name>/<server name>-flat.vmdk" : open successful (23) size = 42949672960, hd = 0. Type 3
<server name>-000001.vmdk is not an rdm
DISKLIB-VMFS : "./<server name>-000001-delta.vmdk" : closed.
DISKLIB-VMFS : "/vmfs/volumes/########-########-####-############
/<server name>/<server name>-flat.vmdk" : closed.
AIOMGR-S : stat o=2 r=6 w=0 i=0 br=98304 bw=0
If the chain is broken, the output will return results like this -
/vmfs/volumes/########-########-####-############
/<server name> # vmkfstools -qv10 <server name>-000001.vmdk
...
DISKLIB-LINK : DiskLinkIsAttachPossible: Content ID mismatch (parentCID fffffff3 != fffffffe) <server name>-000001.vmdk /vmfs/volumes/########-########-####-############
/<server name>/<server name>.vmdk.
DISKLIB-CHAIN : "/vmfs/volumes/########-########-####-############
/<server name>/<server name>.vmdk" : failed to open (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).
...
Failed to open '<server name>-000001.vmdk' : 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 (18).
Clone the Snapshot Chain to a New Virtual Disk
- Enter 'ls' command to ensure the current directory and the proper directory in which the VMDK resides are the same.
- Enter the following command to clone the virtual disk :
vmkfstools -i <source file vmdk>.vmdk /vmfs/volumes/DestinationDatastore/<NEW VMDK FILE>.vmdk
Example:
vmkfstools -i <server name>-000001.vmdk /vmfs/volumes/NewDatastore/<server name>-NewDisk.vmdk
By default, the new disk will clone as a thick provisioned disk. To clone a new thin provisioned disk, use the following command:
vmkfstools -i <source file vmdk>.vmdk <DESTINATION VMDK FILE>.vmdk -d thin
Attach new Virtual Disk to an existing virtual machine to verify data
- Ensure the virtual machine is powered off.
- Within the vSphere client, right-click the virtual machine in question and select "Edit Settings"
- Click "Add" and select "Hard Disk" and click "Next"
- Select the option "Use an existing virtual disk" and click "Next"
- Navigate to location of the new VMDK file by clicking "Browse"
- Select the new VMDK file that was created from clone and click "OK" and "Next" in the Add Hardware window
- Verify the settings applied and click "Finish"
- Click "OK" in the Virtual Machine Properties window
- Power on the virtual machine. It should now be utilizing the cloned disk.
- Repeat this process for any additional virtual disks that need to be cloned.