4

I am trying to build a new image based on "debian-6.0-squeeze-64bit-minimal-pvgrub-20110222-05 (ami-1e39ca77)", and it seems to be missing the ephemeral disks:

fdisk -l shows only /dev/xvda1 (ebs root device), and the block device mapping does not show the local disks.

GET http://169.254.169.254/latest/meta-data/block-device-mapping/
ami

the instance type is m1.xlarge which comes with 4 local disks:

echo  $(GET http://169.254.169.254/latest/meta-data/instance-type)
m1.xlarge

any idea?

3 Answers 3

7

If you launch an instance from an EBS root AMI, in the vast majority of cases, ephemeral storage is not attached, by default.

The ephemeral disks, available for the m1.xlarge are labelled ephemeral[0-3], each with 420GiB. You can NOT attach these to an instance once it has been launched. (On the other hand, you can add EBS volumes to an instance while it is running).

In order to change the ephemeral disks attached to the instance, you need to either:

  1. launch the instance explicitly specifying the ephemeral disk mappings OR

    ec2-run-instances ami-1e39ca77 -b /dev/xvdb=ephemeral0 -b /dev/xvdc=ephemeral1 -b /dev/xvdd=ephemeral2 -b /dev/xvde=ephemeral3

  2. register a new AMI, explicitly specifying the ephemeral disk mappings

    ec2-register -n Image_Name -d Image_Description --root-device-name /dev/xvda1 -b /dev/xvda1=snap-5241973e -b /dev/xvdb=ephemeral0 -b /dev/xvdc=ephemeral1 -b /dev/xvdd=ephemeral2 -b /dev/xvde=ephemeral3

This example is using the snapshot your AMI is based on as the root image. If you make changes to the root volume, you would, of course, use your own snapshot.

Note, that in both cases, the block devices will not be automatically mounted (unless you modify your fstab), although, they will immediately show up in /proc/partitions (or using fdisk -l).

1
  • in certain instances, we've found when specifying an instance store ami for creation (and calling from the SDK), you still need to do mkfs on the /dev/xvd_ in your startup script then mount the drive and make sure there is an entry in /etc/fstab.
    – Ross
    May 25, 2014 at 19:41
4

m1.xlarge has four 420GiB ephemeral disks available, but by default on most AMIs only one is attached, formatted, and mounted.

You'll need to use the block-device-mapping option to attach other ephemeral storage to your new instance at run time, then create file systems on the raw devices, then mount the file systems.

More info from Amazon:

http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/index.html?InstanceStorage.html

http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/index.html?block-device-mapping-concepts.html

0

BTW, in my case I had to use /dev/sdX device names, otherwise instance would not start at all and get terminated immediately. I've also didn't need to remap the root device, so I've used "-s" to indicate the root device volume. Though I had to use /dev/sdX, it shows up as /dev/xvdX in my Debian Squeeze 6.0.3 EBS-backed EC2 AMI.

ec2-register -n Image_Name -d Image_Description -s snapId_num -b /dev/sda1=snap-5241973e -b /dev/sdb=ephemeral0 -b /dev/sdc=ephemeral1 -b /dev/sdd=ephemeral2 -b /dev/sde=ephemeral3

You must log in to answer this question.

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