Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I change where Vagrant looks for its virtual hard drive?

Tags:

vagrant

I have Vagrant set up on one of my computers. I would like to change the location of its virtual hard drive, which is currently in the default location. How can I do this without breaking Vagrant?

I have Vagrant set up with VirtualBox 4.2.

EDIT: I mean that I want to move the location of the VirtualBox machine folder, which is currently at C:\Users\Kevin\VirtualBox VMs\my_vm\box-disk1.vmdk.

like image 345
Kevin Avatar asked Jul 16 '13 21:07

Kevin


People also ask

How do I move a virtual machine from one drive to another?

You can now use the VirtualBox Manager to move a VM. Right-click on the VM in the VirtualBox Manager's machine list and select Move.

Where does vagrant store VMs?

On Windows: C:/Users/USERNAME/. vagrant. d/boxes.


2 Answers

Not sure if you want to change the ~/.vagrant.d or VirtualBox default machine folder.

If you want to move ~/.vagrant.d to somewhere else. You can set environment variable VAGRANT_HOME, see this https://stackoverflow.com/a/14804694/1801697

Update:

To change VirtualBox's Default Machine Folder, either do it in GUI => Prefs - General - Default Machine Folder or manually edit the ~/.VirtualBox/VirtualBox.xml

<SystemProperties defaultMachineFolder="/path/to/VirtualBox/VMs" defaultHardDiskFormat="VDI" VRDEAuthLibrary="VBoxAuth" webServiceAuthLibrary="VBoxAuth" LogHistoryCount="3"/>
like image 159
Terry Wang Avatar answered Sep 21 '22 09:09

Terry Wang


you can use the command :

VBoxManage setproperty machinefolder

here the doc for more information : https://www.virtualbox.org/manual/ch08.html#vboxmanage-setproperty

like image 43
Jaoued Zahraoui Avatar answered Sep 22 '22 09:09

Jaoued Zahraoui