HyperV - Move VMs from one drive to another?

Notice: Page may contain affiliate links for which we may earn a small commission through services like Amazon Affiliates or Skimlinks.

Fritz

Well-Known Member
Apr 6, 2015
3,382
1,385
113
70
From what I gather the easiest (proper?) way to do this is to export the VM's to the new location and then import them back into HyperV from the new location. Question is, once the VM's have been exported, do I delete the current VM's from HyperV before I import them?

TIA :)
 
  • Like
Reactions: jlhiowa

GaryD9

New Member
Feb 15, 2017
28
7
3
53
Pittsburgh, PA (USA)
IT depends...

If your running Hyper-V on two standard or data center servers, the easiest way to move them would be to just use live migration. No mess, or hassle.

If one of the two machines isn't a server product (for example, it's Windows 10), then you have to export/import. In that case, what I'd do would be to shut down the VM on the source server, export it, then import it to the new server and start/test it before deleting it from the source server.

Edit: oh, wait.. you mean just to change which disk they are stored on (and not the server)? Import/export works for that, but I'd think there'd be a better/faster way... If you export, I think you have to delete before re-importing to the same machine, otherwise you'll have duplicate (same UUID) VM's.
 

Fritz

Well-Known Member
Apr 6, 2015
3,382
1,385
113
70
Thanks.

Both VM's are Win 7. I was concerned with losing the activation thus the caution in proceeding. I tried to import one of them and got an error message saying the ID already existed. I then deleted them both then imported them without any further issues. They both remained activated so I'm a happy camper.
 
  • Like
Reactions: jlhiowa

manxam

Active Member
Jul 25, 2015
234
50
28
Fritz, right above "Export" in the Hyper-V settings is "Move" which allows you to move a) just the data vhd/vhdx files or b) move the storage AND xml configuration files.

This is by far the easiest way to move a VM between storage within the same host or to another device within your network that supports SMB3.1
When the VM is live, the "Move" option suspends the VM, moves the data, and resumes it.

Simple as.. well.. "Move" :)
 
  • Like
Reactions: jlhiowa and Fritz

Fritz

Well-Known Member
Apr 6, 2015
3,382
1,385
113
70
Thanks. I looked at "Move" but it's not installed by default and installing it looked like a major hassle. If I had to do this often or if I needed to move the VM while it was running I would definitely be using Move instead of export/import.
 
  • Like
Reactions: jlhiowa

GaryD9

New Member
Feb 15, 2017
28
7
3
53
Pittsburgh, PA (USA)
The OS in question is Windows Server 2012 R2 Datacenter. :rolleyes:
Ah.. I was confused as an earlier post in the thread made reference to Windows 7, but there was no mention of hosting OS.

