Exporting Hyper-V VMs Over the Network
I received a comment via e-mail that it can take 2-3 times as long to move a VM from one Hyper-V host to another host, when compared to VMware or Virtual Server. I do not think that the person mentioning this was super familiar with Hyper-V export, but their comment did make a good point about the portability of VMs between hosts. Their goal was to efficiently migrate VMs from one host to another as part of an upgrade, and they were concerned about downtime.
You can copy a VHD from one host to another, but the configuration must be re-created. It’s very hard to replicate a VMs configuration (MAC addresses for NICs, memory configuration, other virtual hardware attributes) simply by moving a VHD. Hyper-V includes an export / import feature to encapsulate the configuration with associated VHDs for reuse. Exporting a VM duplicates the (sometimes) large VHD files from the source VM to another location.
The e-mail comment made it clear that the person had not considered exporting a virtual machine over the network to a new host, rather than to local disk on the source. They also didn’t know that SCVMM has a fantastic capability to move VMs from one host to another (similar to export and import), without the requirement of block level shared storage. I’m not going to talk about SCVMM here, since it’s really easy (point and click) to relocate a VM using SCVMM (check it out!).
I am going to detail how to export a Hyper-V VM over the network, since I don’t see it covered anywhere else (I Binged hard, I swear!).
In order to export a VM to a network share (on the ultimate Hyper-V target host) a network share must be created with the appropriate rights granted to the exporting Hyper-V host.
This may not be entirely intuitive, since you as the administrator are actually kicking off the export. To put it simply Hyper-V is doing the export, so it needs rights to the remote share, not you!
I just did this in my lab using two systems Hypernode1 (new host) and Hypernode2 (old host from which I want to export). Here are the steps I followed (FYI, I blanked out the domain name in all the screen shots):
Create share on Hypernode1 – I shared out C:\VMs – creating the \\Hypernode1\VMs share
I granted rights on the share to the Hypernode2 system. This can be a little tricky, since the “Select Users, Computers, Service Accounts, or Groups” dialog does default to searching for computers.
You have to remember to search for “Computer” objects rather than the typical Users or Groups. You have to change the Object Types to easily find a system (shown below):Once the “Object Types” are squared away, you can enter your host name, and grant it rights to the share:
You will want to grant sufficient share permissions to the host as well – not just READ:
You will also need to ensure that the exporting host has sufficient NTFS permissions – changing the “Select” is again something to do. The permissions I used are as follows:
Once I granted the exporting host rights to the share and the folder (NTFS), I was able to export my VM over the network in one step from Hypernode2, and then import the VM on Hypernode1:
Let me know if you have any questions or comment!
-John
Comments
Anonymous
January 01, 2003
It should work if you've also adjusted the NTFS permissions on the target directory - not sure why it isn't working for you. I don't have a Win 7 host in my lab right now, I can give it a whirl once I get into the office again and see if I run into the same issue. -JohnAnonymous
January 01, 2003
John, I one I've been called in on. This is the Scenario. 5 blades running 2008 Datacenter and Hyper-V with a failover cluster. The domain is core.*****.pri. They put the DC for the domain in a VM in the cluster. After a complete power down the cluster can't start because the DC is unavailable. They have 2 VMs on the cluster running production. If I set up 2 datacenter machine and use the dirver and build a cluster on them will the vm's be there? Thanks, TGAnonymous
January 01, 2003
John, The USB Drive was formated with FAT32. I re-formated it to NTFS and it is now exporting. When I get this VM up and running on the new server I will see what happens if i join the domain with the Data Center in workgroup and how it effects the VM. Thanks, TGAnonymous
January 01, 2003
The comment has been removedAnonymous
January 01, 2003
this in itself did NOT do it for me, I had to go one extra step and add "Constrained Delegation". THEN it worked!see http://blogs.technet.com/b/josebda/archive/2008/06/27/using-constrained-delegation-to-remotely-manage-a-server-running-hyper-v-that-uses-cifs-smb-file-shares.aspxAnonymous
January 01, 2003
TG, I have no idea the specifics of the configuration. I've seen folks virtualize their only Domain Controller many times and almost always be sorry for doing it. I would think you could log in locally or via cached credentials, access Hyper-V Manager and get to the VM to move it off, but I really can't say. -JohnAnonymous
January 01, 2003
TG - glad to hear an NTFS formatted volume is working for you! -JohnAnonymous
January 01, 2003
What about joining the domain with the DataCenter server? What problems would that cause with the VM?Anonymous
January 01, 2003
Marcelo - are you exporting to a Win7 system? As noted earlier, I ran into a similar issues using Win7 as a destination - had to give "everyone" full control (I don't recommend Win 7 as a file server, but I did get it to work). I'm not sure if the IMPI driver is related. I'm away from my lab this week so I can't do much in the way of testing. -JohnAnonymous
January 01, 2003
TG, I have not joined a Hyper-V host to a domain AFTER I have configured it, but I do not expect you should have any problems. The process outlined in the blog post should work for you then. -JohnAnonymous
January 01, 2003
Scott - not sure sure you may be running into, but I've done this a bunch of times. Both systems are in the same domain and there aren't any nutty GPOs that might be getting the way, are there?Anonymous
January 01, 2003
Mark - WOW! I RAN INTO THE SAME ISSUE EXPORTING TO A WINDOWS 7 SHARE! I have no idea what the issue is (I don't use Windows 7 as a file server), but I was able to successfully export if I gave EVERYONE "full control" on the share (I also had the exporting computer in the local administrators group, and had granted full access to the directory in NTFS). I don't recommend this as a solution, but then I don't recommend Windows 7 as a file server! I'll have to check in with a Windows 7 security expert to see what's up with that! -JohnAnonymous
January 01, 2003
TG, I export to USB drives most of the time - it should not matter which versions of Windows Server 2008 you use (Data Center, Enterprise, or Standard). I have not seen an Access Denied message exporting to a USB drive. You may need to go into Server Manager and bring the drive on online. Also, the drive should be formatted NTFS (large VHD files may not work otherwise). -JohnAnonymous
November 27, 2009
The comment has been removedAnonymous
December 06, 2009
I am running Hyper-V Server 2008 R2 and tried to export to a share on a Windows 7 and it is failing with Access Denied (0x80070005). I verified all the share settings are for the HYPERV host. I am very familiar with the system's account access over the network and adding hosts to shares (work's great with SQL Server for exporting/importing). I RDP'ed into the HyperV host and mapped a drive and could map a drive to the share and create folder. Obviously this was running under the Administror context, but I new the share was working. Is there something special about the core OS that would prohibit this from working?Anonymous
December 12, 2009
Your solution looks great but what about this. 2008 Data Center in WORKGROUP with a VM on the domain. Not enough room on the drive to export the VM. Can't give the Data Center (computer rights) to the share i would like to export to on the computer on the domain that has room. If Data Center was on the domain i think i would be ok. I tried a USB drive and got Access Denied (0x80070005). I realy have to get this moved. It is on a temp server in production. I have been looking all day and this is the best blog i have seen. Thanks, all ideas will bee appreciated, tgAnonymous
February 14, 2010
double checked share and ntfs (win7 domain member) destination perms. for our hyper-v computer account (a 2k8R2 data center - has FC in both share and ntfs) oubiously binged (39 results :( and checked kb2008849 still getting access denied error 0x80070005. so frustrating... I expect has not to do with http://www.aperture.ro/index.php/2009/01/intel-releases-patch-for-ipmi-driver-causing-conflicts-in-microsoft-hyper-v cause, but if yes...Anonymous
April 30, 2010
I have tried as you mentioned and gave the share and ntfs permissions full control for everyone but it made no difference. I am trying to copy files from one server to another and both are in a work group however they both have a share mapped of the others drive.Anonymous
May 13, 2012
That was really helpful and saved me a lot of crankjob! Thanks!Anonymous
May 14, 2013
I had a similar problem - different domains and no domain trust set up. I ended up enabling the guest user profile and group on my target machine and authorized them to the share that is my export target. That's not a good security practice, but it worked - I can disable the guest account after the export is done.Anonymous
November 05, 2014
Thanks for your post! This was very helpful!