Fail: How to move a VM to another disk (same machine)

This is for discussing general topics about how to use VirtualBox.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Fail: How to move a VM to another disk (same machine)

Post by mpack »

pancakesaregood wrote:...its much easier then trying to do it through the GUI because an XML file doesn't complain about duplicate GUIDs.
Actually, VirtualBox doesn't complain either: that bug was fixed in 4.3.0 (see the linked bug ticket above).
ODTech
Posts: 17
Joined: 27. Jan 2014, 20:05

Re: Fail: How to move a VM to another disk (same machine)

Post by ODTech »

You have to release/remove the old drive from virtualbox to not run into the uuid error after moving a vdi.

Open virtualbox.
Click File
Click Virtual Media Manager
Right click on the drive you moved and click release
Right click again and click remove
Edit: Don't delete the files, just select remove or you'll loose your vm.

Now you can go to the corresponding VM and re-add the moved vdi.

Cheers
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Fail: How to move a VM to another disk (same machine)

Post by mpack »

ODTech wrote:You have to release/remove the old drive from virtualbox to not run into the uuid error after moving a vdi.
If you'll read the message directly above yours, you'll see that your advised procedure is not required since 4.3.0.
ODTech
Posts: 17
Joined: 27. Jan 2014, 20:05

Re: Fail: How to move a VM to another disk (same machine)

Post by ODTech »

mpack wrote:
ODTech wrote:You have to release/remove the old drive from virtualbox to not run into the uuid error after moving a vdi.
If you'll read the message directly above yours, you'll see that your advised procedure is not required since 4.3.0.
Not realy. I'm running 4.3.6 and still have the uuid issue. I tested it just now while writing this. I renamed a vdi file then tried to readd it to the corresponding vm and i got the uuid error. Then i figured the issue isn't renaming it's moving so i made a copy and tried to the readd the vdi with the same name but at a different location and still go the uuid error.

Anyone having the same issue refer to above post(s) for solutions.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Fail: How to move a VM to another disk (same machine)

Post by Perryg »

ODTech is correct. If you want to move the file you need to first remove it and then you can add it back. IIRC the previous issue was that you also had to kill all VBox services before you could add it back but that part has been fixed.

You can achieve the same thing by editing the xml file but that is never the first approach unless you know what you are doing, plus everything VBox must be shut down or the edit will not stick.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Fail: How to move a VM to another disk (same machine)

Post by mpack »

I see why I was confused - the contribution was simply off topic: this thread is about moving a VM, not how to move or rename one VDI.
ODTech
Posts: 17
Joined: 27. Jan 2014, 20:05

Re: Fail: How to move a VM to another disk (same machine)

Post by ODTech »

mpack wrote:I see why I was confused - the contribution was simply off topic: this thread is about moving a VM, not how to move or rename one VDI.
It's one and the same thing really. The VDI IS the virtual machine as it's acting as a hard drive.

The reason it wouldn't work after you moved the machine is because the associated VDI was still registered in virtual box and expected to be in the original location. You can not add the same VDI twice. If you had simply released/removed the VDI before moving the machine you'd have had no issue recreated/importing the machine at another location.

The other advice like default machine paths wasn't really relevant to your issue. When i move a machine i leave the XML files in the original default location and just move the VDI file to free space on C:

The solution to you problem is editing the XML file to update the VDI location or release/remove the VDI via Virtual Media Manager before moving.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Fail: How to move a VM to another disk (same machine)

Post by mpack »

No, that is completely wrong. Can you take a disk drive out of a physical PC and run software on it without a computer? Is it guaranteed to work if you pick another computer at random and install it there? What if a VM has multiple disk drives - are they all synonymous with the VM?

A disk drive is a disk drive. It is not a PC, and this thread is not about moving a disk drive, whether you agree with me or not.
ODTech
Posts: 17
Joined: 27. Jan 2014, 20:05

Re: Fail: How to move a VM to another disk (same machine)

Post by ODTech »

jvsrvcs wrote:
Perryg wrote:Well I can only assume that you mean 4.1.8 so here goes.

You should have a folder called VirtualBox VMs. This folder has all of your guests in them (if they were created with version => 4.*) including the snapshots.
You can copy this folder to the new location and remove them from the VirtualBox main manager (without deleting them)
Then use the add feature to add them back one at a time. (select the *.vbox file)
You should then open the preference section in the VirtualBox main manager and change the default location to the new place.

Be sure to backup the VirtualBox.xml file before you start just in case you make a mistake.
Once this is all working then you can delete the original VirtualBox VMs folder.

