[LINUX] Partição "/boot" cheio

0xjeanpierre

Jean Pierre

Posted on December 18, 2023

[LINUX] Partição "/boot" cheio

Depois de uns meses sempre que atualizamos o sistema com base linux(ubuntu da vida) ele começa a deixar o /boot cheio com arquivos de versões de kernel antigas.

Com o passo a passo abaixo vamos conseguir executar alguns comandos para identificar arquivos antigos e apaga-los facilmente


TDLR

Para REMOVER todos os arquivos inúteis MENOS os arquivos utilizados atualmente:
Comando:

$ sudo rm -v $(ls /boot/*-generic | egrep -v $(uname -r))
Enter fullscreen mode Exit fullscreen mode

Entendendo como identificar para aprender decorar e não precisar mais googar

Para descobrir a versão do kernel atual:
Comando:

$ uname -r
Enter fullscreen mode Exit fullscreen mode

Saída:

5.15.0-91-generic
Enter fullscreen mode Exit fullscreen mode

Para listar todos os arquivos de kernel:
Comando:

$ ls -l /boot/*-generic
Enter fullscreen mode Exit fullscreen mode

Saída:

-rw-r--r-- 1 root root    253465 Jun 17  2021 /boot/config-5.11.0-22-generic
-rw-r--r-- 1 root root    262258 Aug 18 11:34 /boot/config-5.15.0-82-generic
-rw-r--r-- 1 root root    262146 Oct  5 05:10 /boot/config-5.15.0-87-generic
-rw-r--r-- 1 root root    262146 Nov  2 11:04 /boot/config-5.15.0-89-generic
-rw-r--r-- 1 root root    262265 Nov 16 10:58 /boot/config-5.15.0-91-generic
-rw-r--r-- 1 root root    237851 Jun 16  2021 /boot/config-5.4.0-77-generic
-rw-r--r-- 1 root root 129803030 Aug 30 02:52 /boot/initrd.img-5.15.0-82-generic
-rw-r--r-- 1 root root 129802342 Oct 19 14:04 /boot/initrd.img-5.15.0-87-generic
-rw-r--r-- 1 root root 129816017 Nov 21 00:51 /boot/initrd.img-5.15.0-89-generic
-rw-r--r-- 1 root root 129837544 Dec 15 12:25 /boot/initrd.img-5.15.0-91-generic
-rw------- 1 root root   5832311 Jun 17  2021 /boot/System.map-5.11.0-22-generic
-rw------- 1 root root   6240491 Aug 18 11:34 /boot/System.map-5.15.0-82-generic
-rw------- 1 root root   6244586 Oct  5 05:10 /boot/System.map-5.15.0-87-generic
-rw------- 1 root root   6245349 Nov  2 11:04 /boot/System.map-5.15.0-89-generic
-rw------- 1 root root   6242483 Nov 16 10:58 /boot/System.map-5.15.0-91-generic
-rw------- 1 root root   4751546 Jun 16  2021 /boot/System.map-5.4.0-77-generic
-rw------- 1 root root  10118208 Jun 17  2021 /boot/vmlinuz-5.11.0-22-generic
-rw------- 1 root root  11522568 Aug 18 13:03 /boot/vmlinuz-5.15.0-82-generic
-rw------- 1 root root  11523784 Oct  5 05:13 /boot/vmlinuz-5.15.0-87-generic
-rw------- 1 root root  11521320 Nov  2 11:05 /boot/vmlinuz-5.15.0-89-generic
-rw------- 1 root root  11517416 Nov 16 11:01 /boot/vmlinuz-5.15.0-91-generic
Enter fullscreen mode Exit fullscreen mode

Para listar os arquivos de kernel utilizados atualmente:
Comando

$ ls -l /boot/*-generic | egrep $(uname -r)
Enter fullscreen mode Exit fullscreen mode

Saída:

-rw-r--r-- 1 root root    262265 Nov 16 10:58 /boot/config-5.15.0-91-generic
-rw-r--r-- 1 root root 129837544 Dec 15 12:25 /boot/initrd.img-5.15.0-91-generic
-rw------- 1 root root   6242483 Nov 16 10:58 /boot/System.map-5.15.0-91-generic
-rw------- 1 root root  11517416 Nov 16 11:01 /boot/vmlinuz-5.15.0-91-generic
Enter fullscreen mode Exit fullscreen mode

Para listar todos os arquivos de kernel MENOS os arquivos utilizados atualmente:

$ ls -l /boot/*-generic | egrep -v $(uname -r) 
-rw-r--r-- 1 root root    253465 Jun 17  2021 /boot/config-5.11.0-22-generic
-rw-r--r-- 1 root root    262258 Aug 18 11:34 /boot/config-5.15.0-82-generic
-rw-r--r-- 1 root root    262146 Oct  5 05:10 /boot/config-5.15.0-87-generic
-rw-r--r-- 1 root root    262146 Nov  2 11:04 /boot/config-5.15.0-89-generic
-rw-r--r-- 1 root root    237851 Jun 16  2021 /boot/config-5.4.0-77-generic
-rw-r--r-- 1 root root 129803030 Aug 30 02:52 /boot/initrd.img-5.15.0-82-generic
-rw-r--r-- 1 root root 129802342 Oct 19 14:04 /boot/initrd.img-5.15.0-87-generic
-rw-r--r-- 1 root root 129816017 Nov 21 00:51 /boot/initrd.img-5.15.0-89-generic
-rw------- 1 root root   5832311 Jun 17  2021 /boot/System.map-5.11.0-22-generic
-rw------- 1 root root   6240491 Aug 18 11:34 /boot/System.map-5.15.0-82-generic
-rw------- 1 root root   6244586 Oct  5 05:10 /boot/System.map-5.15.0-87-generic
-rw------- 1 root root   6245349 Nov  2 11:04 /boot/System.map-5.15.0-89-generic
-rw------- 1 root root   4751546 Jun 16  2021 /boot/System.map-5.4.0-77-generic
-rw------- 1 root root  10118208 Jun 17  2021 /boot/vmlinuz-5.11.0-22-generic
-rw------- 1 root root  11522568 Aug 18 13:03 /boot/vmlinuz-5.15.0-82-generic
-rw------- 1 root root  11523784 Oct  5 05:13 /boot/vmlinuz-5.15.0-87-generic
-rw------- 1 root root  11521320 Nov  2 11:05 /boot/vmlinuz-5.15.0-89-generic
Enter fullscreen mode Exit fullscreen mode

Para REMOVER todos os arquivos listados MENOS os arquivos utilizados atualmente:
Comando:

$ sudo rm -v $(ls /boot/*-generic | egrep -v $(uname -r))
Enter fullscreen mode Exit fullscreen mode

Saída:

removed '/boot/config-5.11.0-22-generic'
removed '/boot/config-5.15.0-82-generic'
removed '/boot/config-5.15.0-87-generic'
removed '/boot/config-5.15.0-89-generic'
removed '/boot/config-5.4.0-77-generic'
removed '/boot/initrd.img-5.15.0-82-generic'
removed '/boot/initrd.img-5.15.0-87-generic'
removed '/boot/initrd.img-5.15.0-89-generic'
removed '/boot/System.map-5.11.0-22-generic'
removed '/boot/System.map-5.15.0-82-generic'
removed '/boot/System.map-5.15.0-87-generic'
removed '/boot/System.map-5.15.0-89-generic'
removed '/boot/System.map-5.4.0-77-generic'
removed '/boot/vmlinuz-5.11.0-22-generic'
removed '/boot/vmlinuz-5.15.0-82-generic'
removed '/boot/vmlinuz-5.15.0-87-generic'
removed '/boot/vmlinuz-5.15.0-89-generic'
Enter fullscreen mode Exit fullscreen mode
💖 💪 🙅 🚩
0xjeanpierre
Jean Pierre

Posted on December 18, 2023

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

[LINUX] Partição "/boot" cheio
linux [LINUX] Partição "/boot" cheio

December 18, 2023