Last week, for one of my side projects, I had to use vagrant in order to be able to run some tests on a Chocolatey packages I am currently trying to update.
But having a computer almost full, any call to
vagrant up ended up failing because of my lack of memory space on my main hard drive. 😝
VirtualBox and Vagrant
A small digression for those who don’t know what VirtualBox or Vagrant are. 😉
VirtualBox is a software made by Oracle, that allows us to virtualize system and to run virtualize system on a machine. This means that you can potentially have run any version of Windows, Linux or Mac on your own machine with this software.
On a windows system, you can install both of them using Chocolatey with powershell like that:
choco install virtualBox choco install vagrant
Back to our problem
Having virtual machines is nice, but can requires a lot of space.
So we need a way to have VirtualBox and Vagrant them in a different folder than their default one, on your main hard drive. Doing this is easy, since VirtualBox and Vagrant actually gives you the possibilities to change those elements (some people must have had the same problem before 😆 )
To do so, open your powershell terminal in Admin mode and run the following command with your custom folder
VBoxManage setproperty machinefolder <your/custom/VirtualBox/folder/> setx VAGRANT_HOME <your/custom/Vagrant/folder>
Personally, here how I used them
VBoxManage setproperty machinefolder "D:/VirtualBoxVMs" setx VAGRANT_HOME "D:/.vagrant_d
And now, all I have to do is run
vagrant up to have my virtual machine running and stored in my other hard drive. 🙂
I hope this article will give you the information you were looking for. Personally, I needed to write this post so that future me will be able to go back to it whenever he will need to do so 😆
Thank you all for reading this article ! And until my next article, have an splendid day 😉