By default VirtualBox stores all data in a directory below the home directory. I know how to change it but how can I change the location of existing images (without editing VirtualBox.xml manually)?

I'm working on Windows and don't want to try using any NTFS links.

  • 4
    Awww, I was going to suggest symlinks (they solve Everything™), but you've blocked that idea... :( – DMA57361 Mar 11 '11 at 11:03
  • 2
    I don't trust links on Windows at all. While NTFS is capable of it, Windows XP knows nothing about it and there are enough problems with it already. I may be needlessly coward... – maaartinus Mar 11 '11 at 11:25
  • Ah, yeah, I wouldn't touch them on XP. But support on 7 is pretty solid - you still have to build them from the cmd line, but that's not really much of a chore. I'm not sure about Vista... – DMA57361 Mar 11 '11 at 11:32
  • It's even worse, XP version of NTFS does support hardlinks, but these cannot span volumes. Obviously, I wanted to move the data to a different partition. – maaartinus Mar 11 '11 at 12:13
  • Hardlinks can't ever span volumes, only symlinks can (and can be used for this sort of thing, my user folders are all symlinked to my second HDD, for example). But, personally I'd still avoid hardlinks in XP (even if they were an option). – DMA57361 Mar 11 '11 at 12:16

15 Answers 15


If you mean to MOVE all your VM to an entirely new location, you should just follow these 2 replies:

Copying the post here:

  1. Shut down VirtualBox, back up your .VirtualBox\VirtualBox.xml file.
  2. Find your existing "Virtualbox VMs" folder, and copy (not move) the whole folder with contents to your new drive E:
  3. Run VirtualBox, then for each VM in turn:

    3.1 Right click the VM name and select "Remove" from the popup menu. Answer no to the "physically delete files?" question.

    3.1b after removing a VM from the UI you have to close VirtualBox, and leave it closed for long enough for the background VBoxSVC task to time out and terminate also. Then you can start the VirtualBox app again and use Machine|Add to add back the VMs removed in the previous step.

    3.2 Select the Machine|Add.. menu item, navigate to the VMs new location on drive E:, and select the .vbox file.

    3.3. Repeat for any remaining VMs.

  4. In File|Preferences, set the default machine path to "E:\VirtualBox VMs"
  5. Test each of the VMs. Only after you are sure they all work, delete the old VM containing folder, i.e. delete "C:\VirtualBox VMs".
| improve this answer | |
  • When I do this for linked-clone machine, they fail to start – Nam G VU May 3 '12 at 9:28
  • 1
    This worked for me, though I also needed to update the paths to each HardDisk and snapshot image by editing the .VirtualBox\VirtualBox.xml file, and doing a find/replace. Also, I only moved the Machines and HardDisk folders, not all the files contained under .VirtualBox, since that's all the global configuration and logging and such. – Dave Andersen Jul 23 '12 at 22:38
  • 4
    For Mac OS X users, VirtualBox.xml is located at ~/Library/VirtualBox/VirtualBox.xml. The VMs are located in ~/VirtualBox VMs. – Siu Ching Pong -Asuka Kenji- Sep 25 '14 at 3:45
  • 3
    Virtual Box 4.3.0+ has solved the "Last Important Thing", I didn't even need to close it - instructions. – PCaetano Dec 16 '14 at 18:16
  • 1
    Virtualbox now has an official "Move" option for VM's. Just shutdown your VM and right click it in the UI and select "Move" – Shadoninja Jun 4 at 22:30

I only had a couple of VMs, and I found that I could just change the default storage location for VirtualBox and then clone my VM's. The clones where created in the new location on the new HD where I wanted them. Everything intact, snapshots and no need to remap the location of the virtual HDs.

| improve this answer | |
  • 3
    +1 I think this is the best method. VirtualBox moves everything for you in a tidy little bundle. – Dave Andersen Aug 7 '12 at 23:35
  • 3
    this is the best way, no manual cfg editing required – Bojan Bjelic Mar 7 '13 at 23:01
  • how do you do this??? – FlipFloop Jan 6 '17 at 20:58
  • This really should be the accepted answer – theV0ID Mar 26 '17 at 20:01
  • 1
    Warning: Clone doesn't produce a perfect copy and may trigger a need to update licenses for installed software as machine/disk ids change. Encountered this when moving an old copy of Quicken on a VM to a new disk. – MZB Jan 26 '19 at 15:36

The easiest method doesn't require removing your virtual machines and mucking up their settings.

  1. Copy your Virtualbox VMs folder to a new drive.

  2. Run the Virtual Box Machine Manager. Run the media Manager File -> Virtual Media Manager

    2a. Choose the VM to move storage for. Click the Release button and then the Remove button. On the next dialog, you can either remove or keep the virtual drive. Close the manager leaving you in your Virtualbox Machine Manager.

  3. Select the VM you just removed media for, click the Settings button, Click the Storage section. Add a controller for the media (SATA usually) and then add a hard drive and choose existing disk and select the VD at your new location.

  4. Repeat for each machine you're moving

Fire off your virtual machine at the new location to check. Next time you visit the Virtual Media Manager, hovering over the VM entry will show you where the VD is stored.

