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

This is for discussing general topics about how to use VirtualBox.

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

Postby mpack » 7. Mar 2012, 22:19

I created a new ticket (10311) on BugTracker for this issue.
mpack
Site Moderator
 
Posts: 33695
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)

Postby bbergman » 18. Oct 2012, 19:42

For what it's worth, I just hit this issue too. I'm running VirtualBox 4.1.23, but I don't believe this issue to be version related. It's just how VirtualBox works.

Background: I had a perfectly working VB instance on my Mac (Snow Leopard) which I have been using casually at work. I decided I wanted to take it home and play, but didn't want to drag my MacBook around with me, so I started looking at options to be more portable. Other than VirtualBoxImages.com (which honestly doesn't seem to be very mature), I found no easy way to host my instance in the cloud. So, I thought, maybe I'll just move my VDI to flash and run it as needed!

(The [acceptable] caveats being that I would have to start/stop my machine each time I wanted to take the SD card home, and that non-critical failures could occur if I weren't careful.)

I happily copied the VDI to a newly formatted ExFat SD card, renamed and moved my original VDI file (as a backup precaution), and deleted the old HDD reference from the VBManager settings. Then I went to point it to the new VDI location. Wham! I got the same error message, and well, here we are. ;-)

After reading the thread above, someone pointed out that VBManager holds on to the UUID of the old device, even though you've removed it. I could go either way on this, but I see it as a bug. Fortunately, there's a workaround. Someone mentioned that the .vbox files are XML, and sure enough, the UUID was recorded in the .vbox file in one of the key pairs at the top of the file. I made a backup copy of the .vbox file, and then edited the "production" one. Since the UUID would remain the same, I just changed the path of the VDI file, leaving everything else alone. I then restarted VBManager and made sure the storage option looked kosher (it did), then started my VM. Seems to work just fine, from startup to shutdown and in-between. As expected, it's running a bit slower than normal, but it's not horrible. That's a fair tradeoff for being able to take my instance home in my pocket. ;-)

Warning: edit your own .vbox file at your own risk!

Thanks,
bruce
bbergman
 
Posts: 2
Joined: 22. Aug 2012, 07:21

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

Postby mpack » 19. Oct 2012, 11:50

Moving the main VDI onto a portable drive, outside the VM folder, is also risky - for example in the hands of newbies it will likely lead to corrupted snapshots.

Better IMHO to relocate the VM folder as a whole, using methods similar to that outlined above - though being on a removable drive makes this option less than ideal too.
mpack
Site Moderator
 
Posts: 33695
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)

Postby christ2 » 31. Oct 2012, 17:26

bbergman wrote:
After reading the thread above, someone pointed out that VBManager holds on to the UUID of the old device, even though you've removed it. I could go either way on this, but I see it as a bug. Fortunately, there's a workaround. Someone mentioned that the .vbox files are XML, and sure enough, the UUID was recorded in the .vbox file in one of the key pairs at the top of the file. I made a backup copy of the .vbox file, and then edited the "production" one. Since the UUID would remain the same, I just changed the path of the VDI file, leaving everything else alone. I then restarted VBManager and made sure the storage option looked kosher (it did), then started my VM. Seems to work just fine, from startup to shutdown and in-between. As expected, it's running a bit slower than normal, but it's not horrible. That's a fair tradeoff for being able to take my instance home in my pocket. ;-)

Warning: edit your own .vbox file at your own risk!

Thanks,
bruce


Thanks Bruce, wish I had read your post 5 hours ago, your post saved what little hair I have remaining..lol. I had my .vmdk files in a user path, changed the user name & profile folder & wham my VM was down:-{ Went to the users\username\.VirtualBox\VirtualBox.xml, did a quick search for the old 'UserName' edit the file with the new one, checked the storage path were kosher & whoaa, I'm back in business...thanks
christ2
 
Posts: 14
Joined: 31. Oct 2012, 17:09
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Win XP Ubuntu

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

Postby zunny » 9. Dec 2012, 23:32

Thanks to "Perryg" ....

I did this on Wiindows 7 PC...using VirtualBox 4.2.4... and i believe similar thing should be applicable to most version on windows pc.
It was very easy to move. Here's how i did mine:

1.) Copy your "VirtualBox VMs" folder from its current location which is "C:\" to any location you desire. ****If you don't know where to locate the folder, Open your VitualBox Manager and go to "Files,Preferences,General"... or just press "Ctrl-G" on your keyboard. There, you'll find "Default Machine Folder" path...(i.e. C:\Users\Dell\VirtualBox VMs). Now locate the folder on your computer and copy the "VirtualBox VMs" folder to new location. (Remember,Do not delete yet. Only copy,just incase.)

2.) Change your "Default Machine Folder" to the new location. ****If you don't know how, its the same place you located the previous folder "Files,Preferences,General"... or just press "Ctrl-G". Click the drop down options in front of "Default Machine Folder" -=- "Other" and toggle to select your "VirtualBox VMs" folder from the new location.

3.) Now go back to your VirtualBox Manager. Right click on your Guests and click "Remove". It'll pop up with 3 options, IMPORTANT: Click on "Remove only". (Remember,Do not delete anything yet).

4.) Now close your VirtualBox Manager. And then Right click on toolbar "Start Task Manager". Inside Task Manager, go to "Processes".... Check to see if "VBoxSVC.exe" is still running.... If yes, click on it and "End Process" ...If no,it has timed out and you're good to go. F5 to refresh your desktop.

5. Open your VirtualBox Manager again. Go to "Machine,Add". Your new location should be there automatically. If not, just locate,Then use the add feature to add your guests back one at a time. (select the *.vbox file).

