Accidentally deleted VHD file.

Hey Guys,

I was working on a VM that wouldn't boot, it had an VHD and AVHD file that it was trying to merge, but kept failing.

I renamed the AVHD extension to a VHD and used "Edit Disk" in Hyper-V manager to try and manually merge the disks, but it failed with a low disk space warning. Which I then realized, that we only have about 10MB left on the physical partition.

At some point, I accidentally deleted the parent VHD file, now the VM will not boot at all, cause it can't find the file.

I still have the AVHD file, which was physically bigger in size, and when I was working with the VM, it appeared to be the one that was being used.

The virtual disk contains data only, the OS disk is still intact.

If I can't recover the deleted file, then what do you guys recommend?

I have a recent backup of the virtual disk that is stuffed.

Can I detach the trouble VM disk from the VM, so it can at least boot up for now?

Thanks In Advance :)
chippedAsked:
Who is Participating?
 
Svet PaperovIT ManagerCommented:
OK, in that case you have no use of the AVHD file. You have no other choice but to detach it from the configuration and try to start the VM. I don't know in wath state is the merge of the system VHD file but if it is not completed you will have to do it before starting the VM
0
 
Svet PaperovIT ManagerCommented:
You can use your backup to retire the VHD file. Since the moment you have took the snapshot that have created the AVHD file, the parent VHD has not been modified. So, your backup should be good.

Before restoring, however, you need to make some space. If you have another VMs with snapshots try to merge them or export one VM and delete its files. When you have finished with the first VM you can import it again.

There is another unsupported method also, but try the supported way first.
0
 
Svet PaperovIT ManagerCommented:
I did't answer to your question: yes you can but I suggest not to, try to restore your data from the backup and to complete the merge
0
Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

 
chippedAuthor Commented:
Now that the parent VHD is gone, there is 240GB free space.

How do inrestore to the AVHD?

Sorry but you'll have to bare with me, I'm new to Hyper-V :)

Thanks
0
 
Svet PaperovIT ManagerCommented:
You need the parent VHD. So, first make some room and restore it from the backup you have. Restore the configuration files of that VM too. You will need the primary configuration file and the file for the snapshot.
Then, re-rename AVHD back to AVHD and merge the snapshots using Hyper-V Manager
0
 
chippedAuthor Commented:
Oh I just realized what I typed, I meant that I have a backup!of the contents. Not the actual VHD file.
0
 
chippedAuthor Commented:
It should boot fine without the Data drive attached.

We are going to create a new virtual disk and restore the backup to it. I'll let you know how it goes.
0
 
chippedAuthor Commented:
We just deleted the AVHD and created a new Vitrual Disk, backup is restoring atm.

For now on, I'm backing up the VHD's. Storage is dirt cheap these days, so I may as well.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.