[ubuntu-us-mn] Removing old kernels
Fred H Olson
fholson at cohousing.org
Thu Sep 5 16:01:45 UTC 2013
I have long used the instructions on the page:
http://tech.mobiletod.com/remove-old-kernel-and-free-disk-space-on-ubuntu/
including on my current system - Ubuntu 12.04
Essentially:
sudo apt-get remove linux-image-<version>-generic
(it also gives steps to find old version numbers to replace <version>)
In recent years it seems like the kernel has been updated more often
resulting in more old kernels. Using the commands above periodically
has kept my kernel partition down to reasonable size.
Recently however, I ran out of inodes in my kernel partition (which is
seperate from my user partition) I still have about 30% of my 12 GB
kernel partition free but I was actually down to 0 free nodes. I removed
3 old kernels and and a few other things and got 12,400 nodes free but
I suspect that wont last long.
So I went investigating. I found:
/usr/src/linux-headers-3.2.0-23: 13,867 items 56.1 MB
/usr/src/linux-headers-3.2.0-23-generic: 8,120 items 11.0 MB
ALONG WITH comparable directories for 24 other versions
up thru 3.2.0.52 that I am currently using! Assuming that the "items"
each require one node that is about 22,000 x 24 = 528,000 nodes
I got the "items" from Nautilus >properties , all versions
seem to have a similar number)
The command df -i reports nodes:
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sda10 770048 757627 12421 99% /
So about 2/3 of the nodes in use are related to old kernel versions!
In addition the /lib/modules directory has many links to the old
kernel files above.
Is it safe to delete all the /usr/src/ files related to old
kernel versions?
If so would a more thorough procedure be:
sudo apt-get remove linux-image-2.6.xx-xx-generic
rmdir --ignore-fail-on-non-empty /usr/src/linux-image-<version>
rmdir --ignore-fail-on-non-empty /usr/src/linux-image-<version>-generic
rmdir --ignore-fail-on-non-empty /lib/src/linux-image-<version>-generic
BTW I have come across other procedures to remove old kernels
but so far stuck with this. What do other people prefer?
Fred
--
Fred H. Olson Minneapolis,MN 55411 USA (near north Mpls)
Email: fholson at cohousing.org 612-588-9532
My Link Pg: http://fholson.cohousing.org My org:
Communications for Justice -- Free, superior listserv's w/o ads
More information about the ubuntu-us-mn
mailing list