Make sure you change your snapshots folders to point to the new drive if you're using them. Each machine has a snapshot folder setting and the VM Manager has a Default Machine folder setting in File -> Settings that needs to be changed as well.

In addition I had to also modify path in xml file. After that it worked flawlessly.

NOTE: Things have changed a bit since this was written, see Rob's answer. It's extremely simple now.

| improve this answer | |
  • 2
    i think this is by far the easiest way of doing this. – Peter Perháč Oct 4 '16 at 20:18

MUCH, MUCH simpler. 1) move to new location 2) Right-click remove from virtualbox menu 3) Select 'add' from machine menu 4) Find the 8kb Blue icon that has a type of 'virtualbox machine definition' . Select it and it will add to your virtualbox list. double click virtual machine and it works.

| improve this answer | |
  • Even simpler than this is when you want to add the VMs back to VirtualBox, just click the *.vbox file in its folder. – Joel Mellon Sep 4 '15 at 17:28
  • 2
    How things change in three years... Wish had been this easy back then. Added note to my answer for them to come see this one. – Fiasco Labs Nov 20 '15 at 3:36
  • 1
    This should really be higher up. I fiddled around and couldn't make it work. Simply removing the "inaccessible" ones in the UI and then double-clicking the .vbox file re-added it using the new location. – wenbert Apr 21 '17 at 0:18
  • Does not work on Linux host. Getting this error: The VM session was closed before any attempt to power it on. Result Code: NS_ERROR_FAILURE (0x80004005) Component: SessionMachine Interface: ISession {7844aa05-b02e-4cdd-a04f-ade4a762e6b7} – Max N May 16 '17 at 11:14
  • 2
    The "remove" part of this mthod feels like a bad idea that will result in the loss of your settings but it doesn't. This method maintains all of your settings and is the easiest of all the methods I tried. It worked on a Windows 10 host with both Windows 7 and Windows Sever 2016 guests. – Night Owl Dec 26 '18 at 0:50

On Mac, edit the paths in this file:


That was easy, presto!

| improve this answer | |
  • 3
    He is using Windows, and he also doesn't want to edit VirtualBox.xml. – ChrisN Feb 5 '13 at 23:29
  • 4
    This was helpful to me, though, since this question is still googlable if you're on mac. – NReilingh Nov 22 '13 at 7:54
  • I am a mac user and google landed me here and this solution is the simplest of all, makes perfect sense and worked for me :) – Mohit Singh Oct 28 '17 at 9:26
  • I'm on linux, and liked the sound of this answer, but I was put off by the warning at the top of the file. Would you still recommend editing the XML directly? The warning says: ** DO NOT EDIT THIS FILE. If you make changes to this file while any VirtualBox related application is running, your changes will be overwritten later, without taking effect. Use VBoxManage or the VirtualBox Manager GUI to make changes. ** – craq Mar 4 '18 at 0:58

After wasting a whole day on this problem (using Virtualbox 5.0.12 on Arch Linux), I finally got it solved in the way thomthom's answer suggests. For those who are unsure about the exact procedure, the command which clones an entire machine (including snapshots) is:

VBoxManage clonevm --mode all --basefolder </new/path/> --register <VM_to_clone>

Obtain the VM's name with

VBoxManage list vms

If necessary, quote path and name.

Finally, check if all is well and remove the original.

That's all, really. No need to bother with xml files or a hex editor. No need to use a GUI, either.


| improve this answer | |
  • This was the only answer that worked for me. Should be higher up. – Max N May 16 '17 at 15:16
  • 2
    VM_to_clone is the UUID or name of the VM. With the given command (using a UUID), a directory was created at /new/path/_<UUID>_ Clone, and the containing files also used _<UUID>_ Clone as name. To explicitly have a nicer name, use the --name "Your preferred name here" flag. – Rob W Aug 27 '17 at 9:19
  • ... and to remove the original VM through the CLI, VBoxManage unregistervm UUID (UUID of VM that you obtained through VBoxManage list vms, do not use the VM name because if you use --name to preserve the original name, then you have multiple VMs with the same name) – Rob W Aug 27 '17 at 9:27
  • Warning: Clone doesn't produce a perfect copy and may trigger a need to update licenses for installed software as machine/disk ids change. Encountered this when moving an old copy of Quicken on a VM to a new disk. – MZB Jan 26 '19 at 15:36
  • There appears to be a dedicated command now, anyway: virtualbox.org/manual/ch08.html#vboxmanage-movevm – Michael P Mar 22 '19 at 7:01

To do the same as in Lucas Pottersky answer but through command line (on Windows replace vboxmanage with VBoxManage.exe):

  1. List all virtual machines:

    vboxmanage list vms

    or only running:

    vboxmanage list runningvms

    which for each machine outputs name and UUID.

    Do the following steps for each machine you will move.

  2. Gracefully shutdown it:

    vboxmanage controlvm UUID acpipowerbutton
  3. Unregister:

    vboxmanage unregistervm UUID
  4. Move virtual machine folder to the new location.

  5. Register it back by providing path to .vbox file:

    vboxmanage registervm /path/to/machine.vbox
