The other day when I attempted to run some regular updates for my Linux box (running Ubuntu 14.04 LTS), I encountered the message that the update could no proceed because the root partition was full. Here are the steps I took to clear unneeded files from the root partition.
1. First, I found out that I am running kernel 3.19.0-65 with this command below.
me@computer:~$ uname -r 3.19.0-65-generic
2. Next, list what kernel images are present in my root partition.
me@computer:~$ dpkg --list | grep linux-image ii linux-image-3.19.0-61-generic 3.19.0-61.69~14.04.1 amd64 Linux kernel image for version 3.19.0 on 64 bit x86 SMP ii linux-image-3.19.0-65-generic 3.19.0-65.73~14.04.1 amd64 Linux kernel image for version 3.19.0 on 64 bit x86 SMP ii linux-image-extra-3.19.0-61-generic 3.19.0-61.69~14.04.1 amd64 Linux kernel extra modules for version 3.19.0 on 64 bit x86 SMP ii linux-image-extra-3.19.0-65-generic 3.19.0-65.73~14.04.1 amd64 Linux kernel extra modules for version 3.19.0 on 64 bit x86 SMP ii linux-image-generic-lts-vivid 184.108.40.206.47 amd64 Generic Linux kernel image
3. The above was actually a truncated example; the actual list was much longer. In summary, I had many older kernel images that I do not need anymore. In the example shown above, I decided that since I am running 3.19.0-65, I will not need the -61 image anymore. Below is the command I used to clear out -61; I ran similar commands for all the kernel images with even lower versions as well to clear up space.
me@computer:~$ sudo apt-get purge linux-image-3.19.0-61-generic Reading package lists... Done Building dependency tree Reading state information... Done The following packages will be REMOVED: linux-image-3.19.0-61-generic* 0 upgraded, 0 newly installed, 1 to remove and 8 not upgraded. After this operation, 47.8 MB disk space will be freed. Do you want to continue? [Y/n] Y ...
Bonus: Useful related commands
sudo apt-get clean sudo apt-get update
The first empties /var/cache/apt/archives/ and /var/cache/apt/archives/partial/. The second updates apt-get’s list of available software packages.