Can i change the location of .VirtualBox folder?

Discussions related to using VirtualBox on Windows hosts.
Post Reply
emil78
Posts: 112
Joined: 15. Jun 2012, 11:28

Can i change the location of .VirtualBox folder?

Post by emil78 »

Is it possible to change the location of .VirtualBox folder that is in the users directory? I tried the option from the Preferences>General>Default Machine Folder but this changes only the location of the virtual machines hard disks.
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: Can i change the location of .VirtualBox folder?

Post by mpack »

emil78 wrote:I tried the option from the Preferences>General>Default Machine Folder but this changes only the location of the virtual machines hard disks.
It doesn't even do that. It determines where any future VMs will be created - it has no bearing on the location of existing VMs, nor is it only for hard disk images.

Yes, you can control the location of the ".VirtualBox" folder by setting the VBOX_USER_HOME environment variable... but I struggle to see why anyone would need to. That folder contains almost nothing - a small xml and a couple of log files, so your reason surely can't be because of disk space. Perhaps you should tell us your problem instead of your solution?
emil78
Posts: 112
Joined: 15. Jun 2012, 11:28

Re: Can i change the location of .VirtualBox folder?

Post by emil78 »

Can you tell me how to change the .VirtualBox location from command prompt using the VBOX_USER_HOME variable?

I want the folder to be outside C: drive, because when i reinstall Windows it will delete it.
loukingjr
Volunteer
Posts: 8851
Joined: 30. Apr 2009, 09:45
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: just about all that run

Re: Can i change the location of .VirtualBox folder?

Post by loukingjr »

You could just copy the folder somewhere safe and put it back afterwards.
OSX, Linux and Windows Hosts & Guests
There are three groups of people. Those that can count and those that can't.
emil78
Posts: 112
Joined: 15. Jun 2012, 11:28

Re: Can i change the location of .VirtualBox folder?

Post by emil78 »

Yes, but if i forget to do that it will be deleted. I prefer to be outside C drive since this can be done, but i don't know how to do that from the command prompt.
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: Can i change the location of .VirtualBox folder?

Post by mpack »

If you forget to preserve the contents of the .VirtualBox folder then it's no biggie: like I said, it contains almost nothing. All you would lose is the list of registered VMs, so all you would have to do is reregister them, which you might well have to do anyway (e.g. if reinstalling Windows caused drive letters to change).

Telling you how to configure an environment variable on your host is really beyond the scope of these forums. But, I'm sure that Googling for VBOX_USER_HOME will help.
emil78
Posts: 112
Joined: 15. Jun 2012, 11:28

Re: Can i change the location of .VirtualBox folder?

Post by emil78 »

I tried this from the command prompt but it didn't work:

Code: Select all

set VBOX_USER_HOME=E:\VM\.VirtualBox
Also, where can i see all available variables for Virtualbox?
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: Can i change the location of .VirtualBox folder?

Post by mpack »

Did you check Google as I suggested? Setting an environment variable inside a command console only applies for that command console, and only until it closes. This isn't DOS, where one OS environment applies to all apps.

On my PC I would set global environment variables in My Computer | Advanced | Environment variables.
emil78
Posts: 112
Joined: 15. Jun 2012, 11:28

Re: Can i change the location of .VirtualBox folder?

Post by emil78 »

I created the variable in the standard way and backup the corresponding registry settings, so when i have to restore the settings i will run the .reg file.
Post Reply