硬盘 - 在/boot中,如何释放更多的空间

分享于 

4分钟阅读

ubuntu

  繁體

问题:

/boot分区几乎满了,每次重新启动系统时都会收到警告,

安装新版本后,分区几乎已经满了,我还能删除什么?

以下是/boot分区上的文件列表:


:~$ ls /boot/


abi-2.6.31-21-generic lost+found


abi-2.6.32-25-generic memtest86+.bin


abi-2.6.38-10-generic memtest86+_multiboot.bin


abi-2.6.38-11-generic System.map-2.6.31-21-generic


abi-2.6.38-12-generic System.map-2.6.32-25-generic


abi-2.6.38-8-generic System.map-2.6.38-10-generic


abi-3.0.0-12-generic System.map-2.6.38-11-generic


abi-3.0.0-13-generic System.map-2.6.38-12-generic


abi-3.0.0-14-generic System.map-2.6.38-8-generic


boot System.map-3.0.0-12-generic


config-2.6.31-21-generic System.map-3.0.0-13-generic


config-2.6.32-25-generic System.map-3.0.0-14-generic


config-2.6.38-10-generic vmcoreinfo-2.6.31-21-generic


config-2.6.38-11-generic vmcoreinfo-2.6.32-25-generic


config-2.6.38-12-generic vmcoreinfo-2.6.38-10-generic


config-2.6.38-8-generic vmcoreinfo-2.6.38-11-generic


config-3.0.0-12-generic vmcoreinfo-2.6.38-12-generic


config-3.0.0-13-generic vmcoreinfo-2.6.38-8-generic


config-3.0.0-14-generic vmcoreinfo-3.0.0-12-generic


extlinux vmcoreinfo-3.0.0-13-generic


grub vmcoreinfo-3.0.0-14-generic


initrd.img-2.6.31-21-generic vmlinuz-2.6.31-21-generic


initrd.img-2.6.32-25-generic vmlinuz-2.6.32-25-generic


initrd.img-2.6.38-10-generic vmlinuz-2.6.38-10-generic


initrd.img-2.6.38-11-generic vmlinuz-2.6.38-11-generic


initrd.img-2.6.38-12-generic vmlinuz-2.6.38-12-generic


initrd.img-2.6.38-8-generic vmlinuz-2.6.38-8-generic


initrd.img-3.0.0-12-generic vmlinuz-3.0.0-12-generic


initrd.img-3.0.0-13-generic vmlinuz-3.0.0-13-generic


initrd.img-3.0.0-14-generic vmlinuz-3.0.0-14-generic



目前,我在使用3.0.0-14-generic内核。


答案1:

你有很多未使用的内核,删除除最后一个内核之外的所有内核:


sudo apt-get purge linux-image-{3.0.0-12,2.6.3{1-21,2-25,8-{1[012],8}}}



这是简写​​:


sudo apt-get purge linux-image-3.0.0-12 linux-image-2.6.31-21 linux-image-2.6.32-25 linux-image-2.6.38-10 linux-image-2.6.38-11 linux-image-2.6.38-12 linux-image-2.6.38-8



要列出所有已安装的内核,请运行:


dpkg -l linux-image-* | grep ^ii



一个命令显示可以删除的所有内核和头,不包括当前正在运行的内核:


kernelver=$(uname -r | sed -r 's/-[a-z]+//')


dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve $kernelver



它选择所有以linux-headers-<some number>linux-image-<some number>开头的软件包,打印已安装软件包的软件包名,然后排除当前加载的-运行内核,

升级内核,并重新引导测试后,可以使用以下命令删除所有其他内核:


sudo apt-get purge $(dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve"$(uname -r | sed -r 's/-[a-z]+//')")





Drive  FREE  spa  HAR  Space  硬盘