Reputation: 1199
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?
Upvotes: 65
Views: 99546
Reputation: 2045
If you got this error
OSError: [Errno 28] No space left on device
And you are using Docker containers, you can clean your EC2 instance with these commands:
sudo systemctl stop docker
sudo rm -rf /var/lib/docker
sudo systemctl start docker
Upvotes: 0
Reputation: 22051
Not sure if AWS has added additional steps inorder to extend the added disk space but the below commands worked for me:
Follow the answer till the community wiki Step 6 Post that for Step 7 follow the steps as below:
sudo lsblk
Output:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 20G 0 disk
└─xvda1 202:1 0 8G 0 part /
sudo growpart /dev/xvda 1
sudo lsblk
Output:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda 202:0 0 20G 0 disk
└─xvda1 202:1 0 20G 0 part /
Upvotes: 2
Reputation: 10825
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):
$df -h
Filesystem Size Used Avail Use% Mounted on /dev/xvde1 6G 6G 0G 100% / none 17G 0 17G 0% /dev/shm
/dev/sda1
)df -h
output in step 1) [potentially not needed]$resize2fs /dev/xvde1
Filesystem Size Used Avail Use% Mounted on /dev/xvde1 813G 3.7G 801G 1% / none 17G 0 17G 0% /dev/shm
Upvotes: 87
Reputation: 616
Modify volume size. From AWS Console, you can modify the size of a volume.
df -h
Upvotes: 43
Reputation: 3792
du -a | sort -n
Upvotes: 7
Reputation: 45
I mounted the disk on another EC2 instance where I could successfully use growpart and then resize2fs. After that mounting back to the origin EC2 instance.
Upvotes: 1
Reputation: 29
I skipped all the detach/snapshot/new volume stuff... just did the resize.
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1 5904748 4725152 1119608 81% /
none 15728640 0 15728640 0% /dev/shm
[root@ip-10-25-6-214 ~]# resize2fs /dev/sda1
resize2fs 1.39 (29-May-2006)
Filesystem at /dev/sda1 is mounted on /; on-line resizing required
Performing an on-line resize of /dev/sda1 to 31457280 (4k) blocks.
Upvotes: 2
Reputation: 1199
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.
Upvotes: 27
Reputation: 9415
Your case is valid when the EC2 instance was created from "EBS-Store" rather than "Instance-Store". EC2 instance created from "instance-store" will always have a huge space (around 200GB +) allocated for /mnt directory.
Otherwise your solution is valid for those EC2 machine created from "EBS-Store". You can do more with such machines.
Upvotes: 0