AMI AWS No space left on device

amazon-amiamazon-web-servicesdisk-space-utilizationhard drive

I have a small AMI instance on AWS. The docs say that I should have 160G. I cannot download anything to the server as I get the following error:

write error: No space left on deviceMiB | 276 KiB/s 

$df -h

Filesystem            Size  Used Avail Use% Mounted on
/dev/xvda1            8.0G  8.0G     0 100% /
tmpfs                 830M     0  830M   0% /dev/shm

Where is my 160G?

Best Answer

The short answer is that the ephemeral storage was not associated with the instance when it was launched.

As per the documentation, makes 150GB of ephemeral storage available for an m1.small instance. However, in many cases (especially those instances with an EBS root volume), you will find that this extra storage is not attached by default.

The typical setup may have a root volume, a swap partition, and ephemeral storage. Remember that the 150GB of storage that Amazon refers to is ephemeral - that is, it will not persist if the machine is stopped, terminated, or crashes.

The ephemeral disks, are labelled ephemeral[0-3] (depending on the instance size). 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). An ephemeral volume must be added at launch time - either as part of the registered AMI or as part of the launch command. Ephemeral disks are specified as part of the block device mapping. So, essentially, you can either:

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

    ec2-run-instances ami-1a2b3c4d -b /dev/xvdb=ephemeral0
  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-1a2b3c4d -b /dev/xvdb=ephemeral0

(In the second example, above, I have used a snapshot as the image on which to base the root volume, in order for it to be an EBS backed instance)

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).

Related Topic