[Vmdebootstrap-devel] [PATCH 1/2] Don't fill image with zeros by default

Neil Williams codehelp at debian.org
Thu Oct 16 19:20:33 UTC 2014


On Fri, 10 Oct 2014 23:48:18 +0200
Jan Gerber <j at mailb.org> wrote:

> add --optimize-image flag to fill image with zeros. while filling with
> zeros improves the compression, it also requires the actual size of
> the disk image on the host that builds the vm. By default the disk
> image is sparse and only the space required for the installation is
> used. ---

Compression is more important, IMHO, than space on the build machine.
I'd rather that this change was to use zeroes by default and have an
option not to use zeroes - possibly using an option called 'sparse'.


>  vmdebootstrap | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/vmdebootstrap b/vmdebootstrap
> index fafd78a..f3fa192 100755
> --- a/vmdebootstrap
> +++ b/vmdebootstrap
> @@ -114,6 +114,8 @@ class VmDebootstrap(cliapp.Application):
>          self.settings.boolean(['grub'],
>                                'Install and configure grub2 -
> disables ' 'extlinux.')
> +        self.settings.boolean(['optimize-image'],
> +                'Filing up the image with zeros to increase its
> compression rate') 
>      def process_args(self, args):
>          if not self.settings['image'] and not
> self.settings['tarball']: @@ -539,9 +541,10 @@ append
> initrd=%(initrd)s root=UUID=%(uuid)s ro %(kserial)s """
>          Filing up the image with zeros will increase its compression
> rate """
> -        zeros = os.path.join(rootdir, 'ZEROS')
> -        self.runcmd_unchecked(['dd', 'if=/dev/zero', 'of=' + zeros,
> 'bs=1M'])
> -        self.runcmd(['rm', '-f', zeros])
> +        if self.settings['optimize-image']:
> +            zeros = os.path.join(rootdir, 'ZEROS')
> +            self.runcmd_unchecked(['dd', 'if=/dev/zero', 'of=' +
> zeros, 'bs=1M'])
> +            self.runcmd(['rm', '-f', zeros])
>  
>      def squash(self):
>          """
> -- 
> 2.1.1
> 


-- 


Neil Williams
=============
http://www.linux.codehelp.co.uk/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/vmdebootstrap-devel/attachments/20141016/47b0f196/attachment.sig>


More information about the Vmdebootstrap-devel mailing list