def make_image(opts={})
      opts = {:volume       => '/',
              :size         => 6000,
              :destination  => '/mnt/bundle',
              :exclude      => nil
              }.merge(opts)
      image_file = File.join(opts[:destination], opts[:prefix] )
      cmds = ["mkdir -p #{opts[:destination]}"]
      cmds << "dd if=/dev/zero of=#{image_file} bs=1M count=#{opts[:size]}"
      cmds << "mkfs.ext3 -F -j #{image_file}"
      cmds << "mkdir -p #{opts[:destination]}/loop"
      cmds << "mount -o loop #{image_file} #{opts[:destination]}/loop"
      cmds << "rsync -ax #{rsync_excludes(opts[:exclude])} #{opts[:volume]}/ #{opts[:destination]}/loop/"
      cmds << "if [[ -f /etc/init.d/ec2-ssh-host-key-gen ]]; then chmod u+x /etc/init.d/ec2-ssh-host-key-gen ;fi"
      cmds << "umount #{opts[:destination]}/loop"
      self.ssh cmds
      image_file
    end
def make_image(opts={})
      opts = {:volume       => '/',
              :size         => 6000,
              :destination  => '/mnt/bundle',
              :exclude      => nil
              }.merge(opts)
      image_file = File.join(opts[:destination], opts[:prefix] )
      cmds = ["mkdir -p #{opts[:destination]}"]
      cmds << "dd if=/dev/zero of=#{image_file} bs=1M count=#{opts[:size]}"
      cmds << "mkfs.ext3 -F -j #{image_file}"
      cmds << "mkdir -p #{opts[:destination]}/loop"
      cmds << "mount -o loop #{image_file} #{opts[:destination]}/loop"
      cmds << "rsync -ax #{rsync_excludes(opts[:exclude])} #{opts[:volume]}/ #{opts[:destination]}/loop/"
      cmds << "if [[ -f /etc/init.d/ec2-ssh-host-key-gen ]]; then chmod u+x /etc/init.d/ec2-ssh-host-key-gen ;fi"
      cmds << "umount #{opts[:destination]}/loop"
      self.ssh cmds
      image_file
    end
create an image file and copy this instance to the image file.