0

I've googled a good amount and am still pretty confused and feeling like I'm missing or overlooking something. My goal is to restore a host using a bundle.

I have an AMI bundle of a now-nonexistent instance sitting in S3. I've registered the bundle and can "launch" instances using ec2-run-instance. However, each instance is inaccesible after it shows as running on the web interface. Looking at the console log through the web interface, it's a problem with the filesystem on the new instances (error below).

Checking all file systems.

[/sbin/fsck.ext3 (1) -- /] fsck.ext3 -a /dev/sda1

/dev/sda1: clean, 156721/1310720 files, 1683095/2621440 blocks

[/sbin/fsck.ext3 (1) -- /mnt] fsck.ext3 -a /dev/sdb

/dev/sdb is mounted. e2fsck: Cannot continue, aborting.

[FAILED]

*** An error occurred during the file system check.

*** Dropping you to a shell; the system will reboot

*** when you leave the shell.

Give root password for maintenance

(or type Control-D to continue):

Obviously, I can't press Control-D or interact with it. Is it possible to mount the bundle as an EBS volume, or take a snapshot of the bundle, and then check out the filesystem? If so, how would I go about doing that? Also, while I didn't see any errors, does anyone have any idea what went wrong with the bundling process?

Thanks in advance!

Nija
  • 21
  • 2

1 Answers1

2

To make an EBS volume from the the S3-backed bundle will take a bit of work, but can be done:

  • Start a new instance, and attach a sufficiently sized EBS volume
    • You will also need enough free space on the instance to store the image temporarily (the ephemeral storage on a small instance should be ample).

  • Download your bundled volume to the instance:
    ec2-download-bundle -b BUCKET_NAME -m MANIFEST.xml -d TARGET_DIRECTORY
    • You also need to either pass your ACCESS_KEY, SECRET_ACCESS_KEY, and PRIVATE_KEY, or have then set as environment variables.

  • Unbundle the volume:
    ec2-unbundle  -m /local/path/to/manifest.xml -s SOURCE_DIRECTORY -d DESTINATION_DIRECTORY
  • Copy to EBS Volume:
    dd if=/path/to/image of=/dev/NAME

You should now be able to attach that EBS volume as the root volume to an instance (stop, detach original root, attach new root, start), or create a new image from a snapshot of the volume. Of course, you would expect the existing problem to persist with the new instance unless you fix it.

I would suggest that, as per this post, you have an entry in /etc/fstab that doesn't correspond to the attached devices, resulting in e2fsck being unable to run and the boot process failing. Look for the /mnt entry and remove (or correct) it to reflect the available volumes.

cyberx86
  • 20,805
  • 1
  • 62
  • 81