Changing the size of images

There are multiple images ready to be used with eucalyptus (for example the one that we give as examples) but they may not have the right size for your needs. For example the images Eucalyptus provides has a 1GB root. This document will provide a way to create a bigger image out of an existing one.

Let's say you have an image, old.img, which you have uploaded and you are using in your cloud environment and you want to create a 4G image.

  • create the space for the new image
    dd if=/dev/zero of=new.img bs=1M count=4096
  • create temporary mount points
    mkdir old
    mkdir new
  • associate the old and new image with a loop device (let's say you are not using loop devices and loop0 and loop1 are available)
    losetup /dev/loop0 old.img
    losetup /dev/loop1 new.img
  • create a file system on the new image
    mke2fs -j /dev/loop1
  • mount the images
    mount /dev/loop0 old
    mount /dev/loop1 new
  • populate the new image
    (cd old; tar czf - .) | (cd new; tar xzf -)
  • umount the images
    umount /dev/loop0
    umount /dev/loop1
  • free the loop devices
    losetup -d /dev/loop0
    losetup -d /dev/loop1

In new.img you have now a replica of the old image but in the bigger size. You can now upload, register it and use it.

NOTE: be sure that the instance size you are using has a big enough root to hold your new image!