Skip to content
This repository has been archived by the owner on Aug 29, 2018. It is now read-only.

libvirt provider requires 50 GB of disk space #548

Open
tiran opened this issue Jun 20, 2017 · 3 comments
Open

libvirt provider requires 50 GB of disk space #548

tiran opened this issue Jun 20, 2017 · 3 comments
Labels

Comments

@tiran
Copy link

tiran commented Jun 20, 2017

The libvirt box for vagrant-openshift require a lot of disk space:

  • almost 6 GiB for the initial download of the compressed box file
  • 22 GiB for uncompressed qcow2 image in ~/.vagrant.d/boxes
  • 22 GiB for copy of uncompressed qcow2 image in /var/lib/libvirt/images

Why is the libvirt image so large? Is there any way to make the image smaller? My laptop has a 250 GB SSD with 40 GB disk space for the root partition.

I prefer to use libvirt because I'm usually running multiple VMs at the same time. The other VMs are all managed by libvirt. Due to hardware and software restrictions it is not possible to run Virtualbox and libvirt at the same time. tl;dr only one Kernel driver can utilize a CPU's hardware virtualization feature.

@tiran tiran added the question label Jun 20, 2017
@stevekuznetsov
Copy link
Contributor

I'm struggling to find the work, but I remember looking into some workflow with qemu-img and/or virt-sysprep to reduce the size of the images. I'm amazed that the image you're seeing is 22GB -- IIRC the ones I was building were ~3GB. Could you post the link to the image and disk usage information for it on your system?

@tiran
Copy link
Author

tiran commented Jun 20, 2017

$ vagrant plugin install vagrant-openshift
...
$ vagrant origin-local-checkout -u tiran
...
$ cd $GOPATH/src/github.com/openshift/origin
$ vagrant origin-init --stage inst --os fedora
$ vagrant up --provider=libvirt
Bringing machine 'openshiftdev' up with 'libvirt' provider...
==> openshiftdev: Box 'fedora_inst' could not be found. Attempting to find and install...
    openshiftdev: Box Provider: libvirt
    openshiftdev: Box Version: >= 0
==> openshiftdev: Box file was not detected as metadata. Adding it directly...
==> openshiftdev: Adding box 'fedora_inst' (v0) for provider: libvirt
    openshiftdev: Downloading: https://mirror.openshift.com/pub/vagrant/boxes/openshift3/fedora_libvirt_inst.box
    openshiftdev: Progress: 3% (Rate: 6086k/s, Estimated time remaining: 0:15:10)

The vagrant up command downloads a large compressed file (5.4 G) and extracts a 21.7 GB qcow2 image from it:

$ ls -lah ~/.vagrant.d/tmp/box022b83e2b8674afa1d877a7cdf9d2d109e3ff882 
-rw-rw-r--. 1 heimes heimes 5,4G Jun 20 16:49 /home/heimes/.vagrant.d/tmp/box022b83e2b8674afa1d877a7cdf9d2d109e3ff882
$ tar -tzvf /home/heimes/.vagrant.d/tmp/box022b83e2b8674afa1d877a7cdf9d2d109e3ff882
tar: Ignoring unknown extended header keyword 'LIBARCHIVE.xattr.security.selinux'
-rw-rw-r-- dmcphers/dmcphers 57 2016-11-11 00:37 ./metadata.json
tar: Ignoring unknown extended header keyword 'LIBARCHIVE.xattr.security.selinux'
-rw-rw-r-- dmcphers/dmcphers 136 2016-11-11 00:37 ./Vagrantfile
tar: Ignoring unknown extended header keyword 'LIBARCHIVE.xattr.security.selinux'
-rw-r--r-- dmcphers/dmcphers 21666988032 2016-11-11 00:40 ./box.img

Do you need more information?

@raghavendra-talur
Copy link

one possible fix(for the maintainer) to create images again:

  1. use qemu img to rewrite the disk file. This removes the sparseness of file from file system view but retails the virtual size in the view of qemu.
    qemu-img convert -O qcow2 box.img box2.img
  2. mv box.img box_old.img
  3. mv box2.img box.img

This worked for me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants