How to clean up Ubuntu boot partition when its full

Published on Author JFLeave a comment

This is what I did on Ubuntu 16.04.4 LTS

I checked my version

lsb_release -a

Then checked the drive

Filesystem Size Used Avail Use% Mounted on
udev 978M 0 978M 0% /dev
tmpfs 200M 3.1M 197M 2% /run
/dev/mapper/hv--serbername--vg-root 116G 27G 84G 24% /
tmpfs 996M 0 996M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 996M 0 996M 0% /sys/fs/cgroup
/dev/sda1 236M 234M 0 100% /boot   <-----100% full!
cgmfs 100K 0 100K 0% /run/cgmanager/fs
tmpfs 200M 0 200M 0% /run/user/1000

Check which kernel you are running:

uname -r
4.4.0-116-generic

Check for installed images that may no longer be necessary

 sudo dpkg --list 'linux-image*'|awk '{ if ($1=="ii") print $2}'|grep -v `uname -r`
linux-image-4.4.0-112-generic
linux-image-4.4.0-91-generic
linux-image-4.4.0-93-generic
linux-image-4.4.0-96-generic
linux-image-extra-4.4.0-112-generic
linux-image-extra-4.4.0-91-generic
linux-image-extra-4.4.0-93-generic
linux-image-extra-4.4.0-96-generic

Since we’re running 116 we want to get rid of everything except the second to last one in relation to the current kernel.

 sudo rm -rf /boot/*-4.4.0-{91,93,96}-*

Then run the following, which took about 3 minutes

sudo apt-get install -f

Then check the drive again

 df -h
Filesystem Size Used Avail Use% Mounted on
udev 978M 0 978M 0% /dev
tmpfs 200M 3.1M 197M 2% /run
/dev/mapper/hv--lxdwob--vg-root 116G 25G 86G 23% /
tmpfs 996M 0 996M 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 996M 0 996M 0% /sys/fs/cgroup
/dev/sda1 236M 153M 71M 69% /boot  <---- down the 69% full!
cgmfs 100K 0 100K 0% /run/cgmanager/fs
tmpfs 200M 0 200M 0% /run/user/1000

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.