Look this all over and become familiar with the locations before you start to help prevent errors.
What you have suggested above did not work. It failed and is not a solution to the question posted. It wasted a lot of my time doing this.
I cannot copy and paste the exact error message in the error dialog, but it is something like this:

--- (got this when I tried to add the .vbox file)
Failed to open virtual machine located in:

E:/.../machine.vbox

Cannot register the hard disk 'E:\...\vmdir\Snapshots{fff... because a hard disk 'C:\<path>\Snapshots\{fff}.vdi

with UUID {fff...} already exists.
Be as it may but OP's issue was directly related to the VDI file because he wanted to move them to a larger drive. See above quote is the first technical info from OP (notice the "drive with UUID already exit error") and then the advice PerryG gave to OP.
PerryG's advice was correct but incomplete. If you delete a VM from the Main Manager it does not delete the coresponding record of the VDI from the Media Manager.

Before you can re-use a VDI file that has been moved you first have to delete it's record from the virtualbox media manager. Only after you deleted the record can you associate it to a VM from the new location.

Once again, the solution to the issue in this thread is releasing the VDI file and readding it to the VM after it has been moved. Whether your moving the whole VM or just the VDI the solution stays the same.
actionmystique
Posts: 28
Joined: 28. Feb 2013, 10:18
Primary OS: Linux other
VBox Version: PUEL
Guest OSses: Ubuntu 15.04, Windows 7, Windows Server
Location: Paris, France

Re: Fail: How to move a VM to another disk (same machine)

Post by actionmystique »

Here's what I did and it works perfectly (Windows 8.1 - last VB):
1) I moved the whole "VirtualBox VMs" tree to another disk on the same system (D:\)
2) I changed the path in "File - Preferences - General"; this should have been enough here - VB must be upgraded towards that simplicity
3) I edited the .VirtualBox\VirtualBox.xml file with Microsoft XML Notepad Editor to update all the paths: http://www.microsoft.com/en-us/download ... px?id=7973

Et voilà!
Jean-Christophe Manciot
G+/+jeanchristopheManciot-IT/posts
Twitter @jc_manciot
GitHub /jean-christophe-manciot
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Fail: How to move a VM to another disk (same machine)

Post by mpack »

actionmystique wrote: 2) I changed the path in "File - Preferences - General"; this should have been enough here - VB must be upgraded towards that simplicity
You clearly do not understand what that option is for. It has nothing to do with the location of existing VMs, it's the default folder for new VMs you might create in future.

While editing xmls will be easy for some, we do not recommend it for non experienced users. The procedures we recommend are intended to be the simplest ones that will work for all levels of expertise.
actionmystique
Posts: 28
Joined: 28. Feb 2013, 10:18
Primary OS: Linux other
VBox Version: PUEL
Guest OSses: Ubuntu 15.04, Windows 7, Windows Server
Location: Paris, France

Re: Fail: How to move a VM to another disk (same machine)

Post by actionmystique »

That's exacltly my point: it shouldn't be difficult to change the "range" of that particular setting so it encompasses current and future VMs...
Jean-Christophe Manciot
G+/+jeanchristopheManciot-IT/posts
Twitter @jc_manciot
GitHub /jean-christophe-manciot
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Fail: How to move a VM to another disk (same machine)

Post by mpack »

How would it do that? There is no obligation to keep all your VMs in one folder.
actionmystique
Posts: 28
Joined: 28. Feb 2013, 10:18
Primary OS: Linux other
VBox Version: PUEL
Guest OSses: Ubuntu 15.04, Windows 7, Windows Server
Location: Paris, France

Re: Fail: How to move a VM to another disk (same machine)

Post by actionmystique »

VMware can "vmotion" the VMs within a data center across thousands of hosts, and you're telling me VirtualBox cannot simply move the VMs within a single host?
Jean-Christophe Manciot
G+/+jeanchristopheManciot-IT/posts
Twitter @jc_manciot
GitHub /jean-christophe-manciot
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Fail: How to move a VM to another disk (same machine)

Post by mpack »

Point out where I said that?

Anyway, it now sounds like you're talking about teleporting, which is a different subject entirely. Seriously, you should take the time to learn more about VirtualBox before you starting debating it's virtues.

Also, VMware doesn't necessarily serve the same market as VirtualBox. If you are happy with the VMWare feature set then I suggest you stick with VMWare - being a clone of VMWare is not a VBox design goal.
Post Reply