| improve this answer | |
  • Assuming the files have already been moved, one can unregister all machines in one go with for v in `VBoxManage list vms | cut -c 19-54`; do VBoxManage unregistervm $v; done. Re-registering is not that straightfoward though, because the Media Manager is a bit of a mess. – Giacomo Lacava Oct 22 '19 at 17:37

This worked for me with the MacOS release of VirtualBox as well (release 4.1.12). I waited 5-10 seconds for VirtualBox to quit before re-launching. I looked in Activity Monitor to make sure VBoxSVC had quit properly.

If you don't do this, you will get an error that looks something like the following (I'm copying and pasting someone else's error message which comes from Windows). If you get this error, it's simply because you didn't quit VirtualBox or wait long enough for VBoxSVC to quit.

Failed to open virtual machine located in E:/<path>/<machine_name>/<machine_name>.vbox.

Cannot register the hard disk 'E:\<path>\<machine_name>\Snapshots/{0ece4bff-9185-4cff-9069-b3d1f4536394}.vdi' {0ece4bff-9185-4cff-9069-b3d1f4536394} 
because a hard disk 'C:\<path>\<machine_name>\Snapshots/{0ece4bff-9185-4cff-9069-b3d1f4536394}.vdi' with UUID {0ece4bff-9185-4cff-9069-b3d1f4536394} already exists.

Result Code: E_INVALIDARG (0x80070057)
Component: VirtualBox
Interface: IVirtualBox {c28be65f-1a8f-43b4-81f1-eb60cb516e66}
| improve this answer | |

In OS X with VirtualBox v4.3.14, all I had to do was double-click the .vbox file from the new location, and it opened VirtualBox and added it to the list of available VMs.

| improve this answer | |
  • Please don't add "thank you" as an answer. Instead, vote up the answers that you find helpful. – Scott Aug 8 '14 at 21:35
  • My answer isn't a 'thank you'. I edited the wording to make that more obvious. Thanks. – Tyson Phalp Aug 8 '14 at 22:45

There is a default storage location in the settings under VirtualBox: http://mattvelic.com/default-vm-location/

Now dead. Wayback machine has the content:


...check out the Preferences in the File menu. Behold! The first item in the General tab is Default Machine Folder. http://web.archive.org/web/20131116130725im_/ I edited the location to point to my storage drive, and quickly remade my VM. This time VirtualBox created both the machine files and the VDI in the correct location. The real lesson here is that sometimes the solution need not be technical. I think that as IT professionals, we tend to think that answer to a problem will be complicated. Keep your eyes open for the obvious solutions!

| improve this answer | |
  • This link is now dead. Try not to post links as answers. When they go dead, SU is left with cruft to clean up. – mrtsherman Mar 23 '15 at 21:24
  • updated with content from archive.org – Rebecca Mar 24 '15 at 16:26

In Oracle VM VirtualBox (tested with version 6.0.4), simply shut down your VM --> right click the VM in the VirtualBox Manager --> click "Move ..."--> choose the new directory. That's it!

| improve this answer | |
  • @Moreaki:  By the way, “legibility” (and “legible”) are spelled without a “D”. – Scott Feb 4 '19 at 4:36
  • This answer needs to bubble up to the top. This is 100% the correct and easiest way to do this now. – Shadoninja Jun 4 at 22:32

I do not think this is possible.

You can move the VDI to the new location, but I don't think you can avoid XML modification. As an alternative (but that is in fact the same as XML edition) would creating a new virtual machine with the GUI and choosing the moved image as disk would suit your needs?

| improve this answer | |
  • 1
    I had a second look at the xml and it's actually very simple. Creating a new machine is not good since I'd like to preserve my settings (I don't remember what I've change, it may be completely unimportant or not). – maaartinus Mar 11 '11 at 11:29

I tried the original method (remove the VDI, attach the new copy), got the message that the old one still exists, and couldn't attach the new copy even when I restarted the OS (on Mac OS X El Capitan).

The fix was in menu / File / Virtual Media Manager, remove the existing VDI. This works even if there are snapshots; just remove all the snapshot VDIs in reverse order. No need to close and reopen VirtualBox.

| improve this answer | |

I never used virtualbox on windows but on ubuntu you move the VDI and in virtualbox GUI you right click on the VM and use Configuration Menu -> storage where you can change the VDI localization to where you moved the file. Regarding the other machine files definition, you move them and in GUI you go to Preferences and change the position of default machines directory to the diretory you moved.

| improve this answer | |

I use this method:

  1. From VirtualBox GUI, pick your VM and remove the attached HDD
  2. Copy the file (ie. vdi) to the new location
  3. Generate a new UUID for the .vdi in the new location with the command vboxmanage internalcommands sethduuid "my path to myhdd.vdi" 6912BF7F-13BB-4E70-A2CA-C92300FEC3DC

    (In the previous example use your own UUID, or dont add it at all: the command will autogenerate one. Also if you omit this step, when adding the .vdi from the new location you'll get an error that the UUID already exists).

  4. Now back to the VirtualBox GUI, pick your VM and in Setttings / Storage attach the HD (.vdi file) from its new location.

and done.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.