Dieser Post wurde aus meiner alten WordPress-Installation importiert. Sollte es Darstellungsprobleme, falsche Links oder fehlende Bilder geben, bitte einfach hier einen Kommentar hinterlassen. Danke.
My laptop has "only" 20 GB for the root-partition / including home, usr and var. This is enough but recent updates dropped my free space below 1 GB and lately below 500 MB. I noticed that various kernel images & modules are wasting spaces but not used at all.Kernel splatters are spread throughout the system, here is a sample from my lib dir:
$ du -chxs /lib/modules/*131M /lib/modules/2.6.38-11-generic135M /lib/modules/3.0.0-12-generic135M /lib/modules/3.0.0-13-generic135M /lib/modules/3.0.0-14-generic135M /lib/modules/3.0.0-15-generic135M /lib/modules/3.0.0-16-generic135M /lib/modules/3.0.0-17-generic135M /lib/modules/3.0.0-19-generic140M /lib/modules/3.2.0-24-generic140M /lib/modules/3.2.0-25-generic140M /lib/modules/3.2.0-26-generic141M /lib/modules/3.2.0-27-generic141M /lib/modules/3.2.0-29-generic141M /lib/modules/3.2.0-30-generic141M /lib/modules/3.2.0-31-generic141M /lib/modules/3.2.0-32-generic2,2G insgesamtI'm running kernel version 3.2 and don't ever expect to downgrade on my workstation:
$ uname -aLinux 3.2.0-32-generic #51-Ubuntu SMP Wed Sep 26 21:33:09 UTC 2012 x86_64 x86_64 x86_64 GNU/LinuxHow to get rid of these old packages? First, find them:
$ dpkg-query -l|grep 2.6.38rc linux-image-2.6.38-10-generic 2.6.38-10.46 Linux kernel image for version 2.6.38 on x86/x86_64ii linux-image-2.6.38-11-generic 2.6.38-11.50 Linux kernel image for version 2.6.38 on x86/x86_64rc linux-image-2.6.38-12-generic 2.6.38-12.51 Linux kernel image for version 2.6.38 on x86/x86_64rc linux-image-2.6.38-8-generic 2.6.38-8.42 Linux kernel image for version 2.6.38 on x86/x86_64The 3.0.XX versions are a very little bit more complicated to find:
$ dpkg-query -l|grep '3\.0\.'|grep linuxii linux-headers-3.0.0-12 3.0.0-12.20 Header files related to Linux kernel version 3.0.0ii linux-headers-3.0.0-12-generic 3.0.0-12.20 Linux kernel headers for version 3.0.0 on x86/x86_64ii linux-headers-3.0.0-13 3.0.0-13.22 Header files related to Linux kernel version 3.0.0ii linux-headers-3.0.0-13-generic 3.0.0-13.22 Linux kernel headers for version 3.0.0 on x86/x86_64ii linux-headers-3.0.0-14 3.0.0-14.23 Header files related to Linux kernel version 3.0.0ii linux-headers-3.0.0-14-generic 3.0.0-14.23 Linux kernel headers for version 3.0.0 on x86/x86_64ii linux-headers-3.0.0-15 3.0.0-15.26 Header files related to Linux kernel version 3.0.0ii linux-headers-3.0.0-15-generic 3.0.0-15.26 Linux kernel headers for version 3.0.0 on x86/x86_64ii linux-headers-3.0.0-16 3.0.0-16.29 Header files related to Linux kernel version 3.0.0ii linux-headers-3.0.0-16-generic 3.0.0-16.29 Linux kernel headers for version 3.0.0 on x86/x86_64ii linux-headers-3.0.0-17 3.0.0-17.30 Header files related to Linux kernel version 3.0.0ii linux-headers-3.0.0-17-generic 3.0.0-17.30 Linux kernel headers for version 3.0.0 on x86/x86_64ii linux-headers-3.0.0-19 3.0.0-19.33 Header files related to Linux kernel version 3.0.0ii linux-headers-3.0.0-19-generic 3.0.0-19.33 Linux kernel headers for version 3.0.0 on x86/x86_64ii linux-image-3.0.0-12-generic 3.0.0-12.20 Linux kernel image for version 3.0.0 on x86/x86_64ii linux-image-3.0.0-13-generic 3.0.0-13.22 Linux kernel image for version 3.0.0 on x86/x86_64ii linux-image-3.0.0-14-generic 3.0.0-14.23 Linux kernel image for version 3.0.0 on x86/x86_64ii linux-image-3.0.0-15-generic 3.0.0-15.26 Linux kernel image for version 3.0.0 on x86/x86_64ii linux-image-3.0.0-16-generic 3.0.0-16.29 Linux kernel image for version 3.0.0 on x86/x86_64ii linux-image-3.0.0-17-generic 3.0.0-17.30 Linux kernel image for version 3.0.0 on x86/x86_64ii linux-image-3.0.0-19-generic 3.0.0-19.33 Linux kernel image for version 3.0.0 on x86/x86_64ii linux-source-3.0.0 3.0.0-19.33 Linux kernel source for version 3.0.0 with Ubuntu patchesPretty much, isn't it?
I could write a Perl oneliner to parse the list and cut off everything but the package names, but a copy/paste wasn't slower. I added a little before/after disk space usage check.
$ df -h /;sudo apt-get remove linux-image-2.6.38-10-generic linux-image-2.6.38-11-generic linux-image-2.6.38-12-generic linux-image-2.6.38-8-generic linux-headers-3.0.0-12 linux-headers-3.0.0-12-generic linux-headers-3.0.0-13-generic linux-headers-3.0.0-14 linux-headers-3.0.0-13 linux-headers-3.0.0-14 linux-headers-3.0.0-14-generic linux-headers-3.0.0-15 linux-headers-3.0.0-15-generic linux-headers-3.0.0-16 linux-headers-3.0.0-16-generic linux-headers-3.0.0-17 linux-headers-3.0.0-17-generic linux-headers-3.0.0-19 linux-headers-3.0.0-19-generic linux-image-3.0.0-12-generic linux-image-3.0.0-13-generic linux-image-3.0.0-14-generic linux-image-3.0.0-15-generic linux-image-3.0.0-16-generic linux-image-3.0.0-17-generic linux-image-3.0.0-19-generic linux-source-3.0.0;df -h /Dateisystem Größe Benutzt Verf. Verw% Eingehängt auf/dev/sda5 20G 19G 638M 97% /Paketlisten werden gelesen... FertigAbhängigkeitsbaum wird aufgebaut Statusinformationen werden eingelesen... FertigDie folgenden Pakete werden ENTFERNT: linux-headers-3.0.0-12 linux-headers-3.0.0-12-generic linux-headers-3.0.0-13 linux-headers-3.0.0-13-generic linux-headers-3.0.0-14 linux-headers-3.0.0-14-generic linux-headers-3.0.0-15 linux-headers-3.0.0-15-generic linux-headers-3.0.0-16 linux-headers-3.0.0-16-generic linux-headers-3.0.0-17 linux-headers-3.0.0-17-generic linux-headers-3.0.0-19 linux-headers-3.0.0-19-generic linux-image-2.6.38-11-generic linux-image-3.0.0-12-generic linux-image-3.0.0-13-generic linux-image-3.0.0-14-generic linux-image-3.0.0-15-generic linux-image-3.0.0-16-generic linux-image-3.0.0-17-generic linux-image-3.0.0-19-generic linux-source-3.0.00 aktualisiert, 0 neu installiert, 23 zu entfernen und 17 nicht aktualisiert.Nach dieser Operation werden 1.992 MB Plattenplatz freigegeben.Möchten Sie fortfahren [J/n]?Entfernen von linux-headers-3.0.0-12-generic ...Entfernen von linux-headers-3.0.0-12 ...[...]Dateisystem Größe Benutzt Verf. Verw% Eingehängt auf/dev/sda5 20G 17G 2,6G 87% /
Done. The cleanup freed about 2 GB - which is 10% of my filesystem.
Warning: Always be sure that you don't remove your last or running kernel! Won't be good for the next system startup :-)
Noch keine Kommentare. Schreib was dazu