EC2 instance on Amazon and I am greeted with "No space left on the disk"
Here's an even easier method. (My m2.2xlarge instance was created with RedHat Linux 6.2, I discovered it had a paltry 6gb available of it's 850gb):
- 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
- From aws console, stop the instance
- From aws console, detach the volume (though note the mount point under attachment info, eg
/dev/sda1
) - From aws console, take a snapshot of the volume
- 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)
- From aws console, attach the new volume to original mount point /dev/sda1
- From aws console, restart the instance and ssh back in to the instance
- From ssh, run resize2fs on the root Filesystem (see
df -h
output in step 1) [potentially not needed]
$resize2fs /dev/xvde1
- wait for a few minutes, possibly go and watch your buddy who is stopping all the root services etc like a boss : )
- 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
Modify volume size. From AWS Console, you can modify the size of a volume.
- From AWS console, open 'ELASTIC BLOCK STORE/Volume'
- Select your volume and Modify volume(from Actions button)
- Change size (e.g. 8 to 20gib)
- Click Modify.
- Reboot from EC2 Dashboard.
- check size is changed by
df -h
I got a solution guys yippeeee
Assuming that you are using a linux AMI, in your case you have an easy method for increasing the size of the file system:
1) Stop the instance
2) Detach the root volume
3) Snapshot the volume
4) Create a new volume from the snapshot using the new size
5) Attach the new volume to the instance on the same place where the original one was
6) Start the instance, stop all services except ssh and set the root filesystem read only
7) Enlarge the filesystem (using for example resize2fs) and or the partition if needed
8) Reboot
As an alternative you can also launch a new instance and map the instance storage or you can create a new ami combining the two previous steps.