Thats all... You can start your guest to see if it works. If yes,be free to delete the original file in old location as you already have it running on a new location. Goodluck
zunny
 
Posts: 1
Joined: 9. Dec 2012, 22:27

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

Postby AnnapolisBob » 12. Dec 2012, 20:44

zunny,

Thank you. Your instructions worked perfectly on my iMac to move 3 VMs from my SSD to my 1T HD.
AnnapolisBob
 
Posts: 1
Joined: 12. Dec 2012, 20:37

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

Postby who? » 7. Jan 2013, 22:37

Worked great on windows 7 workstation. Moved 3 VM's to a different drive (same machine) in 1 hour. Logged into all three with no problem. All snapshots look fine (I didn't revert to them to make sure that they were working). The only reason this took so long was the time it took to copy the folders to the new drive.
who?
 
Posts: 1
Joined: 7. Jan 2013, 22:31

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

Postby BGM » 9. Mar 2013, 03:42

Mr. mpack, this worked for me VirtualBox 4.2.6 on Windows7 Pro x64
BGM
 
Posts: 1
Joined: 9. Mar 2013, 03:40
Primary OS: MS Windows 7
VBox Version: OSE other
Guest OSses: Windows7, Window XP

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

Postby statik » 20. Mar 2013, 14:28

Hello
can anyone help?
I want to move a VBox VM to another PC with the Snapshhots.
Please write me step by step what to do
statik
 
Posts: 18
Joined: 9. Mar 2013, 23:46

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

Postby mpack » 20. Mar 2013, 16:01

A step by step is already given above. What do you not understand?
mpack
Site Moderator
 
Posts: 33695
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)

Postby statik » 20. Mar 2013, 20:25

I did exactly :
Code: Select all   Expand viewCollapse view
1.) Copy your "VirtualBox VMs" folder from its current location which is "C:\" to any location you desire. ****If you don't know where to locate the folder, Open your VitualBox Manager and go to "Files,Preferences,General"... or just press "Ctrl-G" on your keyboard. There, you'll find "Default Machine Folder" path...(i.e. C:\Users\Dell\VirtualBox VMs). Now locate the folder on your computer and copy the "VirtualBox VMs" folder to new location. (Remember,Do not delete yet. Only copy,just incase.)

2.) Change your "Default Machine Folder" to the new location. ****If you don't know how, its the same place you located the previous folder "Files,Preferences,General"... or just press "Ctrl-G". Click the drop down options in front of "Default Machine Folder" -=- "Other" and toggle to select your "VirtualBox VMs" folder from the new location.

3.) Now go back to your VirtualBox Manager. Right click on your Guests and click "Remove". It'll pop up with 3 options, IMPORTANT: Click on "Remove only". (Remember,Do not delete anything yet).

4.) Now close your VirtualBox Manager. And then Right click on toolbar "Start Task Manager". Inside Task Manager, go to "Processes".... Check to see if "VBoxSVC.exe" is still running.... If yes, click on it and "End Process" ...If no,it has timed out and you're good to go. F5 to refresh your desktop.

5. Open your VirtualBox Manager again. Go to "Machine,Add". Your new location should be there automatically. If not, just locate,Then use the add feature to add your guests back one at a time. (select the *.vbox file).


In the same PC , between another folders or disks its work 100% ok.
But not works between 2 another Pc's
I see in VirtualBox Manager the Guest , the snapshoots names an the previewscreen the screenshoot. But after start i see the massage:
Image

Uploaded with ImageShack.us

I have to 2 pc the same Windows 7 and version on Virtual box
statik
 
Posts: 18
Joined: 9. Mar 2013, 23:46

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

Postby Martin » 20. Mar 2013, 20:36

The guest VMs need to be off, not in a saved state!
You cannot switch a CPU in a PC which is just "sleeping" ;)
Martin
Volunteer
 
Posts: 2463
Joined: 30. May 2007, 18:05
Primary OS: Fedora other
VBox Version: PUEL
Guest OSses: XP, Win7, Linux, OS/2

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

Postby Perryg » 20. Mar 2013, 20:40

Actually at this point you should be able to click the discard icon and then start it normally.
In the future shut down before moving.
Perryg
Site Moderator
 
Posts: 34373
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)

Postby mpack » 20. Mar 2013, 21:20

Martin wrote:You cannot switch a CPU in a PC which is just "sleeping" ;)

Well, you can, just don't expect to be pleased with the result! :)
mpack
Site Moderator
 
Posts: 33695
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)

Postby pancakesaregood » 4. Feb 2014, 01:16

Hello All, not sure if any of you are having this issue still but I've got the easiest and quickest way to do this for you.

Step 1: Close and make sure VirtualBox isn't running (make sure the service isn't running in the background)
Step 2: Copy the VirtualBox VMs folder to the desired location in a new folder/drive
Step 3: Backup and then open up the VirtualBox.xml file (for me its located in C:\Users\me\.VirtualBox) then make your way down to the <MachineRegistry> section there you can change the path that VirtualBox looks for the machines vdi's etc
Step 4: Save the VirtualBox.xml file and delete the old VirtualBox VMs
Step 5: Start up VirtualBox and all of your machines will now run from the new location

This took me a total of 5 minutes aside from copying the VMs, its much easier then trying to do it through the GUI because an XML file doesn't complain about duplicate GUIDs.
pancakesaregood
 
Posts: 1
Joined: 4. Feb 2014, 01:06

PreviousNext

Return to Using VirtualBox

Who is online

Users browsing this forum: Schaffstein and 26 guests