Using fixed size disks with the Virtualbox provider due to terrible disk performance with dynamic vmdk

695 views
Skip to first unread message

cheater00

unread,
Mar 26, 2015, 4:33:12 AM3/26/15
to vagra...@googlegroups.com
Hi,
in my use the dynamically-allocated vmdk that Vagrant boxes use in conjunction with the Virtualbox provider make disk IO very sluggish. This is a typical workload for what I'm doing. I have manually converted a VM to use a fixed size VDI and the disk IO was much better. With the normal setup streaming disk IO would periodically freeze up the host operating system (which is a developer workstation so it's important it can be used while say test suites are running on the guest); IO would drop down to even 200 KB/sec according to iotop; I have good grounds to believe the CPU useage is due to Virtualbox itself because top on the host showed vb maxing out the cpu, whereas in the guest top showed an idle system. Upon conversion to a fixed size disk, disk IO was normal and used no cpu at all. This is a great deficiency. Me and my team have tried this on various operating systems and computers.

Is there a way to tell Vagrant to provision with fixed sized VDIs (or VMDKs if that's possible)? I have not been able to find a good way to do this; what I currently do is I boot up the box first (it's the standard trusty64 box), then attach a fixed size VDI, and run some scripts once it's booted that format the VDI, cp -arx from the original fs root to the new one (on a running system - I know it's "bad" but it works ok), and then swap the disks around. It's still a bit buggy but I'm getting there. It's a pretty crappy way of doing things, though.

I cannot convert the vmdk to fixed size VDI because the VMDK in trusty64 is set to allow up to 40 gigabytes of size; I can only spare 8 gigabytes; the real size of the VMDK right after provisioning is 1.2 gigabytes.

After all this stuff is done I start with the real provisioning process installing various software etc using Ansible.

I hope someone can help me figure out a good way of doing this, because it's very cumbersome and fragile right now.

Thanks!

Alvaro Miranda Aguilera

unread,
Mar 26, 2015, 5:28:09 AM3/26/15
to vagra...@googlegroups.com
Hello,

What about if on your vagrantfile you create a disk/filesystem for
what you require to store?

say /var/docker
or /srv or /project

will that work?

if the answer is yes, then you can put some Vagrant Vbox manage to
create a fixed size disk at virtualbox level and then using shell
provisioners you can do the OS part

let me know and I can share some tips for that.

if, using a mount point won't work for you, then I think the easiest
will be create a custom box using packer.io

using VBoxManage you can convert the disk to fixed before first boot, quite cool

here I create 3 disk after the OS one.

something similar can be used to change the OS disk into fixed

https://github.com/kikitux/packer-vagrant-oracle/blob/master/packer/oracle65/packer-vagrant-oracle65-btrfs-4disk.json

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.
Reply all
Reply to author
Forward
0 new messages