1

I recently ran out of space creating a backup of the important directories of my 20 GB worth of Ubuntu 16.04 onto the same 30 GB partition my Ubuntu 16.04 is stored on. Part of the problem was an older backup that crashed and a 6 GB .tar file was still in / and needed to be deleted (tar: file changed as we read it). The other part of the problem is I had 21 kernels installed taking up way too much space.

I've already written a humble bash script called rm-kernels to remove older kernel versions but it doesn't display the size a kernel takes ups accurately. For example in the link you can see it erroneously displays ~50 MB but in reality a kernel takes up ~300 MB:

rm-kernels 3

My humble bash script merely lists the size of a given Kernel's files in /boot directory. I wish to add the size of files in /usr/src/kernel_version and /lib/modules/kernel_version which I've stumbled across.

As I've stumbled across these directories by chance I wonder: Are there other directories I need to add?

WinEunuuchs2Unix
  • 1,801
  • 1
  • 17
  • 34
  • You're probably asking an XY question. How did these kernels get installed? If installed by updates, i.e. as packages, then they should be removed as packages. – sawdust Jul 27 '17 at 05:39
  • I'm voting to close this question as off-topic because it's not about programming. – sawdust Jul 27 '17 at 05:44
  • @sawdust The kernels were installed using: https://askubuntu.com/questions/879888/how-do-i-update-kernel-to-the-latest-mainline-version/879920#879920 in short: `sudo dpkg -i *.deb`. I did have a question about how to add up the file sizes over three directories but did not want to bother people with that question. Should I put it in? – WinEunuuchs2Unix Jul 27 '17 at 17:57

0 Answers0