Accessing storage on an EC2 instance?

I am using a large EC2 instance but just realized that I don't have the space promised. I only get 8 gigs when it says I should have 850 GB.

From what I understand two extra 420 gb drives should be avail for me to format/mount to setup, but I can't seem to find it. If I look in the dev directory its not there. I tried to enter "df -h " and it didn't show up either.

Is there something I need to do to get access to the drives?

if it helps, I'm using the standard amazon linux image.


To access the ephemeral (instance-store) storage Amazon includes with an EC2 instance, you need to define it when you launch an instance. Using the EC2 command line tools all you need to do is include the -b or --block-device-mapping option flag.

For example, this command would launch a single m1.large instance in us-east-1a, with ephemeral0 and ephemeral1 mapped to sdb1 and sdb2 respectively and the following options:

  • ami-id
  • (-n) number of instances to launch
  • (-t) instance type
  • (-z) availability zone
  • (-b) block device mapping
  • (-g) security group
  • (-k) key name

-

ec2-run-instances ami-id -n 1 -t m1.large -z us-east-1a -b "/dev/sdb1=ephemeral0" -b "/dev/sdb2=ephemeral1" -g security_group -k key_name

Then you can format and mount the devices. (repeat each command once for each device)

sudo mkfs /dev/sdb[1..n]

sudo mkdir -p /media/ephemeral[0...n]

You can then either add the following two lines to your /etc/fstab (feel free to adjust your mount options, file system, etc.)

/dev/sdb1   /media/ephemeral0 auto defaults,comment=cloudconfig 0 2
/dev/sdb2   /media/ephemeral1 auto defaults,comment=cloudconfig 0 2

And mount the devices

sudo mount /media/ephemeral0
sudo mount /media/ephemeral1

Or, just mount the devices without adding these devices to the fstab file

sudo mount -t ext3 /dev/sdb1 /media/ephemeral0
sudo mount -t ext3 /dev/sdb2 /media/ephemeral1

Verify

df -h

Sample Output:

[ec2-user@ip-10-251-159-223 media]$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/xvda1            7.9G  883M  7.0G  12% /
tmpfs                 3.7G   48K  3.7G   1% /dev/shm
/dev/xvdb1            414G  199M  393G   1% /media/ephemeral0
/dev/xvdb2            414G  199M  393G   1% /media/ephemeral1
[ec2-user@ip-10-251-159-223 media]$

By the way, once you customize your instance. Create your own AMI based on this instance and whenever you launch an instance from the resulting AMI the ephemeral storage will already be configured.

Also, take a look at the documentation provided on the AWS website.

Amazon Command Line Tools Documentation

Good Luck!


The additional space should be mounted under /mnt. However keep in mind, that everything on it will go away if you terminate your instance, so if you want to persist your data you need to go through extra steps. For example, you may want to create additional EBS volume, mount it every time you boot the instance and keep all your persistent data on it. I personally use space from /mnt for temporary files only.