如何清除启动分区上的空间

如何清除启动分区上的空间

我们继承了一台 Ubuntu Linux 服务器,该服务器的 /boot 分区空间不断不足,现在 clean 和 autoclean 命令不再起作用。我们怀疑问题与从未删除旧内核有关。我们不是 Linux 专家,因此不太愿意运行可能导致该服务器无法启动的命令。运行该uname -r命令时,版本为 3.13.0-53-generic。

运行命令后dpkg -l | grep linux-image-结果如下:

 rc  linux-image-2.6.32-38-server                2.6.32-38.83                      Linux kernel image for version 2.6.32 on x86_64
  rc  linux-image-2.6.32-41-server                2.6.32-41.94                      Linux kernel image for version 2.6.32 on x86_64
  rc  linux-image-2.6.32-42-server                2.6.32-42.96                      Linux kernel image for version 2.6.32 on x86_64
  rc  linux-image-2.6.32-43-server                2.6.32-43.97                      Linux kernel image for version 2.6.32 on x86_64
  rc  linux-image-2.6.32-44-server                2.6.32-44.98                      Linux kernel image for version 2.6.32 on x86_64
  rc  linux-image-2.6.32-45-server                2.6.32-45.104                     Linux kernel image for version 2.6.32 on x86_64
  rc  linux-image-2.6.32-46-server                2.6.32-46.108                     Linux kernel image for version 2.6.32 on x86_64
  rc  linux-image-2.6.32-47-server                2.6.32-47.109                     Linux kernel image for version 2.6.32 on x86_64
  rc  linux-image-2.6.32-48-server                2.6.32-48.110                     Linux kernel image for version 2.6.32 on x86_64
  rc  linux-image-2.6.32-49-server                2.6.32-49.111                     Linux kernel image for version 2.6.32 on x86_64
  rc  linux-image-2.6.32-50-server                2.6.32-50.112                     Linux kernel image for version 2.6.32 on x86_64
  rc  linux-image-2.6.32-51-server                2.6.32-51.113                     Linux kernel image for version 2.6.32 on x86_64
  rc  linux-image-2.6.32-52-server                2.6.32-52.114                     Linux kernel image for version 2.6.32 on x86_64
  rc  linux-image-2.6.32-53-server                2.6.32-53.115                     Linux kernel image for version 2.6.32 on x86_64
  rc  linux-image-2.6.32-54-server                2.6.32-54.116                     Linux kernel image for version 2.6.32 on x86_64
  rc  linux-image-2.6.32-55-server                2.6.32-55.117                     Linux kernel image for version 2.6.32 on x86_64
  rc  linux-image-2.6.32-56-server                2.6.32-56.118                     Linux kernel image for version 2.6.32 on x86_64
  rc  linux-image-2.6.32-57-server                2.6.32-57.119                     Linux kernel image for version 2.6.32 on x86_64
  rc  linux-image-2.6.32-58-server                2.6.32-58.121                     Linux kernel image for version 2.6.32 on x86_64
  rc  linux-image-2.6.32-60-server                2.6.32-60.122                     Linux kernel image for version 2.6.32 on x86_64
  rc  linux-image-2.6.32-61-server                2.6.32-61.124                     Linux kernel image for version 2.6.32 on x86_64
  rc  linux-image-2.6.32-62-server                2.6.32-62.126                     Linux kernel image for version 2.6.32 on x86_64
  rc  linux-image-2.6.32-64-server                2.6.32-64.128                     Linux kernel image for version 2.6.32 on x86_64
  rc  linux-image-3.13.0-37-generic               3.13.0-37.64~precise1             Linux kernel image for version 3.13.0 on 64 bit x86 SMP
  rc  linux-image-3.13.0-39-generic               3.13.0-39.66~precise1             Linux kernel image for version 3.13.0 on 64 bit x86 SMP
  rc  linux-image-3.13.0-40-generic               3.13.0-40.69~precise1             Linux kernel image for version 3.13.0 on 64 bit x86 SMP
  rc  linux-image-3.13.0-43-generic               3.13.0-43.72~precise1             Linux kernel image for version 3.13.0 on 64 bit x86 SMP
  ii  linux-image-3.13.0-44-generic               3.13.0-44.73~precise1             Linux kernel image for version 3.13.0 on 64 bit x86 SMP
  ii  linux-image-3.13.0-46-generic               3.13.0-46.79~precise1             Linux kernel image for version 3.13.0 on 64 bit x86 SMP
  ii  linux-image-3.13.0-48-generic               3.13.0-48.80~precise1             Linux kernel image for version 3.13.0 on 64 bit x86 SMP
  ii  linux-image-3.13.0-49-generic               3.13.0-49.81~precise1             Linux kernel image for version 3.13.0 on 64 bit x86 SMP
  ii  linux-image-3.13.0-51-generic               3.13.0-51.84~precise1             Linux kernel image for version 3.13.0 on 64 bit x86 SMP
  ii  linux-image-3.13.0-52-generic               3.13.0-52.85~precise1             Linux kernel image for version 3.13.0 on 64 bit x86 SMP
  rc  linux-image-3.2.0-67-generic                3.2.0-67.101                      Linux kernel image for version 3.2.0 on 64 bit x86 SMP
  rc  linux-image-3.2.0-68-generic                3.2.0-68.102                      Linux kernel image for version 3.2.0 on 64 bit x86 SMP
  rc  linux-image-3.2.0-69-generic                3.2.0-69.103                      Linux kernel image for version 3.2.0 on 64 bit x86 SMP
  rc  linux-image-3.2.0-70-generic                3.2.0-70.105                      Linux kernel image for version 3.2.0 on 64 bit x86 SMP
  rc  linux-image-3.2.0-72-generic                3.2.0-72.107                      Linux kernel image for version 3.2.0 on 64 bit x86 SMP
  rc  linux-image-3.2.0-74-generic                3.2.0-74.109                      Linux kernel image for version 3.2.0 on 64 bit x86 SMP
  rc  linux-image-3.2.0-75-generic                3.2.0-75.110                      Linux kernel image for version 3.2.0 on 64 bit x86 SMP
  rc  linux-image-3.2.0-76-generic                3.2.0-76.111                      Linux kernel image for version 3.2.0 on 64 bit x86 SMP
  rc  linux-image-3.2.0-77-generic                3.2.0-77.114                      Linux kernel image for version 3.2.0 on 64 bit x86 SMP
  rc  linux-image-3.2.0-79-generic                3.2.0-79.115                      Linux kernel image for version 3.2.0 on 64 bit x86 SMP
  rc  linux-image-3.2.0-80-generic                3.2.0-80.116                      Linux kernel image for version 3.2.0 on 64 bit x86 SMP
  rc  linux-image-3.2.0-82-generic                3.2.0-82.119                      Linux kernel image for version 3.2.0 on 64 bit x86 SMP
  ii  linux-image-3.2.0-83-generic                3.2.0-83.120                      Linux kernel image for version 3.2.0 on 64 bit x86 SMP
  ii  linux-image-generic-lts-trusty              3.13.0.52.45                      Generic Linux kernel image
  ii  linux-image-server                          3.2.0.83.97                       Linux kernel image on Server Equipment.

因为这里有太多没有意义的东西,我不确定如何使用sudo apt-get autoremove <old kernel>正确的语法运行命令以确保保留当前和最近的前一个命令。

任何见解或帮助都将不胜感激。

答案1

因为你知道命令uname -rdpkg -l | grep linux-image-,所以你比我更了解 Linux :)

我以前用这样的命令清理过旧内核: rm /boot/*-2.6.*,,,等等。然后也许你也可以运行,但这并不重要。rm /boot/*-3.2.*rm /boot/*-3.13.0-37-*update-grub

到目前为止我还没有遇到什么不好的事情(也许我只是运气好)。

相关内容