I didn't know that live migration had to be specifically installed. I knew that the "destination" side had to have a couple of options enabled to accept the migration, but I've always seen the "move" option when I've installed 2012R2 (and now 2016) server standard. I guess datacenter doesn't enable it by default? (I have no idea... maybe I've always accepted migration as a feature to be installed when I installed the hyper-v role.)

I wonder if live migration is enabled in the stand-alone hyper-v product or not.
 
  • Like
Reactions: jlhiowa

vl1969

Active Member
Feb 5, 2014
634
76
28
I do not understand the OP question, or rather what exactly is the issue here..

if you want to move where the VM files are located, use the Move option in Hyper-V Manager.
that is Right-CLick the VM and choose Move. it is not an extra feature or app. it is an option built in into Management interface.

the only confusing part I have found is that initial dialog screen says move VM storage but later screens give you option to select other parts of VM setup to be moved as well.

also you can not live migrate the VM (when it is running) the VM Must be shutdown !!!NOT SAVED!!! and you might need to remove snapshots as you might loose them during move. I have no test VM with snapshots to try this out.
 
  • Like
Reactions: jlhiowa

Fritz

Well-Known Member
Apr 6, 2015
3,382
1,385
113
70
I needed to free up the HD where the VM's and their VHD's were located. All I need to do was move the associated files/folders to another HD so that I could repurpose said HD. Altho the proper term (to me anyway) is "Move", this is obviously not the way that MS sees it. Export / Import did exactly what I needed to do, i.e. "move" the VM's to another drive. The confusion resulted from the "move" function not being installed by default and it not really being suitable for my needs as stated above. Hope this clears it up. :)
 
  • Like
Reactions: jlhiowa

vl1969

Active Member
Feb 5, 2014
634
76
28
I needed to free up the HD where the VM's and their VHD's were located. All I need to do was move the associated files/folders to another HD so that I could repurpose said HD. Altho the proper term (to me anyway) is "Move", this is obviously not the way that MS sees it. Export / Import did exactly what I needed to do, i.e. "move" the VM's to another drive. The confusion resulted from the "move" function not being installed by default and it not really being suitable for my needs as stated above. Hope this clears it up. :)
Fritz.. as I outlined in the post above, the "Move" function is built-in. an I do not mean Live Migration or similar options. I mean a function to move all VM related files to a different location/drive.

if it does not work for you, you might have a problem with configuration or something. OR the VM you are trying to move have a checkpoint(s).

as per MS documentation you can not move a VM that is misconfigured or have checkpoint applied.
Steps are :

#1. Use Hyper-V Manager.
#2. Shutdown the VM you want to move. make sure you merge all checkpoints etc.
#3. Right-Click on VM and select option Move in the dropdown
#4. on the Wizard screen you get "Choose Move Type" > Move the virtual machine's storage (already selected) > click Next

#5. next screen give you option for moving. First option gives you VM to single location,
second you can choose each set of files gose where (ie. disks go one folder, configs in other , snapshots third etc.) if you need to finetune the locations select option 2 , if all files go into single folder, option one

#6. select where you want to move the files. this could be different folder or disk altogether.
#7. click finish and wait until move is done.

#8. Enjoy!

I simply do not understand what you mean by need to install "Move" option. I did not install anything else but Hyper-V role.

what is your setup like?
 
  • Like
Reactions: jlhiowa

GaryD9

New Member
Feb 15, 2017
28
7
3
53
Pittsburgh, PA (USA)
Fritz.. as I outlined in the post above, the "Move" function is built-in. an I do not mean Live Migration or similar options. I mean a function to move all VM related files to a different location/drive.
...
#3. Right-Click on VM and select option Move in the dropdown
The "Move" option on the right-click menu IS live migration. That's how to kick off a live migration. If the server is started, it moves the running VM while it's still running. If the VM is stopped, obviously it moves the non-running VM. Everyone keeps talking about "live migration" and a "move" option as if they are different things. They aren't.

Here's some MS documentation on it:

Virtual Machine Live Migration Overview

Use live migration without Failover Clustering to move a virtual machine

I suppose the reason that Fritz didn't have the option to 'move' was that the VM version was <5? (I'm only guessing. I've never NOT seen the 'move' option on a VM hosted by windows server 2012 R2.)
 
  • Like
Reactions: jlhiowa

Fritz

Well-Known Member
Apr 6, 2015
3,382
1,385
113
70
This move was from one HD to another in the same box, not from one server to another. This should be straight forward and easy but as usual, MS has to unnecessarily complicate it. In my research I kept running into "Live Migration", "Active Directory", "Domain" etc. etc. All this did not apply to my situation. That's why I came here looking for an answer.
 
  • Like
Reactions: jlhiowa

manxam

Active Member
Jul 25, 2015
234
50
28
I use "Move" on a near weekly basis on a Server 2012 R2 Datacenter standalone server. I have 2 tiers of storage and often use the "Move" command to relocate a VM from a fast tier to slow or vice-versa depending on what that OS is doing at the time. While this command can ALSO be used in "live migrations" between servers (if you've enabled the checkbox in settings to allow live migrations), it's normal purpose is to move a virtual machine to another directory or drive within the same server.

In a fresh install of 2012 R2 Std installed this morning, I see "Connect", "Settings", "Turn Off", "Shutdown", "Save", "Pause", "Reset", "Checkpoint", "Move", "Export", "Rename" in the list of options when clicking on a newly provisioned VM.

I'd be incredibly surprised if this option was missing from your list Fritz as I've deployed hundreds of Hyper-V servers and all have this option.

Regardless, it seems that the Export/Import has worked for you but, as you've found, the issue is that while importing you cannot overwrite an existing VM w/o:
A) deleting the original vm.
B) Importing using a new ID which also generates a new MAC and, if this is a domain controller, can royally mess with things as this is detected by Windows as a new clone.
C) Running three separate commands to: export, delete, import
 
  • Like
Reactions: jlhiowa

Fritz

Well-Known Member
Apr 6, 2015
3,382
1,385
113
70
Playing around with another server I noticed the option to enable live migration / move when installing Hyper-V. Never noticed this before. Why the heck isn't it checked by default?? :confused:
 
  • Like
Reactions: jlhiowa

cesmith9999

Well-Known Member
Mar 26, 2013
1,420
470
83
because you may not want other people to just be able to migrate VM's to your server without you knowing about it...

Chris
 

manxam

Active Member
Jul 25, 2015
234
50
28
@cesmith9999: You can't actually do this without configuring hyper-v delegate permissions in AD computers or configuring a kerberos ticket first. So, I'm not really certain why it wouldn't just be enabled by default.

Oh well, glad you found it @Fritz!
 
  • Like
Reactions: jlhiowa

frogtech

Well-Known Member
Jan 4, 2016
1,482
272
83
35
Doesn't live migration/move just apply to which machine in a cluster is using it's resource to run the VM? Live migration/moving requires shared storage and doesn't move the location of the VHD unless you go through that menu. Otherwise you can literally just move the VHD(if this is what you want to do)then re-configure the location of the VHD for a given VM.
 
  • Like
Reactions: jlhiowa