How can I create a vagrant virtualbox VM with a storage size of more than 8GB?

2

1

I've been trying all day to create a vagrant centos box with more than 8GB. It would be nice to know how to make my existing virtual disk bigger, but I would definitely settle for creating a completely blank fresh machine with a configurable size.

I've tried various things, but these instructions seemed most promising: https://gist.github.com/christopher-hopper/9755310

After doing step 15, I realized I don't have any volume groups. Others commented that they didn't have volume groups and could stop after step 9. A df shows that I still only have an 8GB disk even tho it shows a 39GB vdi in virtualbox manager.

My host machine is windows 8.1.

B T

Posted 2014-10-05T07:39:07.097

Reputation: 603

I think I likely need to extend the partition, but I can't unmount it since its the main partition.. – B T – 2014-10-05T08:03:36.877

Answers

1

I've been faced with this situation myself. The problem isn't resizing the virtual disk (*) but rather resizing the root partition & the file system on the virtual disk. Resizing a mounted file system or growing a live partition at runtime is not possible.

I solved the problem by booting the vm from a Ubuntu LiveCD (in try me mode). I managed this by attaching the ubuntu.iso as a CDROM to the vm & pressing F12 while the vm was booting. With that I had access to a boot menu & could boot from the LiveCD.

Using gparted (**)I could resize the root partition. I don't remember how I resized the file system, probably using resize2fs. After that I detached the LiveCD & booted from the virtual disk.

(*) Find the UUID using VBoxManage list -l hdds & resize the disk using VBoxManage modifyhd UUID --resize bytes ( UUID looks something like this bcc0f77e-536a-4b95-825f-79efada3442c)

(**) gparted should be installed, if not install it with sudo apt-get install gparted

Hope this was helpful.

Eamonn Travers

Posted 2014-10-05T07:39:07.097

Reputation: 496

When I try to boot from a CD iso, vagrant up gives me connection timeouts. I added the CD under the SATA controller alongside the virtual hard drive, I tried checking Live and also leaving it unchecked. My system boot order has CD first. Any idea what could be going wrong? – B T – 2014-10-05T18:39:56.030

Hi. I wrote my answer from memory so I wanted to make sure that I had everything right. I attached the iso as a CDROM or more correctly as the only CDROM & booted from it. I 've tried it out again & it works just fine. Mind you I'm not using vagrant, just VirtualBox. Have you tried a different iso. Maybe not a liveCD but rather a simple rescue CD like OpenSuSE? – Eamonn Travers – 2014-10-06T10:07:16.433

Ah, yeah, I definitely need to boot from VirtualBox and not vagrant, you're right. I'll have to try this again later, since I've already worked around my issue another way (the answer I posted) – B T – 2014-10-06T19:58:31.943

0

This is also not ideal, but I successfully created a vagrant base box from scratch using these instructions:

It won't help you increase the size of your current disk, but it will help you create boxes with larger initial sizes.

B T

Posted 2014-10-05T07:39:07.097

Reputation: 603