Skip to content

Instantly share code, notes, and snippets.

@jbgo
Last active April 3, 2025 19:21

Revisions

  1. jbgo revised this gist Jun 14, 2013. 1 changed file with 12 additions and 2 deletions.
    14 changes: 12 additions & 2 deletions free-space-on-boot-disk.md
    Original file line number Diff line number Diff line change
    @@ -4,6 +4,7 @@

    ```
    dpkg -l linux-image*
    uname -r
    sudo apt-get remove linux-image-2.6.32-{21,37,38,39,40,41,42,43,44}-server
    sudo apt-get autoremove
    ```
    @@ -36,15 +37,24 @@ ii linux-image-2.6.32-45-server 2.6.32-45.104
    ii linux-image-server 2.6.32.45.52 Linux kernel image on Server Equipment.
    ```

    ## 2. Delete the old kernels.
    ## 2. Identify the kernel version you are currenlty running

    DON'T delete this kernel image! And if it's not the latest, don't delete the latest one either.

    ```
    $ uname -r
    2.6.32-45-server
    ```

    ## 3. Delete the old kernels.

    Removing the old kernels is the same as removing any other package. I'm using shell expansion for the version numbers to save typing. It will prompt you with a list of packages that will be removed, so you can double check the list before continuing.

    ```
    sudo apt-get remove linux-image-2.6.32-{21,37,38,39,40,41,42,43,44}-server
    ```

    ## 3. Remove dependencies.
    ## 4. Remove dependencies.

    There are some dependencies left on the system after removing the old kernels. Fortunately, you can easily clean these up, too.

  2. jbgo revised this gist Feb 22, 2013. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions free-space-on-boot-disk.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    # Free disk space when `/boot` is full (Ubuntu)

    ## TL;DR

    ```
  3. jbgo revised this gist Feb 22, 2013. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions free-space-on-boot-disk.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    TL;DR
    ## TL;DR

    ```
    dpkg -l linux-image*
    @@ -8,7 +8,7 @@ sudo apt-get autoremove

    This morning, I noticed New Relic that the `/boot` disk was almost full on several of our servers. It turns out that when the old kernel images are left on the disk after a kernel update. The solution is to delete old kernels that we don't need anymore.

    1. Find packages to delete.
    ## 1. Find packages to delete.

    You can safely delete all but the latest package that matches the pattern `linux-image-2.6.32-[0-9][0-9]-server`. Leave `linux-image-2.6.32-45-server` on your system because you will need it to reboot!

    @@ -34,15 +34,15 @@ ii linux-image-2.6.32-45-server 2.6.32-45.104
    ii linux-image-server 2.6.32.45.52 Linux kernel image on Server Equipment.
    ```

    2. Delete the old kernels.
    ## 2. Delete the old kernels.

    Removing the old kernels is the same as removing any other package. I'm using shell expansion for the version numbers to save typing. It will prompt you with a list of packages that will be removed, so you can double check the list before continuing.

    ```
    sudo apt-get remove linux-image-2.6.32-{21,37,38,39,40,41,42,43,44}-server
    ```

    3. Remove dependencies.
    ## 3. Remove dependencies.

    There are some dependencies left on the system after removing the old kernels. Fortunately, you can easily clean these up, too.

  4. jbgo revised this gist Feb 22, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion free-space-on-boot-disk.md
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@ sudo apt-get remove linux-image-2.6.32-{21,37,38,39,40,41,42,43,44}-server
    sudo apt-get autoremove
    ```

    This morning, I noticed New Relic that the boot disk was almost full on several of our servers. It turns out that when the old kernel images are left on the disk after a kernel update. The solution is to delete old kernels that we don't need anymore.
    This morning, I noticed New Relic that the `/boot` disk was almost full on several of our servers. It turns out that when the old kernel images are left on the disk after a kernel update. The solution is to delete old kernels that we don't need anymore.

    1. Find packages to delete.

  5. jbgo created this gist Feb 22, 2013.
    51 changes: 51 additions & 0 deletions free-space-on-boot-disk.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,51 @@
    TL;DR

    ```
    dpkg -l linux-image*
    sudo apt-get remove linux-image-2.6.32-{21,37,38,39,40,41,42,43,44}-server
    sudo apt-get autoremove
    ```

    This morning, I noticed New Relic that the boot disk was almost full on several of our servers. It turns out that when the old kernel images are left on the disk after a kernel update. The solution is to delete old kernels that we don't need anymore.

    1. Find packages to delete.

    You can safely delete all but the latest package that matches the pattern `linux-image-2.6.32-[0-9][0-9]-server`. Leave `linux-image-2.6.32-45-server` on your system because you will need it to reboot!

    ```
    $ dpkg -l linux-image*
    Desired=Unknown/Install/Remove/Purge/Hold
    | Status=Not/Inst/Cfg-files/Unpacked/Failed-cfg/Half-inst/trig-aWait/Trig-pend
    |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
    ||/ Name Version Description
    +++-=============================================-=============================================-==========================================================================================================
    un linux-image <none> (no description available)
    un linux-image-2.6 <none> (no description available)
    ii linux-image-2.6.32-21-server 2.6.32-21.32 Linux kernel image for version 2.6.32 on x86_64
    ii linux-image-2.6.32-37-server 2.6.32-37.81 Linux kernel image for version 2.6.32 on x86_64
    ii linux-image-2.6.32-38-server 2.6.32-38.83 Linux kernel image for version 2.6.32 on x86_64
    ii linux-image-2.6.32-39-server 2.6.32-39.86 Linux kernel image for version 2.6.32 on x86_64
    ii linux-image-2.6.32-40-server 2.6.32-40.87 Linux kernel image for version 2.6.32 on x86_64
    ii linux-image-2.6.32-41-server 2.6.32-41.91 Linux kernel image for version 2.6.32 on x86_64
    ii linux-image-2.6.32-42-server 2.6.32-42.96 Linux kernel image for version 2.6.32 on x86_64
    ii linux-image-2.6.32-43-server 2.6.32-43.97 Linux kernel image for version 2.6.32 on x86_64
    ii linux-image-2.6.32-44-server 2.6.32-44.98 Linux kernel image for version 2.6.32 on x86_64
    ii linux-image-2.6.32-45-server 2.6.32-45.104 Linux kernel image for version 2.6.32 on x86_64
    ii linux-image-server 2.6.32.45.52 Linux kernel image on Server Equipment.
    ```

    2. Delete the old kernels.

    Removing the old kernels is the same as removing any other package. I'm using shell expansion for the version numbers to save typing. It will prompt you with a list of packages that will be removed, so you can double check the list before continuing.

    ```
    sudo apt-get remove linux-image-2.6.32-{21,37,38,39,40,41,42,43,44}-server
    ```

    3. Remove dependencies.

    There are some dependencies left on the system after removing the old kernels. Fortunately, you can easily clean these up, too.

    ```
    sudo apt-get autoremove
    ```