EC2 instance on Amazon and I am greeted with "No space left on the disk"

onkar picture onkar · May 27, 2011 · Viewed 50.8k times · Source

I have installed Amazon EC2 fedora instance and copying the files from one location to another. But I am greeted with " No space left on the disk".

I did df -f.

with output:

Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1              15G   15G     0 100% /
none                  312M     0  312M   0% /dev/shm

I want to increase the space for ec2 instance on amazon. Can someone help me with it?

Answer

Riaz Rizvi picture Riaz Rizvi · Mar 15, 2012

Here's an even easier method. (My m2.2xlarge instance was created with RedHat Linux 6.2, I discovered it had a paltry 6gb of it's 850gb available):

  1. Via ssh, check space under root: $df -h

    Filesystem            Size  Used Avail Use% Mounted on
    /dev/xvde1              6G    6G    0G   100% /
    none                   17G     0   17G   0% /dev/shm
    
  2. From aws console, stop the instance

  3. From aws console, detach the volume (though note the mount point under attachment info, eg /dev/sda1)
  4. From aws console, take a snapshot of the volume
  5. From aws console, create a new volume using the snapshot (using all the remaining space for the instance type, eg 825gb in my m2.2xlarge case)
  6. From aws console, attach the new volume to original mount point /dev/sda1
  7. From aws console, restart the instance and ssh back in to the instance
  8. From ssh, run resize2fs on the root Filesystem (see df -h output in step 1)

    $resize2fs /dev/xvde1

  9. wait for a few minutes, possibly go and watch your buddy who is stopping all the root services etc like a boss : )

  10. observe the new cavernous mount: $df -h
    Filesystem            Size  Used   Avail Use%   Mounted on
    /dev/xvde1            813G  3.7G    801G   1%     /
    none                   17G     0     17G   0%     /dev/shm