Do you want to save 15 Gb of space?
I have an old laptop from 2008, which is running ubuntu. Everytime a new kernel is released, this gets installed, however the older kernels and their image do remain available and they do not get automatically uninstalled. I guess this is a security feature, however if the installation is done only once, and years and years of new kernels are stacked, the space taken may start to be excessive and also big enough that reclaim it is a good idea.
Starting point
As you can see from below, my /
partition was quite full
mattions@triton:~$ df -h Filesystem Size Used Avail Use% Mounted on /dev/sda1 46G 43G 1.3G 98% / udev 2.0G 4.0K 2.0G 1% /dev tmpfs 396M 1.1M 395M 1% /run none 5.0M 8.0K 5.0M 1% /run/lock none 2.0G 260K 2.0G 1% /run/shm cgroup 2.0G 0 2.0G 0% /sys/fs/cgroup /dev/sda6 176G 166G 1.7G 100% /home /home/mattions/.Private 176G 166G 1.7G 100% /home/mattions
The images stored in the boot partition were also taking quite a bit of space:
mattions@triton:~$ du /boot -sh 2.3G /boot
Purge the old kernels
To purge the old kernels, you can either do it by hand via ubuntu software center, or by synaptic, or use a script to do it for you. After a bit of googling, I’ve discovered the following script, aptly named purge-old-kernels
, which I have also uploaded as a gist on git, just not to loose. Feel free to download it and use it if you want
When I ran the script, this is the list of the kernels that will be eliminated in my case (yours maybe will differ):
mattions@triton:~$ sudo bash Desktop/purge-old-kernels.sh
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
linux-headers-3.13.0-32 linux-headers-3.13.0-34 linux-headers-3.13.0-35 linux-headers-3.13.0-43 linux-headers-3.13.0-39
linux-headers-3.13.0-46 linux-headers-3.13.0-49 linux-headers-3.11.0-17 linux-headers-3.11.0-18
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED
linux-generic-lts-saucy* linux-headers-3.11.0-17-generic* linux-headers-3.11.0-18-generic* linux-headers-3.11.0-19-generic*
linux-headers-3.11.0-20-generic* linux-headers-3.11.0-22-generic* linux-headers-3.11.0-23-generic* linux-headers-3.11.0-24-generic*
linux-headers-3.11.0-26-generic* linux-headers-3.13.0-32-generic* linux-headers-3.13.0-33-generic* linux-headers-3.13.0-34-generic*
linux-headers-3.13.0-35-generic* linux-headers-3.13.0-36-generic* linux-headers-3.13.0-37-generic* linux-headers-3.13.0-39-generic*
linux-headers-3.13.0-43-generic* linux-headers-3.13.0-44-generic* linux-headers-3.13.0-45-generic* linux-headers-3.13.0-46-generic*
linux-headers-3.13.0-48-generic* linux-headers-3.13.0-49-generic* linux-headers-3.13.0-51-generic* linux-headers-3.13.0-52-generic*
linux-headers-3.2.0-23-generic* linux-headers-3.2.0-24-generic* linux-headers-3.2.0-25-generic* linux-headers-3.2.0-26-generic*
linux-headers-3.2.0-27-generic* linux-headers-3.2.0-29-generic* linux-headers-3.2.0-30-generic* linux-headers-3.2.0-31-generic*
linux-headers-3.2.0-32-generic* linux-headers-3.2.0-33-generic* linux-headers-3.2.0-34-generic* linux-headers-3.2.0-35-generic*
linux-headers-3.2.0-36-generic* linux-headers-3.2.0-37-generic* linux-headers-3.2.0-38-generic* linux-headers-3.2.0-39-generic*
linux-headers-3.2.0-40-generic* linux-headers-3.2.0-41-generic* linux-headers-3.2.0-43-generic* linux-headers-3.2.0-44-generic*
linux-headers-3.2.0-45-generic* linux-headers-3.2.0-48-generic* linux-headers-3.2.0-49-generic* linux-headers-3.2.0-51-generic*
linux-headers-3.2.0-52-generic* linux-headers-3.2.0-53-generic* linux-headers-3.2.0-54-generic* linux-headers-3.2.0-55-generic*
linux-headers-3.2.0-56-generic* linux-headers-3.2.0-57-generic* linux-headers-3.2.0-58-generic* linux-headers-3.2.0-59-generic*
linux-headers-3.2.0-60-generic* linux-headers-3.2.0-61-generic* linux-headers-3.2.0-63-generic* linux-headers-3.2.0-64-generic*
linux-headers-3.2.0-65-generic* linux-headers-3.2.0-67-generic* linux-headers-3.2.0-68-generic* linux-headers-3.2.0-69-generic*
linux-headers-3.2.0-70-generic* linux-headers-3.2.0-74-generic* linux-headers-3.2.0-75-generic* linux-headers-3.2.0-76-generic*
linux-headers-3.2.0-77-generic* linux-headers-3.2.0-79-generic* linux-headers-3.2.0-80-generic* linux-headers-3.2.0-82-generic*
linux-headers-3.2.0-83-generic* linux-headers-3.8.0-36-generic* linux-headers-generic-lts-saucy* linux-image-3.11.0-17-generic*
linux-image-3.11.0-18-generic* linux-image-3.11.0-19-generic* linux-image-3.11.0-20-generic* linux-image-3.11.0-22-generic*
linux-image-3.11.0-23-generic* linux-image-3.11.0-24-generic* linux-image-3.11.0-26-generic* linux-image-3.13.0-32-generic*
linux-image-3.13.0-33-generic* linux-image-3.13.0-34-generic* linux-image-3.13.0-35-generic* linux-image-3.13.0-36-generic*
linux-image-3.13.0-37-generic* linux-image-3.13.0-39-generic* linux-image-3.13.0-43-generic* linux-image-3.13.0-44-generic*
linux-image-3.13.0-45-generic* linux-image-3.13.0-46-generic* linux-image-3.13.0-48-generic* linux-image-3.13.0-49-generic*
linux-image-3.13.0-51-generic* linux-image-3.13.0-52-generic* linux-image-3.2.0-23-generic* linux-image-3.2.0-24-generic*
linux-image-3.2.0-25-generic* linux-image-3.2.0-26-generic* linux-image-3.2.0-27-generic* linux-image-3.2.0-29-generic*
linux-image-3.2.0-30-generic* linux-image-3.2.0-31-generic* linux-image-3.2.0-32-generic* linux-image-3.2.0-33-generic*
linux-image-3.2.0-34-generic* linux-image-3.2.0-35-generic* linux-image-3.2.0-36-generic* linux-image-3.2.0-37-generic*
linux-image-3.2.0-38-generic* linux-image-3.2.0-39-generic* linux-image-3.2.0-40-generic* linux-image-3.2.0-41-generic*
linux-image-3.2.0-43-generic* linux-image-3.2.0-44-generic* linux-image-3.2.0-45-generic* linux-image-3.2.0-48-generic*
linux-image-3.2.0-49-generic* linux-image-3.2.0-51-generic* linux-image-3.2.0-52-generic* linux-image-3.2.0-53-generic*
linux-image-3.2.0-54-generic* linux-image-3.2.0-55-generic* linux-image-3.2.0-56-generic* linux-image-3.2.0-57-generic*
linux-image-3.2.0-58-generic* linux-image-3.2.0-59-generic* linux-image-3.2.0-60-generic* linux-image-3.2.0-61-generic*
linux-image-3.2.0-63-generic* linux-image-3.2.0-64-generic* linux-image-3.2.0-65-generic* linux-image-3.2.0-67-generic*
linux-image-3.2.0-68-generic* linux-image-3.2.0-69-generic* linux-image-3.2.0-70-generic* linux-image-3.2.0-74-generic*
linux-image-3.2.0-75-generic* linux-image-3.2.0-76-generic* linux-image-3.2.0-77-generic* linux-image-3.2.0-79-generic*
linux-image-3.2.0-80-generic* linux-image-3.2.0-82-generic* linux-image-3.2.0-83-generic* linux-image-3.8.0-36-generic*
linux-image-generic-lts-saucy*
0 to upgrade, 0 to newly install, 149 to remove and 1 not to upgrade.
After this operation, 13.0 GB disk space will be freed.
Do you want to continue [Y/n]?
Results
After I’ve choosen yes, it took quite a bit but at the end it was worth it
mattions@triton:~$ df -h Filesystem Size Used Avail Use% Mounted on /dev/sda1 46G 28G 17G 63% / udev 2.0G 4.0K 2.0G 1% /dev tmpfs 396M 1.1M 395M 1% /run none 5.0M 8.0K 5.0M 1% /run/lock none 2.0G 37M 1.9G 2% /run/shm cgroup 2.0G 0 2.0G 0% /sys/fs/cgroup /dev/sda6 176G 166G 1.7G 100% /home /home/mattions/.Private 176G 166G 1.7G 100% /home/mattions
And the Boot
partition is just 70 Mb:
mattions@triton:~$ du /boot -sh 70M /boot
So from 45 Gb to 25 GB, and the boot partition itself from 2.3 Gb to 70 Mb.
Pretty good I think.