Link to home
Start Free TrialLog in
Avatar of Dan Bull
Dan Bull

asked on

How to free space on AWS Ubuntu 12.04.5 Instance

Firstly, while similar I do not believe my question is not a duplicate of other questions on this topic because all the suggestions in those questions have not resolved my problem.

I have a instance of Ubuntu running on EC2 that had been running fine for a couple of years. All the sudden the MySQL databases were unreachable. I ssh'd into the instance and tried sudo apt-get update just to try something and that was the first sign of the "No space left on device". The short of the long is I have done a lot of research trying to find a solution to my problem and have come up with zilch as most of the commands that seem to address this problem I can't get to run. I'm going to add a list of the commands with their corresponding results. Also, I have created a launched a second instance based on the offending AMI for testing suggestions. The results I give will be from the test instance.



sudo apt-get autoclean

sudo: unable to resolve host domU-12-31-39-0A-15-BE
Reading package lists... Error!
E: Could not open file /var/cache/apt/pkgcache.bin - open (28: No space left              on device)
E: Failed to truncate file - ftruncate (9: Bad file descriptor)
E: The package lists or status file could not be parsed or opened.

df -h

df: cannot read table of mounted file systems


dpkg -l | grep linux-image

ii  linux-image-3.2.0-23-virtual     3.2.0-23.36                       Linux kernel image for version 3.2.0 on 64 bit x86 Virtual Guests
ii  linux-image-3.2.0-39-virtual     3.2.0-39.62                       Linux kernel image for version 3.2.0 on 64 bit x86 Virtual Guests
ii  linux-image-3.2.0-58-virtual     3.2.0-58.88                       Linux kernel image for version 3.2.0 on 64 bit x86 Virtual Guests
ii  linux-image-3.2.0-64-virtual     3.2.0-64.97                       Linux kernel image for version 3.2.0 on 64 bit x86 Virtual Guests
ii  linux-image-3.2.0-69-virtual     3.2.0-69.103                      Linux kernel image for version 3.2.0 on 64 bit x86 Virtual Guests
ii  linux-image-3.2.0-70-virtual     3.2.0-70.105                      Linux kernel image for version 3.2.0 on 64 bit x86 Virtual Guests
ii  linux-image-3.2.0-74-virtual     3.2.0-74.109                      Linux kernel image for version 3.2.0 on 64 bit x86 Virtual Guests
ii  linux-image-3.2.0-75-virtual     3.2.0-75.110                      Linux kernel image for version 3.2.0 on 64 bit x86 Virtual Guests
ii  linux-image-3.2.0-83-virtual     3.2.0-83.120                      Linux kernel image for version 3.2.0 on 64 bit x86 Virtual Guests
ii  linux-image-3.2.0-88-virtual     3.2.0-88.126                      Linux kernel image for version 3.2.0 on 64 bit x86 Virtual Guests
ii  linux-image-3.2.0-89-virtual     3.2.0-89.127                      Linux kernel image for version 3.2.0 on 64 bit x86 Virtual Guests
ii  linux-image-virtual              3.2.0.89.103                      Linux kernel image for virtual machines


sudo apt-get purge linux-image-3.2.0-23.36-virtual

sudo: unable to resolve host domU-12-31-39-0A-15-BE
Reading package lists... Error!
E: Could not open file /var/cache/apt/pkgcache.bin - open (28: No space left    on device)
E: Failed to truncate file - ftruncate (9: Bad file descriptor)
E: The package lists or status file could not be parsed or opened.


lsblk

NAME  MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda1 202:1    0  12G  0 disk /



du -h /boot

4.0K    /boot/grub/locale
4.3M    /boot/grub
146M    /boot





cat /etc/fstab

LABEL=cloudimg-rootfs   /        ext4   defaults        0 0
/swapfile swap swap defaults 0 0

Open in new window

Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

This link is windows based but if you follow the instructions on how to increase the volume size you should be ok

1. Stop the instance
2. Create a snapshot of the boot drive
3. Using the above snapshot, create a new volume with the size you want
4. Detach the bootdrive volume from your instance
5. Attach the new larger volume to your instance
https://forums.aws.amazon.com/thread.jspa?threadID=51880

in ubuntu
sudo apt-get install gparted.
Launch it using Alt+F2, and typing gparted.
now resize your disk
https://askubuntu.com/questions/126153/how-to-resize-partitions
Avatar of Dan Bull
Dan Bull

ASKER

I left out the most important detail, the device is only 63% full.  That's what's so confusing to me about this situation.
SOLUTION
Avatar of Duncan Roe
Duncan Roe
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I've requested that this question be closed as follows:

Accepted answer: 0 points for obtechsupport's comment #a41023346

for the following reason:

Because my buddy locally got it working.
You ran fsck as I suggested. Now you have a working file system, I can give you commands (as I use) to track down where your disk space has gone.
We had to run /forcefsck and we tracked down the what was filling the hard drive.  It was a thousands of Amazon SES files.  What I'm assuming are some type of SES authentication hash.  We are using SES for outbound mail from a couple of sites on that instance.  What I don't understand is why when you first connect to the instance it shows that only 63% of the storage space was used.