VMware Cloud Community
steeef
Contributor
Contributor
Jump to solution

Consolidating vmdk files (missing snapshots)

I made the mistake of trying to free up space by deleting all snapshots, and then deciding the ESX server was unresponsive and restarted it. I was lucky enough to still have working VMs afterwards. I now have 17 vmdk files of the VM's disk, but since the snapshots have been removed, I can't just delete them. Is there any easy way to consolidate them back into the parent vmdk?

0 Kudos
1 Solution

Accepted Solutions
kooltechies
Expert
Expert
Jump to solution

Hi,

For consolidating all the snapshots you need to make sure that all the files descriptor and disks are in the same directory , I would advice if you can make a copy of the entire folder first if you have enough space. Now for the consolidation you need to make sure that first you traverse through all the descriptor files and check that you have the correct PID and CID mapping. PID : Parent disk , CID : Child Disk.

Lets say you start from the base.vmdk , this will not have any PID as it's the root parent this will have CID of 00001.vmdk , similarly 00001.vmdk will have PID as base and CID as 00002.vmdk you need to ensure that this chain is maintained through the last disk.

Once this is done then you can execute vmkfstools -i on the last snapshot disk and create a new destination disk which will have the new combined disk which will have all the snapshots commited to the base disk.

Thanks,

Samir

P.S : Please consider rewarding points if you think this answer is helpful

Blog : http://thinkingloudoncloud.com || Twitter : @kooltechies || P.S : If you think that the answer is correct/helpful please consider rewarding points.

View solution in original post

0 Kudos
12 Replies
stony007_de
Enthusiast
Enthusiast
Jump to solution

Hi,

if you got the .vmdk and the vmdk-decription files, there would be no problem to consolidate the snapshots!

Post a list of your files in the VM Folder.

stony007_de

0 Kudos
steeef
Contributor
Contributor
Jump to solution

Two disks, server.vmdk and server_1.vmdk, each with -000001.vmdk through -000017.vmdk children.

0 Kudos
kooltechies
Expert
Expert
Jump to solution

Hi,

For consolidating all the snapshots you need to make sure that all the files descriptor and disks are in the same directory , I would advice if you can make a copy of the entire folder first if you have enough space. Now for the consolidation you need to make sure that first you traverse through all the descriptor files and check that you have the correct PID and CID mapping. PID : Parent disk , CID : Child Disk.

Lets say you start from the base.vmdk , this will not have any PID as it's the root parent this will have CID of 00001.vmdk , similarly 00001.vmdk will have PID as base and CID as 00002.vmdk you need to ensure that this chain is maintained through the last disk.

Once this is done then you can execute vmkfstools -i on the last snapshot disk and create a new destination disk which will have the new combined disk which will have all the snapshots commited to the base disk.

Thanks,

Samir

P.S : Please consider rewarding points if you think this answer is helpful

Blog : http://thinkingloudoncloud.com || Twitter : @kooltechies || P.S : If you think that the answer is correct/helpful please consider rewarding points.
0 Kudos
steeef
Contributor
Contributor
Jump to solution

Dang. Part of the reason I was clearing out the snapshots in the first place is that we're running out of room. I certainly don't have enough space to copy the folder. Would it be possible to use Converter to move it to a different ESX server, run vmkfstools, and move it back?

0 Kudos
stony007_de
Enthusiast
Enthusiast
Jump to solution

hey steef,

  • you are using only vmdk files or RAW dev's?

  • the vm still running?

  • which options for other space do you have?

    please post a "#ls -lh" of vm folder and of the folder with the moved snapshots!

0 Kudos
steeef
Contributor
Contributor
Jump to solution

Yeah, I'm using vmdk's, and yes, the VM is still running (and it's not something I can shut down in the middle of the day, unfortunately). I'll take a look at the console once I get a chance (it's in another building, and I don't have remote console access).

0 Kudos
stony007_de
Enthusiast
Enthusiast
Jump to solution

Again...

You cant access the esx host via ssh?(putty)? You say the vm is still running?

if the vm runs in a taken snapshot, your last child-file Server_000017.vmdk must be grow in 6Meg steps. So the file should be very huge!

To consolidate the Childs you have to put all files together in the VM Folder. the server1.vmdk up to server1_000017.vmdk incl descriptions.

Then you have to check all descriptions files! in each of them you find an line "CID" an "parentCID". this lines must be incorect! You have to fix the lines like the following example:

server1_000017.vmdk

CID:abcd0017

parentCID:abcd0016

server1_000016.vmdk

CID: abcd0016

parentCID: abcd0015

server1_000015.vmdk

CID: abcd0015

parentCID: abcd0014

...

..

.

server1_000001.vmdk

CID: abcd0001

parentCID: abcd0000

server1.vmdk

CID: abcd0000

parentCID: ffffffff

do it for both vmdk files.

If all snapshots are corrected you can delete them in the VC an all the Files will be consolidate! in the root server1.vmdk.

If you need help with the fixing, send me a PN with all desciption files! i will do it for you!

kjb007
Immortal
Immortal
Jump to solution

If you have working vm's, then your CID chain is in tact. Your snapshot db may not correctly contain the snapshots that you have. This should be fixable by creating a new snapshot, and deleting it immediately. This should start a comit task, that if you are using vc, may complete or timeout, but it should go through and consolidate your snapshots.

-KjB

vExpert/VCP/VCAP vmwise.com / @vmwise -KjB
0 Kudos
steeef
Contributor
Contributor
Jump to solution

Ok, I was able to create a new snapshot, but when I attempted to delete it, it failed, complaining about no space left (though there is about 4GB left). Checking Snapshot Manager, there are no snapshots, though the same vmdk files exist (1 through 18 now, thanks to the new snapshot). I did this while the VM was off, and now powering it on gives me a similar error message: "No space left on device".

All other VMs on this ESX server are free of snapshots, so I don't see how I can free up more space to play around with these sparse images. My first thought was VMware Converter, but trying to read this VM gives me the error "FILE_OPEN_FAILED(ha-nfc://[esx1:storage1] server/server_1-000018.vmdk".

Could I download the VM's folder from VI Client and run vmkfstools on it from here?

0 Kudos
steeef
Contributor
Contributor
Jump to solution

I'm going to use Converter to move another VM from this ESX server to free up some space. Hopefully that will allow me to start up the troublesome VM, or at least try cleaning up the snapshots again.

0 Kudos
kjb007
Immortal
Immortal
Jump to solution

How much RAM have you allocated to the vm? The vswp file will take up space as well when you attempt to start it without reservations. If you set the reserve memory all the way to what you have specified for the memory allocation, you should be able to get the vm up, and then run converter against it to move to another datastore. You will need some space to consolidate all those snapshots.

-KjB

vExpert/VCP/VCAP vmwise.com / @vmwise -KjB
0 Kudos
steeef
Contributor
Contributor
Jump to solution

I managed to recover the data from the second drive, server_1.vmdk, and was able to clone it to a new vmdk with vmkfstools. The boot drive, server.vmdk was hosed, as was apparent when I mounted it on a different VM and chkdsk ran after I powered it on.

My data was saved, but I had to reinstall Windows Server 2003 from scratch. Luckily I've got plenty experience with that. Thanks for all the suggestions! I'll certainly keep tabs on snapshots before they get out of hand again.

0 Kudos