Boot from VMware snapshot file after accidentally deleting related snapshots

snapshotvmware-esxivmware-vsphere

I'll preface this with the obvious: I am dumb.

I am currently working from home on some scheduled maintenance on a production server running on a vm — a bitnami redmine/svn stack to be specific.

I was taking a backup of the SVN repository when the size of my virtual disk maxed out (our repository is too big, that's the maintenance). I checked in VSphere and my VM was powered off with a message similar to `There is no space for vmname-00001.vmdk. Try clearing some files on the data store and try again.

Now, I don't know enough about VMs but I assumed that this meant my VM was using vmname-000001.vmdk. I browsed into the datastore and was about to delete the related -0000n.vmdk files when I decided "I don't know enough about VMs, I probably shouldn't do that."… And that's when TeamViewer hiccuped and the files got deleted anyway. Yay me.

So now my VM wont start because it is missing those other -00000n.vmdk files. The error I get is The System cannot find the file specified.

Can I somehow get the VM running using only that last remaining -000001.vmdk file? The timestamp on the -000001.vmdk file was from yesterday and the other -00000n.vmdk files were timestamped last year if it's relevant.

Best Answer

As was said in the comment ; you can edit the VMX file of your VM and point it to the base disk.

BUT from what you said regarding your snapshots, they were old. So the data in the VM, once this is done, will probably be far too old to be of any use. You can however restore whatever you backed up on top of it. At least you will avoid rebuilding your production server from scratch.

To get your VM up and running again :

  1. Download the VMX file (name should be vmname.vmx) with the Datastore Browser

  2. Make a copy of it, just in case, before modifying it.

  3. Find the line containing vmname-00001.vmdk.

    For instance scsi0:0.fileName = "vmname-00001.vmdk"

  4. Change it to scsi0:0.fileName = "vmname.vmdk" (vmname.vmdk being the name of the base disk)

  5. If your VM has several disks, you should have other lines starting with scsiX:Y.filename= . Note that X and Y will be unique for each line, as well as the base disk name. Repeat step 4 for each of them, replacing the value accordingly.

  6. Save the VMX file and upload it to the ESX server again.

  7. Now your VM should boot.

Note : make sure that you really have no vmname-00XX.vmdk file before proceeding. Following this procedure will make these files useless.