Wednesday, April 8, 2015

Importing a VM with Snapshots into Hyper-V

 on  with No comments 
In ,  
Here's a quick post on a virtual machine that I was unable to directly import into Hyper-V, but wasn't ready to let go of just yet. Knowing that I've had issue with getting Exchange 2010 installed and/or running correctly in the past, I took a snapshot of the VM before starting the Exchange installation.  Since I had forgotten to export the VM before blowing out the host computer's operating system installation, I had a VHD and an AVHD (snapshot file) for this VM to try to get back up and running.  Since there's no way that I could find to just import the AVHD file, I had to resort to some trickery.  This was on Windows Server 2008R2, I wonder if 2012 or 2012R2 have any new features that would help?  Maybe next time I'm in a Hyper-V console at work I'll check.

So here's what I did. I built a new VM and pointed it to the original VHD file.  Then I told Hyper-V to take a snapshot at that point (again, the original server before installing Exchange).  Next I stopped the Hyper-V services.  Then I then recorded the name of the AVHD file that Hyper-V had just created and deleted that file. Next I copied over the original AVHD and renamed it to match the file name of the snapshot that Hyper-V had created just moments ago.  I then restarted the Hyper-V services and then attempted to start the VM. No luck yet, I was greeted with a permission issue.  So I gave "Everyone" full permission on the AVHD file (this is a lab, not a production environment after all so lets just get it fixed), and my Exchange VM started up and running again. I ran that VM for some time before the MSDN license I was using had expired. It didn't appear to introduce any instability into the VM so I'm calling this little hack a success.

Fast forward some time, I never looked back into the permissions issue that caused the VM not to start up initially. Maybe next time. But hopefully there won't be a next time.


Post a Comment

Discuss this post!