Is it possible to change the location of a VM?

This is for discussing general topics about how to use VirtualBox.
Post Reply
scp
Posts: 106
Joined: 14. Feb 2010, 22:12
Primary OS: Ubuntu 12.04
VBox Version: OSE self-compiled
Guest OSses: Windows XP, 2003, 7, 8.1

Is it possible to change the location of a VM?

Post by scp »

I am a VBox user since 1.6x so, I have the old scheme with different folders for VM config and VDIs.
The VM I want to move for example is located under:
/opt/VirtualBox/Machines/SCPW7/
And it has only one VMDK attached which uses a physical disk:
/opt/VirtualBox/VDI/SCPMain-nvidia_dihjeefh1b-6.vmdk

Now just want to move the existing files to ~/VirtualBox/Machines/SCPW7/ because /opt is on another partition.
In older versions it was possible to change the locations in the XML files, but now they make no sense to me anymore, because all changes get lost after starting VirtualBox, so they are dummys?

Is it possible to change the "src" value in "MachineEntry" and "location" in "HardDisk" by VBoxManage?

Deleting and recreating/reattaching is not the way I want to go.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Is it possible to change the location of a VM?

Post by Sasquatch »

If you want to be sure everything goes right, make a backup, then modify the XML files manually. I haven't seen a syntax to change the path of a VM, so it's either removing the VM, keep the files and re-add it, or edit the files.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
scp
Posts: 106
Joined: 14. Feb 2010, 22:12
Primary OS: Ubuntu 12.04
VBox Version: OSE self-compiled
Guest OSses: Windows XP, 2003, 7, 8.1

Re: Is it possible to change the location of a VM?

Post by scp »

That is what I already did, the result was:
"In older versions it was possible to change the locations in the XML files, but now they make no sense to me anymore, because all changes get lost after starting VirtualBox"
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Is it possible to change the location of a VM?

Post by Sasquatch »

Did you edit all the XML files that have something to do with it? In this case, both the VM XML and the VB.xml file. Be sure to check all path locations, I found out that the VDI path can be at the beginning of the VM xml as well.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
scp
Posts: 106
Joined: 14. Feb 2010, 22:12
Primary OS: Ubuntu 12.04
VBox Version: OSE self-compiled
Guest OSses: Windows XP, 2003, 7, 8.1

Re: Is it possible to change the location of a VM?

Post by scp »

Yes I changed both, the main VirtualBox.xml file and the VM file SCPW7.xml.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Is it possible to change the location of a VM?

Post by Sasquatch »

If changes are lost when you start VB, it means that the process writing the files hasn't closed yet after you modified the files. Just move the files to the new location and add it from the Machine > Add menu.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
Post Reply