-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add some way to increase disk space from Vagrantfile #2339
Comments
You can do this already. config.vm.customize "virtualbox" do |vb|
vb.customize "pre-boot", ["..."]
end It just isn't documented yet. But will be soon. Sorry! |
what would I put in the pre-boot list - does it take the same commands as the VBoxManage tool? |
Yes, it is VBoxManage. |
This gives me: "Bringing machine 'default' up with 'virtualbox' provider... VirtualBox Provider:
|
The example should be: config.vm.provider "virtualbox" do |vb|
vb.customize "pre-boot", ["..."]
end |
What are you supposed to put in there? I tried
Giving
|
hey @haf did you find a way out? :) |
Hi @odino, no shortly afterwards VMWare blue-screened my Mac and corrupted the VM anyway so I had to redo all the work. This time I chose a larger size initially. |
That |
You can use
I was hoping that the
Howver, |
for virtualbox, if the disk is not VDI, then is not easy to expand the disk. you should turn the guest off, clone the disk from vmdk to vdi, dettach What OS you are using ?? I think will be way easier create a new VM with Alvaro. On Wed, Jan 22, 2014 at 11:50 AM, snowch [email protected] wrote:
|
@kikitux it's not easy, but it should be possible to automate shouldn't it? The guest OS is CentOS 6.4. The host OS could be any OS supported by Vagrant. The driver behind this requirement to increase the disk size of an existing box is that many security teams will only the use a 'trusted' third party boxes. It is better for me to expand a trusted image than create and make available my own non trusted image. I've just taken a look at packer - thanks for the tip! I'll take a look and see if that solves the problem. |
When you say my box, then i understand you are creating in some way the box. I will say the easiest will be when you create the box, create a BIG disk, I do custom boxes for my test and I use 4 disks of 32GB, so should use If this approach work for you, then I will suggest import the box to If, the boxes are not yours, and are 3rd party (created, managed by I don't think this is an Vagrant issue, so I think the best is to talk in I am more than happy to assist if you need any help with the (vagrantup.com -> about -> support -> check around for the mailing list) Alvaro. On Wed, Jan 22, 2014 at 7:34 PM, snowch [email protected] wrote:
|
@kikitux I'm not creating a box. I don't want to do this because my security team don't trust boxes that are available in places like dropbox. I'm using a box from a trusted place (the specific box is http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210.box). Someone raised an issue against them 4 months ago to increase the box size: puppetlabs/puppet-vagrant-boxes#33 The pull request seems to still be open :( Thanks for your feedback and kind offer of assistance. |
Hello, I will give you my best answer based on my expertise on linux I have. The box came out of the box like this: [root@localhost ~]# df -Ph Plenty of space for the OS. So, my suggestion for your problem will be:
as the box upstream is not suitable, and the vendor is performing slow on If there is any linux admin there or any linux standard, then the 2nd disk Hope this helps. Alvaro. On Wed, Jan 22, 2014 at 8:15 PM, snowch [email protected] wrote:
|
@kikitux your recommendation is pretty much what I am doing at the moment until automated disk resizing is figured out: In may vagrantfile:
and then:
|
couple of suggestion. If you change the script to: pvcreate /dev/sdb as the new disk is VDI, you avoid creating partitions on it, and then you could expand the VDI, rescan the base disk, pvscan, pvresize, and other tip, if you do this: lvextend -l +$(pvdisplay /dev/sdb -c | cut -d: -f11) /dev/VolGroup/lv_root you will extend for the exact number of FREE extents that are note is +number to add the number.. Other than that, i think your scripts are fantastic good. Alvaro. On Thu, Jan 23, 2014 at 9:36 AM, snowch [email protected] wrote:
|
Very nice. Thank you! |
no news about increasing the size on pre-boot yet ? or some what to get the full path to the vdi from the :id (UUID) ? |
that won't work, as when the machine is created from the base box, the disk are not VDI, hence can't be extended. |
Does anyone have the remotest idea about how to put this into a .kitchen.yml format? |
My solution was to resize the base box itself, like follows: vagrant box add ubuntu/trusty64 --box-version 20150609.0.9
cd ~/.vagrant.d/boxes/ubuntu-VAGRANTSLASH-trusty64/20150609.0.9/virtualbox/
VBoxManage clonehd box-disk1.vmdk tmp-disk.vdi --format vdi
VBoxManage modifyhd tmp-disk.vdi --resize 61440
VBoxManage clonehd tmp-disk.vdi resized-disk.vmdk --format vmdk
rm tmp-disk.vdi box-disk1.vmdk
mv resized-disk.vmdk box-disk1.vmdk # df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 60G 1.8G 55G 4% / With 60GB instead of the base 40GB. |
I followed this blog post, and it works well. |
@mitchellh Do you know what's supposed to go into those ellipses? |
@BenMorganIO did you determine what goes in those ellipses to set disk size? |
Nope... |
@mitchellh Can you provide an example of the commands required to create a VM with 500GB disk in the Vagrant file? I have been looking around to set this up, but I currently am just stuck using Gparted to resize post creation.
|
The command should be something like this
But, this would not work because:
So, as of now, I think the only way to increase disk space is @renan's way |
so this what we need?
|
Hi, Br, |
@jhgorse thanks for the script. Just a question I got the below error around the below two lines
|
@renan's solution seems to be working for me - However, I also needed to edit the box.ovf file, where it says |
@snowiow Thankyou ❤️ |
I've just made a Python script that does the VMDK resize and deal with UUID all the way..
|
Hi, I saw this contribution which help me a lot 👍 https://github.com/sprotheroe/vagrant-disksize |
With the vagrant-disksize plugin I get a resized disk but the partition underneath is still the original so has to be resized within the guest. This makes it hard to automate. |
If you'd like an automated solution, I did this:
And install vagrant-disksize:
YMMV. sda1 was the right one for me, but you may need to ssh and double check. |
@Doume3 said:
I confirm that using the |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
At the moment you can increase memory in the vagrantfile, but if you want to increase disk space you have to use the VBoxManage tool to enlarge the image. It would be great to be able to specify this in the vagrantfile.
The text was updated successfully, but these errors were encountered: