Change VM directory for external hard drive

Discussions related to using VirtualBox on Windows hosts.
Locked
slcman
Posts: 12
Joined: 15. Jan 2010, 15:51
Primary OS: MS Windows Vista
VBox Version: OSE self-compiled
Guest OSses: windows 98

Change VM directory for external hard drive

Post by slcman »

Hi all,
my host hard drive is full! VirtualBox hard drive and machine took too much space in my hard disk and I would like to use a external hard to store machine and hard disk. I tried to change directory in VirtualBox.xml file but not working or I miss something. Any idea??
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Change VM directory for external hard drive

Post by Perryg »

You change the location where these are stored using the main VBox gui and selecting file -> preference and changing the location there.
slcman
Posts: 12
Joined: 15. Jan 2010, 15:51
Primary OS: MS Windows Vista
VBox Version: OSE self-compiled
Guest OSses: windows 98

Re: Change VM directory for external hard drive

Post by slcman »

Perryg -> I tried and it's not working. This is for set the folder of NEW machine. I want to move machine from c:\.....\.VirtualBox to G:\
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Change VM directory for external hard drive

Post by Perryg »

Then you will need to change the path of each in the VirtualBox.xml
Just be very careful and be sure to have a backup And the path must be the complete and full path.
If you can't figure out the path then create a new one selecting the new location on install, and then look at the VirtualBox.xml file and you should see how it is written.
slcman
Posts: 12
Joined: 15. Jan 2010, 15:51
Primary OS: MS Windows Vista
VBox Version: OSE self-compiled
Guest OSses: windows 98

Re: Change VM directory for external hard drive

Post by slcman »

Like I say in my original post, I already tried to change xml file and it's not working.

So I'm still looking for solution. Anyone tried to change directory?
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: Change VM directory for external hard drive

Post by Perryg »

Anyone tried to change directory?
Yes I have and it does work. Tell you what. Post the virtualBox.xml file and write down the exact and full path to the location you are trying to use to store the Machine and VDI folders and I will see what is going on.

Hint: I made a folder called .VirtualBox on my D:\ drive and put the Machine and VDI folders in that folder. Then it was simply to change the path in the VirtualBox.xml file.
tb2571989
Posts: 145
Joined: 10. Sep 2009, 14:28
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Windows Server 2003, Windows Server 2008 R2, Ubuntu 9.10, Ubuntu 10.10

Re: Change VM directory for external hard drive

Post by tb2571989 »

On my my E:\ drive I used in my example I made a VirtualBox folder, then two subfolders, one for Machine Settings, and one for VHD's...admittedly I did this before installing any VMs.

You will need to go trhough virtualbox.xml and check that each reference has been changed to the new location.
Last edited by tb2571989 on 26. May 2010, 15:44, edited 1 time in total.
slcman
Posts: 12
Joined: 15. Jan 2010, 15:51
Primary OS: MS Windows Vista
VBox Version: OSE self-compiled
Guest OSses: windows 98

Re: Change VM directory for external hard drive

Post by slcman »

I got it! Now it's working.

I change all c:\document.......\ for my new hard drive g:\VM\ by using search tool in notepad. Still not working, only C:\.... for new directory doesn't complete change directry process. Then I look in machine registry:

<MachineRegistry>
<MachineEntry uuid="{845f18dd-94bf-4b7d-92ed-2e864774897a}" src="Machines\DOS\DOS.xml"/>

and I had my directory

<MachineRegistry>
<MachineEntry uuid="{845f18dd-94bf-4b7d-92ed-2e864774897a}" src="G:\VM\Machines\DOS\DOS.xml"/>

now is working.

Thanks all for your help
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: Change VM directory for external hard drive

Post by Sasquatch »

That's what Perry was saying. Also make sure that the paths in your <VM>.xml files are changed too, else snapshots and saved states will still go to your C: drive.
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.
Trần Tuấn Sơn
Posts: 1
Joined: 6. Jan 2014, 04:21

Re: Change VM directory for external hard drive

Post by Trần Tuấn Sơn »

You must be change to Your directory in both .XML and .vbox files in the VirtualBox VMs document folder. And sure turned off Virtualbox (Check in Task manager - if use Windows)
E.g.
From:
<HardDisks>
<HardDisk uuid="{bbca7b5a-bb59-42b6-9ae9-199b25e2b297}" location="F:/OSS/Windows/Windows-XP-Pro-SP3-tricks.vmdk" format="VMDK" type="Normal"/>
</HardDisks>
To:
<HardDisks>
<HardDisk uuid="{bbca7b5a-bb59-42b6-9ae9-199b25e2b297}" location="H:/OSS/Windows/Windows-XP-Pro-SP3-tricks.vmdk" format="VMDK" type="Normal"/>
</HardDisks>

I have tried and successed. Hope to help you!
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Change VM directory for external hard drive

Post by mpack »

The information in this thread is mostly obsolete. Locking it.

If you want move an existing VM to a new drive on the same or a different host then see Howto: Move a VM.

If you want new VMs to be created in a different drive then in the GUI see File | Preferences | General | Default Machine Folder.
Locked