Vmware ESX Snapshots will not delete.
If you have vmware snapshots that you do not remove frequently you may start to notice that the datastore that the guest is on will start to fill up. If you start to notice that these snapshots are eating disk space up one thing to do is delete the snapshots and consolidate the changes that you have made to the original vmdk file.
WARNING: Always have a backup just in case!
If you would like to delete the snapshots one thing is to make sure that you have enough disk space to do this. I recommend having about 2x times the amount of space the guest is using in free space to delete the snapshots. When a snapshot is deleted it takes the current changes and applies them to the original vmdk file.
Every time a new snapshot is made 2 files are created. One is the xxxxxx.vmdk and the other is xxxxx-delta.vmdk. The xxxxx.vmdk file is just a file that holds the information like disk geometry and other pointers in there that reference the delta file. The delta file is the actual disk where the data is stored.
If you deleted the snapshots and did not have enough free space then the following might have occurred. It halts at 95% complete and then fails or it completes the task but the vmdk files still exist. You will also notice in the VIC that the option to remove the snapshots is now gone. You can ssh to the host machine and navigate to the datastore that holds the guest. Usually this path is /vmfs/volumes// If you still have the xxxxx.vmdk and the xxxxxx-delta.vmdk file then you should be ok. We will verify that the guest is still pointing to the vmdk file with the most current information. Open a ssh session to the vm host. Navigate to the directory on the datastore where the guest lives. You can cat the .vmk file and you want to check for the following information.
scsi0:0.fileName = "-xxxxxx.vmdk"
This xxxxx.vmdk file should be the most current disk. If is not then you can shutdown the guest and change the file and point it to the newest snapshot file that you have. Some other things to check as well is to verify that the snapshot disks are all still linked together. To do this you can cat the.vmdk file and xxxxx.vmdk file and check the CID and parentCID. The parentCID should point to the original disk or the snapshot disk before. For instance: .vmdk will show the following:
CID=e6d85194
parentCID=ffffffff
The xxxxxx.vmdk file should show something like the following:
CID=41e19117
parentCID=e6d85194
If you have another snapshot then the next one will contain the following:
CID= e67d8ac1
parentCID=41e19117
As you can see the parentCID of the snapshot file should point back to the CID of the original disk. If this does not match then you should be able to start with the original disk then fill in the parentCID of each snapshot to point to the newer snapshot. Once this has been verified or changed then the system can be booted back up and should be ready to go.
This will not solve the the fact that you still have snapshots out there. But will verify that your virtual machine has not been corrupted by the process of trying to consolidate the disk by removing the snapshots.
One way to fix this is to use vmware converter on the virtual machine and do a hot clone of the guest. Once the machine is converted you will have only one vmdk file. You can then discard the original guest and use the new vm you have just created. Another way is to create a new virtual machine and do a file level backup and restore to the new virtual machine.
WARNING: Always have a backup just in case!
If you would like to delete the snapshots one thing is to make sure that you have enough disk space to do this. I recommend having about 2x times the amount of space the guest is using in free space to delete the snapshots. When a snapshot is deleted it takes the current changes and applies them to the original vmdk file.
Every time a new snapshot is made 2 files are created. One is the xxxxxx.vmdk and the other is xxxxx-delta.vmdk. The xxxxx.vmdk file is just a file that holds the information like disk geometry and other pointers in there that reference the delta file. The delta file is the actual disk where the data is stored.
If you deleted the snapshots and did not have enough free space then the following might have occurred. It halts at 95% complete and then fails or it completes the task but the vmdk files still exist. You will also notice in the VIC that the option to remove the snapshots is now gone. You can ssh to the host machine and navigate to the datastore that holds the guest. Usually this path is /vmfs/volumes/
scsi0:0.fileName = "
This xxxxx.vmdk file should be the most current disk. If is not then you can shutdown the guest and change the file and point it to the newest snapshot file that you have. Some other things to check as well is to verify that the snapshot disks are all still linked together. To do this you can cat the
CID=e6d85194
parentCID=ffffffff
The xxxxxx.vmdk file should show something like the following:
CID=41e19117
parentCID=e6d85194
If you have another snapshot then the next one will contain the following:
CID= e67d8ac1
parentCID=41e19117
As you can see the parentCID of the snapshot file should point back to the CID of the original disk. If this does not match then you should be able to start with the original disk then fill in the parentCID of each snapshot to point to the newer snapshot. Once this has been verified or changed then the system can be booted back up and should be ready to go.
This will not solve the the fact that you still have snapshots out there. But will verify that your virtual machine has not been corrupted by the process of trying to consolidate the disk by removing the snapshots.
One way to fix this is to use vmware converter on the virtual machine and do a hot clone of the guest. Once the machine is converted you will have only one vmdk file. You can then discard the original guest and use the new vm you have just created. Another way is to create a new virtual machine and do a file level backup and restore to the new virtual machine.

Comments
Post a Comment