Link to home
Start Free TrialLog in
Avatar of ggntt
ggnttFlag for Ireland

asked on

Cleaning up VMDK files

I'm running tight on space on a ESX box that has 2 virtual servers running, I had some snapshots but when I tried to clean them down the box frooze for a very long time and needed a reboot, now my snapshot manager only shows 1 snapshot on each server but one server still has 000001.vmdk, 000002.vmdk and 000004.vmdk as per screen shot attached.

Can I clear down these files without causing any issues?
vmdk-issue.JPG
Avatar of deroode
deroode
Flag of Netherlands image

First, check your .vmx to see if these files don't belong to the VM.

After verifying that you can move them to a different directory. If they are still in use (e.g. they are still snapshot files of some sort) you will not be able to move them because they are in use.
If you can move them, and your VM's don't suffer then you can delete them.
Avatar of ggntt

ASKER

Thanks deroode, I checked the VMX file and no mention of 2 of those files, I was able to move them without impacting the vm, but I can't delete them from teh new folder, when I try and delete I get General failure error.
Per VMware support if you have issues cleaning up snapshots the easiest workaround is to use vConverter to do a V2V which will consolidate the VM for you and you can delete the source VM once you're done.  

I've had this happen multiple times and this is an easy fix for it.
One way to prevent this from happening is to not reboot while removing snapshots.

Removing snapshopts from the GUI instead of the commandline is problematic.  If you keep the snapshot just long enough to test a change (a few hours)no big deal, but if you are removing days of snapshot the GUI simply will not wait for the OS to finish before it gives up and says "failed".

DONT BELIEVE IT.

The snapshot is still being incorported back into the base disk, and I've sen this take 8-9 hours on occasion, bu left alone, it finishes and does a proper cleanup.

Rebooting while this is happeneing, especially on some SANS can render the files undeletable, or worse.

The best way to remove snapshots is from a putty session using the Commandline tools from VMware.  That way you can simply watch for the command to end, long after VI/VC has given up and proclaimed a failure.

A good script to remove ALL snapshots o na host is:

time vmware-cmd -l | while read x; do printf "$x"; vmware-cmd "$x" removesnapshots; done

How about cloning the machine to a new subdirectory. It moves only the needed files and leaves out all the unnecessary snapshots. Then use the cloned machine, and delete the original?

Or am I missing something?  I use clone a lot to clean up directories once a machine is stable and in a state I want to save.

Jeff
ASKER CERTIFIED SOLUTION
Avatar of ionut19
ionut19

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial