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?
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:
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
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 usingfdisk -l
).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
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.