0

I'm trying to create an image of my ec2 instance in Amazon's cloud. It's been a bit of an adventure so far. I did manage to install Amazon's ec2-api-tools, which was harder than it seemed like it should have been. Then I ran:

 ec2-bundle-vol -d /mnt -k pk-{key}.pem -c cert-{cert}.pem -u {uid} -s 1536

Which returned:

Copying / into the image file /mnt/image... Excluding:

    /sys/kernel/debug
    /sys/kernel/security
    /sys
    /proc
    /dev/pts
    /dev
    /dev
    /media
    /mnt
    /proc
     /sys
     /etc/udev/rules.d/70-persistent-net.rules
     /etc/udev/rules.d/z25_persistent-net.rules
     /mnt/image
    /mnt/img-mnt
1+0 records in
1+0 records out
1048576 bytes (1.0 MB) copied, 0.00677357 s, 155 MB/s
mkfs.ext3: option requires an argument -- 'L'
Usage: mkfs.ext3 [-c|-l filename] [-b block-size] [-f fragment-size]
        [-i bytes-per-inode] [-I inode-size] [-J journal-options]
        [-G meta group size] [-N number-of-inodes]
        [-m reserved-blocks-percentage] [-o creator-os]
        [-g blocks-per-group] [-L volume-label] [-M last-mounted-directory]
        [-O feature[,...]] [-r fs-revision] [-E extended-option[,...]]
        [-T fs-type] [-U UUID] [-jnqvFKSV] device [blocks-count]
ERROR: execution failed: "mkfs.ext3 -F /mnt/image -U 1c001580-9118-4a50-9a25-dcf02be6d25f -L "

So mkfs.ext3 wants -L, which is a volume name. But ec2-bundle-vol doesn't seem to take in a volume name as an argument, and the docs (http://docs.amazonwebservices.com/AmazonEC2/gsg/2006-06-26/creating-an-image.html) don't seem to think one should be needed. Certainly their sample command:

# ec2-bundle-vol -d /mnt -k ~root/pk-HKZYKTAIG2ECMXYIBH3HXV4ZBZQ55CLO.pem -u 495219933132 -s 1536

doesn't specify anything.

So... any help? What am I missing?

0

4 Answers 4

1

Well, I didn't manage to figure out what was causing the error, but I did find a better way.

Instead of using ec2-bundle-vol from the command line to create the image, it turns out you can do it from the AWS console.

Right click on the instance listed under instances in the EC2 tab, and Create Image is an option (woulda been nice if Amazon had mentioned that in their documentation...). That worked with no errors, though it did end up stopping and restarting the instance, which I hadn't expected.

1

After some research I've found that the label parameter is missing because it is an empty string (and not null as expected). I don't know who's to blame but I've found a workaround.

NOTE: I never wrote a single line in ruby.

Around line 141 in file /usr/lib/ec2-ami-tools/lib/ec2/platform/linux/image.rb replace:

mkfs += [ '-L', label ] if label

by

mkfs += [ '-L', label ] if !label.to_s.empty?

and then it should work!

1

Try labeling your root partition:

$ sudo e2label /dev/sda1 root

it worked for me.

1
  • This was the easiest/most persistent workaround. I worried about modding the packaged .rb file because the bug might still be present in future versions - this way it no longer matters if it is.
    – pjz
    Jul 27, 2012 at 19:11
0

Use a newer version of ec2-ami-tools (1.3.49953). One may take it from here:

https://launchpad.net/ubuntu/lucid/amd64/ec2-ami-tools/1.3.49953-0ubuntu1~lucid1 (for 64bit)

and

https://launchpad.net/ubuntu/lucid/i386/ec2-ami-tools/1.3.49953-0ubuntu1~lucid1 (for 32bit)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .