Easiest way to get a small VM disk image?

Kamila Součková kamila at ksp.sk
Fri Mar 23 15:42:22 UTC 2018


I want to build an OpenNebula[1]-compatible VM image of FreeBSD 11.1. One
requirement for my use case is that the image should initially be small
(not as in "take up little physical space", but as in "the size of the
virtual disk as visible in the VM should be small". Specifically, I want
the virtual disk size to be no more than 3GB (which should not be a
problem, as the default installation of FreeBSD takes a lot less than 3G).

The VM images available in the official downloads have a virtual size of
20GB. Therefore I need to somehow build my own image (or shrink the
existing ones). Here are the approaches I have thought about:

- Create and partition an empty disk image, rsync the contents of the
official image into it. Problems: AFAIK requires a FreeBSD host to build
(in order to be able to create a UFS filesystem); requires juggling around
with loopback mounts and such. Probably still the most feasible option, but
I am not sure, which is why I'm asking.
- Create an empty image, boot it in a VM and install from an installation
ISO. Problem: not sure how to automate; might not get 1:1 parity with the
official VM image
- Somehow shrink the existing image. Problem: How?
- Find out how the official images are built and do that with a smaller
size. This is where this list comes in :-)

Which (of these, or any other) is the easiest way to get a small image?

Thanks a lot!


[1] https://opennebula.org/

More information about the freebsd-hackers mailing list