[CentOS-devel] Disk size on Vagrant image

Sat Aug 19 06:03:40 UTC 2017
Laurentiu Pancescu <lpancescu at centosproject.org>

Hi Jeff,

sorry for the late reply, it's a pretty busy time at work for me.

On 17/08/17 22:33, Jeff Sheltren wrote:
> I have some development projects that require a large amount of disk on the
> VM, and are running into issues with the current centos/7 Vagrant box. Is
> it possible to increase the disk size of the Vagrant image to 100, or even
> 200 GB? Since this is a sparse image, I don't believe the change will have
> any affect on people using less disk space, it will only use up as much
> space on the host system as is in use on the VM.
> 
> Laurențiu, what do you think?

It would be technically possible and, as you pointed out, the disk 
footprint of the current images wouldn't change much.

Our centos/7 image is around two times larger than Fedora Cloud (409MB 
vs 208MB for the VirtualBox variant).  I would like to reduce our image 
size as soon as 7.4.1708 is released - it would make downloading the 
image and instantiating a new box significantly faster, as well as 
reducing our bandwidth usage (we have 4.5 million downloads so far).  We 
have to uninstall some packages that Anaconda insists on always 
installing, but we don't regain the space used by those packages unless 
we fill the freed sectors with zeros.  On XFS, we can only fill the 
entire disk with zeros using dd in %post (zerofree only works with Ext4 
filesystems, which is what Fedora uses) - writing 40GB of zeros on our 
CBS builder would already be pretty bad, I wouldn't want to switch to 
100-200GB disk images (the disk I/O is actually double that size, since 
the sparsify process would need to read the image file resulting from 
the installation).

Adding another disk to a Vagrant box is a somewhat fragile process, but 
resizing the existing disk image works pretty well and could be 
automated, I think. [1]  You could also use Packer to generate 
customized versions of our official images for you own use - please see 
the vbox-packer branch in [2].  The latter is fully automated and takes 
less than 30 minutes on my Mac Mini "late 2009" with only 4GB RAM and a 
slow mechanical hard drive.

Best regards,
Laurențiu


[1] https://www.laurentiupancescu.com/blog/591c105a/
[2] https://github.com/lpancescu/sig-cloud-instance-build