LoginSignup
0
0

More than 5 years have passed since last update.

Freeing space on AWS EC2

Posted at

Environment

AWS instance EC2: t2.micro
OS: Linux Ubuntu 16.04.2 LTS

Noticing my server was excessively slow I logged in through ssh in the terminal.

After trying to execute a simple cd command I got the following error message:

No space left on device

I run the following command in order to display the biggest folders:

puts 'du -a / | sort -n -r | head -n 20'

Result:

4631892 /usr
3376452 /usr/src
1306868 /lib
1216332 /lib/modules
896280  /var
661540  /boot
548124  /var/lib
434396  /usr/bin
384996  /usr/lib
247080  /var/lib/mysql
230360  /usr/share
208144  /var/www
208140  /var/www/html
183928  /var/www/html/wp-content
150876  /var/lib/apt
150820  /var/lib/apt/lists
143004  /usr/local
129688  /usr/lib/x86_64-linux-gnu
126616  /var/lib/dpkg

After checking the /usr/src folder I noticed the following files were taking a huge place:

linux-headers-4.4.023    
linux-headers-4.4.023-generic    
linux-headers-4.4.026    
linux-headers-4.4.026-generic
linux-headers-4.4.029    
linux-headers-4.4.029-generic
linux-headers-4.4.031    
linux-headers-4.4.031-generic    
linux-headers-4.4.032    
linux-headers-4.4.032-generic    
linux-headers-4.4.033    
linux-headers-4.4.033-generic    
linux-headers-4.4.034    
linux-headers-4.4.034-generic    
linux-headers-4.4.035    
linux-headers-4.4.035-generic    
linux-headers-4.4.036    
linux-headers-4.4.036-generic     
linux-headers-4.4.037     
linux-headers-4.4.037-generic

Those files being old linux headers files I decided to purge them with

sudo apt-get autoremove

Allowed me to free about 30 Mb of memory. It seems very little but on t2.micro it has a significant impact.

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0