TheSaffaGeek

My ramblings about all things technical

Expanded disk with existing snapshot corrupted

Leave a comment

 

Having seen a recent VMware communities posting with someone having the same problem I had I thought I’d write this up.

Almost a month back now while doing some routine maintenance on some of our then ESX3.x virtual machines we decided to expand the primary hard drive of a windows 2003 virtual machine due to it running out of space. As I’m sure you’ve guessed from the title of this posting we made the critical and very embarrassing mistake of forgetting to check if the virtual machine had a snapshot attached to it(What an idiot). Unlike vSphere, ESX3.x allows you to extend the hard drive with a snapshot attached so once we had done the extending of the drive and reattached it to the vm again (this is the way I liked to do it and I do know there are easier ways which after this problem I’ve made sure I know how to do). Once we powered the vm back up we received an error stating:

“Cannot open the disk
‘path to the .vmdk file’ or one of the snapshot disks it
depends on.
Reason: The parent virtual disk has been modified since the child was
created’

This kind of error I had seen before after cold migrating a machine with a snapshot and the CID then being different from the number in my VMDK. So I went through the steps as mentioned in this Knowledge Base article to try see if this error had anything to do with my problem.(*NB* Follow steps below before trying this)

Now as to make this posting structured to try help someone fix this problem if they have done it themselves I’m going detail the steps you should/ i myself did follow. Firstly I have to warn you that before you follow these steps I can’t promise you will get your snapshot data back nor can I promise it won’t corrupt your vm but having done this process with VMware support for this problem this is what they would make you follow also.

First is make a clone of the machine we’re trying to fix just in case

Next is the fun part due to you expanding the drive and therefore the snapshot has a different RW value than your vmdk.So you need to use putty and edit the “VirtualDisk.vmdk” file in notepad and look for

RW **number** VMFS “VirtualDisk-000001-delta.vmdk” .

 WRITE THE NUMBER AFTER RW DOWN.This one is what the drive was before the expand

Next open the “VirtualDisk.vmdk” file and look for the RW **number**  VMFS "VirtualDisk-flat.vmdk" value. What we are going to do is make it look as if the expand never happened. So edit the “VirtualDisk.vmdk” file and put in the FIRST number from the RW **number** VMFS “VirtualDisk-000001-delta.vmdk” into the VirtualDisk-flat.vmdk line  and save it.

Secondly as I said one of the problems could be down to your CID for your VMDK being different from your snapshot/s so follow this Knowledge Base article.

After making sure the CID’s match then "delete" the snapshots. If your snapshot manager shows no snapshots(like mine did) then create one called test or whatever you like, let it create, then go to snapshot manager and click delete all and this should apply/"delete" the snapshots.

Gregg Robertson

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s