How to change "%userprofile%\.VirtualBox" default path

Discussions related to using VirtualBox on Windows hosts.
Post Reply
Nomad_RJ
Posts: 12
Joined: 3. Nov 2008, 19:40

How to change "%userprofile%\.VirtualBox" default path

Post by Nomad_RJ »

Hi folks.

I would like to save all my VirtualBox related files somewhere else instead of using my userprofile folder.

I have tried to move the ".VirtualBox" folder to another disk and change the settings under File/Preferences/General, but it won't work. VB keeps creating a new folder and VirtualBox.xml configuration file. Even editing the XML to point the machines to the new location haven't helped.

The perfect scenario for me would be pointing a new default directory, is it possible via registry or any local config file?

Thanks in advance!

Nomad_RJ
vbox4me2
Volunteer
Posts: 5218
Joined: 21. Nov 2008, 20:27
Location: Rotterdam
Contact:

Re: How to change "%userprofile%\.VirtualBox" default path

Post by vbox4me2 »

As far as I've played around with this, you can move everything except the master .xml file, in the GUI you can redirect the machines location or manually edit the master xml.
Nomad_RJ
Posts: 12
Joined: 3. Nov 2008, 19:40

Re: How to change "%userprofile%\.VirtualBox" default path

Post by Nomad_RJ »

Sorry for being lazy guys... it´s on the help file:

9.1. VirtualBox configuration data

(...)
VirtualBox creates this configuration directory automatically, if necessary. Optionally, you can supply an alternate configuration directory by setting the VBOX_USER_HOME environment variable.

Works like a charm! :D

Thanks!
Nomad_RJ
JeremyInMT
Posts: 12
Joined: 28. Feb 2009, 03:39

Re: How to change "%userprofile%\.VirtualBox" default path

Post by JeremyInMT »

Seems like you should be able to set it in the UI as well. Would be handy anyway.
TerryE
Volunteer
Posts: 3572
Joined: 28. May 2008, 08:40
Primary OS: Ubuntu other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS
Contact:

Re: How to change "%userprofile%\.VirtualBox" default path

Post by TerryE »

This is a Windows issue. Try My Computer->Properties->Advanced->Environment Variables and add VBOX_USER_HOME to the user environment variables.
Read the Forum Posting Guide
Google your Q site:VirtualBox.org or search for the answer before posting.
boyan.sharic
Posts: 7
Joined: 17. Dec 2008, 16:07

Re: How to change "%userprofile%\.VirtualBox" default path

Post by boyan.sharic »

TerryE wrote:This is a Windows issue. Try My Computer->Properties->Advanced->Environment Variables and add VBOX_USER_HOME to the user environment variables.
this works...thanx
BarnAgain
Posts: 1
Joined: 25. Nov 2009, 18:33
Primary OS: MS Windows XP
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: linux,xp,w2k3srv,w2k8srv

Re: How to change "%userprofile%\.VirtualBox" default path

Post by BarnAgain »

On an XP host, the environment var did not work at first. Then I added a final slash to the line, like this;

VBOX_USER_HOME=w:\vm\.virtualbox\
w:\ is my usb drive

Then it would read the xml file from the new home directory. Then I made a copy of the VirtualBox.xml (always do that JIC) and edited the old path settings to the snapshots. While the path to HardDisks was relative, every snapshot had the full old path on my c: drive. Just deleted
"C:\Documents and Settings\username\.VirtualBox\"
and it worked without error! (!Note the final backslash \)

I also have this set; VBOX_INSTALL_PATH=C:\Program Files\Sun\VirtualBox\
Horst_Horstmann
Posts: 2
Joined: 29. Apr 2010, 12:31
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: WinXP, Linux

Re: How to change "%userprofile%\.VirtualBox" default path

Post by Horst_Horstmann »

Sorry for digging this up again, but IMO it shouldn't be required to mess around with environment variables to restore expected behavior. Configuration data on Windows machines belongs in %APPDATA%, not %USERPROFILE%.
See also http://forums.virtualbox.org/viewtopic.php?f=6&t=24975

A fix for this would be much appreciated.
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: How to change "%userprofile%\.VirtualBox" default path

Post by mpack »

Horst_Horstmann wrote:A fix for this would be much appreciated.
Appreciated by some. Others of us would prefer that the path was shorter, certainly not longer.
Horst_Horstmann
Posts: 2
Joined: 29. Apr 2010, 12:31
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: WinXP, Linux

Re: How to change "%userprofile%\.VirtualBox" default path

Post by Horst_Horstmann »

Well you could still use the VBOX_USER_HOME variable then - I'm just saying the default path should be changed.
I know applications usually store user-specific configuration data in ~/.ApplicationName on Linux, so I can see why the current default path is as it is, but as I said: the proper location would be %APPDATA%\ApplicationName.
I'm sure most *nix users wouldn't want VirtualBox to dump its settings in /bin or some other random folder, which is basically what it's doing on Windows now.
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: How to change "%userprofile%\.VirtualBox" default path

Post by mpack »

I'm not sure I remember the international treaty which imposed these verbose paths as being the only "correct" ones, but leave that aside for the moment. What is the actual downside of defying this convention?

Your analogy re Linux was misplaced btw. The Windows equivalent of Linux's \bin would be something like "C:\Windows": and if VBox stored data files there I'd certainly be among the first to object, but that isn't the case.
mixmastamyk
Posts: 5
Joined: 18. Oct 2010, 22:13
Primary OS: Other
VBox Version: OSE other
Guest OSses: Yes

Re: How to change "%userprofile%\.VirtualBox" default path

Post by mixmastamyk »

Horst is correct, app data by convention goes under %APPDATA% in Windows.

Verbosity is not really the issue, though I will grant you "Documents and Settings" is ridiculous. There are ways to mitigate the path length issue though. The subst command, explorer favorites/shortcuts, nlite to do a custom install, upgrading to Win7, etc.

I wish the otherwise excellent VB had an easy way to move everything to another folder and keep VM files separate. I've beat it into submission with environment vars and modified xml, but it shouldn't be this difficult. I've shared VMWare vms across different platforms for years without thinking twice.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: How to change "%userprofile%\.VirtualBox" default path

Post by Perryg »

Strange! I have never had my VirtualBox program or the storage files on the C:\ drive of my Windows machines. The only file on my C:\drive is the VirtualBox.xml and that is in my user space because it must to work properly.

You are prompted when installing where you want VirtualBox to install, myself I chose a separate drive. All files are then set there in a folder of my choosing and I can also specify the install paths for the hard disk and machine folders as soon as the program is installed by going to the preferences, which I did and placed them on a different drive which is external eSata. Shoot even the snapshot folder is changeable in the guest settings.

I know it is easy to miss when simply clicking next - next but reading during the actual install showed me how to do it.

Been doing this for some time, guess that is why I never had a problem when the locations changed due to branding.
Post Reply