从 /boot 中删除旧的 vmlinuz.* 文件安全吗?

从 /boot 中删除旧的 vmlinuz.* 文件安全吗?

其中/boot有很多vmlinuz.*可追溯至 4 年前的文件。删除其中一些文件安全吗?

编辑:大多数似乎都有congig-3.*System.map.*文件与之相关。我可能也想摆脱它们?或者相反?

答案1

如果您运行以下命令,它们将被自动删除:

sudo apt-get autoremove

更新:我找到了一个虚拟机,我已经有几周没有运行这些命令了。以下是输出,显示autoremove清理了 /boot 中的文件,大小从 127M 减少到 96M:

stephane@steph-dev-vm ~> du -hs /boot/
127M    /boot/

stephane@steph-dev-vm ~> sudo apt-get install -f
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.16.0-30 linux-headers-3.16.0-30-generic linux-image-3.16.0-30-generic
  linux-image-extra-3.16.0-30-generic
Use 'apt-get autoremove' to remove them.

stephane@steph-dev-vm ~> sudo apt-get autoremove
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  linux-headers-3.16.0-30 linux-headers-3.16.0-30-generic linux-image-3.16.0-30-generic
  linux-image-extra-3.16.0-30-generic
0 upgraded, 0 newly installed, 4 to remove and 0 not upgraded.
After this operation, 281 MB disk space will be freed.
Do you want to continue? [Y/n] y
...
Found linux image: /boot/vmlinuz-3.16.0-31-generic
Found initrd image: /boot/initrd.img-3.16.0-31-generic
Found memtest86+ image: /boot/memtest86+.elf
Found memtest86+ image: /boot/memtest86+.bin
done

stephane@steph-dev-vm ~> du -hs /boot/
96M /boot/

答案2

答案似乎是安装了很多内核,我应该将其删除。

我删除了最老的使用方法sudo apt-get uninstall和通配符。如果操作错误,可能会有风险,但除此之外,这种方法很有效。

相关内容