how to specify vm images to different folder?

386 views
Skip to first unread message

Yiyu Jia

unread,
Aug 13, 2014, 3:59:42 PM8/13/14
to vagra...@googlegroups.com

I had Vagrant and VirtualBox installed on my CentOS 6.5 PC server. I find that the vm image file is always put under folder ./root/VirtualBox VMs/ . 

Will anyone please share with me how to make Vagrant to put new launched vm image files under a specified folder? I have this question because I have multiple lvm on my machine and the default folder is under a lvm partition whose size is very small. I want to make vagrant to put new launched vm image under other lvm partition which has big size. 

any help will be appreciated! 

Yiyu Jia

unread,
Aug 13, 2014, 4:32:13 PM8/13/14
to vagra...@googlegroups.com

Also, I know we can got o VirtualBox Manager and click "File -> Preference -> General" to change the default machine folder.

But, do we have provider options that allow us to specify different VM to different folder inside one VagrantFile ?

Alvaro Miranda Aguilera

unread,
Aug 13, 2014, 6:16:48 PM8/13/14
to vagra...@googlegroups.com
Hello,

Vagrant will use the default location for each provider, so the fix will be per provider.

For Virtualbox, you can change that location on the gui/preferences and any new VM will be created there.

For Vmware, I have read that there is a parameter you can use to specify the directory where the disks are going, and I will assume you can also edit the the default vm location.

Hope this helps.

Alvaro.


--
You received this message because you are subscribed to the Google Groups "Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Yiyu Jia

unread,
Aug 13, 2014, 6:38:44 PM8/13/14
to vagra...@googlegroups.com
Hi Alvaro,

Thanks a lot for response! It will be nice if Vagrant can support the feature that allow us specify the image location. But, sounds it depends on provider's features as well.

it looks that VirtualBox support options "--basefolder" (https://www.virtualbox.org/manual/ch08.html#vboxmanage-createvm) . Is this options supported in Vagrant?

Yiyu



--
You received this message because you are subscribed to a topic in the Google Groups "Vagrant" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vagrant-up/lvD-vgAue5E/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vagrant-up+...@googlegroups.com.

Yiyu Jia

unread,
Aug 14, 2014, 4:16:08 PM8/14/14
to vagra...@googlegroups.com

No others think it is useful for Vagrant to support provider having parameter about folders, where vm images files are created and loaded?

I ask in case I am stuck in a use case, which is not meaningful. My use case is that I want to put vm images into different partition on the disk.

Alvaro Miranda Aguilera

unread,
Aug 14, 2014, 4:45:32 PM8/14/14
to vagra...@googlegroups.com
if moving the default folder is something that will work for you, then the best will be you do it at virtualbox for the moment, and every new machine will go there

if your requirement is to be able to select per virtual machine where to put the vm, this is done already in vmware from what i understand, and are a couple of tickets/issues open on github for this

i will test over the weekend the command you have shared,, i wasnt aware of that one and seems it may do the trick

i will report back after i test

thanks
alvaro

Yiyu Jia

unread,
Aug 15, 2014, 12:41:52 AM8/15/14
to vagra...@googlegroups.com
Hi Alvaro,

Thanks a lot for response and helps!

I checked just now. Vagrant does not use command "VBoxManage createvm" to create new VMs. Instead, it use Import command to import vm from ovf file (box). So, that "--basefolder" looks like not helpful.

Then, I searched the options for "vboxmanage import" command and that options should allow us specify where the images file can be put.  But, no lucky so far.

thanks,

Yiyu

Alvaro Miranda Aguilera

unread,
Aug 15, 2014, 12:55:45 AM8/15/14
to vagra...@googlegroups.com
you want all the vms in the same disk?

you can move the default vm directory.

or that doesn't work?

Yiyu Jia

unread,
Aug 15, 2014, 2:15:09 AM8/15/14
to vagra...@googlegroups.com

No. I want to put vms on different disk. For example, suppose I have two hard disc (disc1 and disc2) in my PC server and I configure two vm (vm1 and vm2) in one VagrantFile, I want to put vm1 on disc1 and vm2 on disc2. 

changing default VirtualBox will still put two vms under same directory. 

Alvaro Miranda Aguilera

unread,
Aug 15, 2014, 5:33:03 AM8/15/14
to vagra...@googlegroups.com
got it.

i am afraid is not possible at the moment.are a couple of issues open for this.

hopefully it may be implemented soon.


Yiyu Jia

unread,
Aug 15, 2014, 2:47:08 PM8/15/14
to vagra...@googlegroups.com
Thanks Alvaro!

I guess people is not eagerly need this feature probably because they are focus on using cases of 1) clouding platform 2) laptop dev env, which normally has only one hard disc?

But, I will appreciate it if vagrant (probably depends on feature of VirtualBox) can implement it. 

Yiyu

Reply all
Reply to author
Forward
0 new messages