Pages

Welcome to My Blog

This is to share my IT experience with friends all around the world.
I have been working in Linux Fedora Systems for more than 8 years. Its fun to share knowledge and learn..
As everyone knows when a problem arises in your systems "googling" is the way that many depend on..

All the posts here are my working experiences during my working life.. So you can count on it..

I have added the references where I got help in solving IT issues


Wednesday, June 20, 2018

Cleaning the /boot partition in Ubuntu



Eventually, the boot sector space filled with the downloaded  images which creates system issues. Following commands are useful in identifying old images in the /boot partition and purge them from the system.

Initially, use df -h command and get the information about the space of the partitions

#df -h
Filesystem                   Size  Used Avail Use% Mounted on
udev                         3.9G     0  3.9G   0% /dev
tmpfs                        787M  9.4M  778M   2% /run
/dev/mapper/ubuntu--vg-root  909G  255G  608G  30% /
tmpfs                        3.9G  348K  3.9G   1% /dev/shm
tmpfs                        5.0M  4.0K  5.0M   1% /run/lock
tmpfs                        3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/sda1                    472M  468M     0 100% /boot
tmpfs                        787M   64K  787M   1% /run/user/1000

This provides the space availability of each partition and clearly shows the /boot partition is fully filled.

Go to /boot and type following command to identify the installed images in the system

#cd /boot
#dpkg -l linux-image-\* | grep ^ii
ii  linux-image-4.4.0-108-generic       4.4.0-108.131 amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-109-generic       4.4.0-109.132 amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-112-generic       4.4.0-112.135 amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-116-generic       4.4.0-116.140 amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-121-generic       4.4.0-121.145 amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-127-generic       4.4.0-127.153 amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-128-generic       4.4.0-128.154 amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-108-generic 4.4.0-108.131 amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-109-generic 4.4.0-109.132 amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-112-generic 4.4.0-112.135 amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-116-generic 4.4.0-116.140 amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-121-generic 4.4.0-121.145 amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-127-generic 4.4.0-127.153 amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP


Use uname command to check the current image version of the system

# uname -a 
Linux chamara-X556UAK 4.4.0-128-generic #154-Ubuntu SMP Fri May 25 14:15:18 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Use apt-get purge command to remove older versions of the images.
#  sudo apt-get purge linux-image-4.4.0-108
Reading package lists... Done
Building dependency tree      
Reading state information... Done

...
..
..
..
done
Purging configuration files for linux-image-4.4.0-108-generic (4.4.0-108.131) ...
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.4.0-108-generic /boot/vmlinuz-4.4.0-108-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.4.0-108-generic /boot/vmlinuz-4.4.0-108-generic


Now you will see the space available has increased in the /boot partition