3

gksudo for Baobab Disk Usage Analyzer doesn't show /boot. I recently removed several old kernels. How can I verify that I've freed up space in /boot?

enter image description here

Backstory — I started spring cleaning because Ubuntu wasn't booting properly without workarounds. I diagnosed the error when my computer warned me that /boot was almost full. The warning opened Disk Usage Analyzer without root permission so /boot wasn't scanned. Now the analyzer can't seem to find the directory at all.

What I Did — After updating to most recent kernel, I removed old kernels one at a time with:

sudo apt purge linux-image-[VERSION].

When I was done, I updated grub2.

Each time the purge command said it would free up 0 Bytes of space. They are gone tho according to:

dpkg --list | grep linux-image

0

3 Answers 3

3

df -h shows you space on all partitions, not just /home, and to see all kernels, do dpkg -l linux-image*

You can remove multiple old kernels at once with a command like sudo apt-get remove linux-image-2.6.32-{21,37,38,39,40,41,42,43,44}-server (substitute your numbers based on what you find with dpkg) but be very careful not to remove the current kernel, nor the latest kernel!

uname -r shows you what you are currently using.

Note: sudo apt-get autoremove is good to run after removing old kernels as it removes obsolete dependencies.

1

Easiest way is to use df command:

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            3.7G     0  3.7G   0% /dev
tmpfs           759M  1.9M  757M   1% /run
/dev/nvme0n1p7   44G   19G   24G  44% /
tmpfs           3.8G   52M  3.7G   2% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           3.8G     0  3.8G   0% /sys/fs/cgroup
/dev/nvme0n1p8  9.1G   49M  9.0G   1% /mnt/e
/dev/nvme0n1p2   95M   28M   68M  29% /boot/efi
/dev/nvme0n1p4  391G  130G  262G  34% /mnt/c
/dev/sda3       920G   42G  878G   5% /mnt/d
tmpfs           759M   64K  759M   1% /run/user/1000
/dev/sdb5       6.3G  101M  5.9G   2% /media/rick/casper-rw
/dev/sdb1       6.4G   43M  6.4G   1% /media/rick/usbdata
/dev/sdb4       1.4G  1.4G     0 100% /media/rick/Ubuntu 18.04 LTS amd64

On my system /boot is embedded in root (/) directory. So I can see it's on partition /dev/nvme0n1p7 which is 44% full (24G available). This is enough to store 48 new kernels without purging any of the existing ones.

If you have a separate /boot partition you will see it on the df listing.

To see how much disk space, not only in /boot but also in /src/lib and /lib/modules each kernel consumes you can use rm-kernels to display storage used without removing anything:

rm-kernels-may2018

In this case there are 6.9 GB used in kernels not only in /boot but across rest of /. The display shows a separate column for how much is used in /boot directory.

You can also run the du (Disk Usage) command:

$ du /boot -h -s
1.2G    /boot
0

If /boot is a separate file system and if you run baobab with sudo, it will not list /boot as part of the full disk analysis. Instead you have to select the file system you want to analyse at the startup screen of baobab.

Alternatively you can run baobab like this: sudo baobab /boot to immediately open the disk usage for the /boot folder.

However, if you are on the command line already there are more ways (see other answer) to query the system disk usage.

Not the answer you're looking for? Browse other questions tagged .