Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
3  
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

9 Answers 9

up vote 52 down vote accepted

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.

    [NOTE: See "LAST IMPORTANT THING" below]

    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".

LAST IMPORTANT THING:

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.

share|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
    
For Mac OS X users, VirtualBox.xml is located at ~/Library/VirtualBox/VirtualBox.xml. The VMs are located in ~/VirtualBox VMs. –  Asuka Kenji - Siu Ching Pong - Sep 25 at 3:45

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.

share|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

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.

share|improve this answer

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

share|improve this answer

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?

share|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

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}
share|improve this answer

On Mac, edit the paths in this file:

/Users/pleddy/Library//VirtualBox/VirtualBox.xml

That was easy, presto!

share|improve this answer
1  
He is using Windows, and he also doesn't want to edit VirtualBox.xml. –  ChrisN Feb 5 '13 at 23:29
1  
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 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.

share|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.

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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