UEC image resize script

Matt Zimmerman mdz at canonical.com
Thu Oct 1 18:52:47 BST 2009


This script will take an official UEC image and resize it.  It should work
on a compressed or uncompressed image, and outputs an uncompressed one.
This is useful for speeding up testing the image, because the larger the
image, the longer it takes to encrypt and copy around within Eucalyptus.

Where would be a good place to stash it?

-- 
 - mdz
-------------- next part --------------
#!/bin/sh

set -e

if [ $# -lt 3 ]; then
	cat <<EOT >&2
Usage: resize-uec-image <existing image> <output file> <new size>

	Resizes a UEC image to a new size.

	New size is specified per resize2fs(8), e.g. "1G" for 1 gigabyte
EOT
	exit 1
fi

old_image="$1"
new_image="$2"
size="$3"

zcat -f $old_image | cp --sparse=always /dev/stdin $new_image
e2fsck -f $new_image
resize2fs $new_image $size


More information about the ubuntu-devel mailing list