很多同学都是在自己的机器上安装双系统,也就是说用来装linux的空间不会很多。在装的过程中都喜欢把boot挂单独挂分区,一般设置100M,
可随着linux升级,往往会攒下好几个内核,某一天系统会提示你升级失败,空间不足了。。。
更改boot分区大大小不晓得可不可以做到,貌似linux下还没有无损分区的概念。
既然已经知道是boot空间不足了,那首先我们看看里面都有神马东西!!
expired@expired:~$ ls /boot
abi-2.6.35-25-generic memtest86+.bin
abi-2.6.35-27-generic memtest86+_multiboot.bin
abi-2.6.35-28-generic System.map-2.6.35-25-generic
config-2.6.35-25-generic System.map-2.6.35-27-generic
config-2.6.35-27-generic System.map-2.6.35-28-generic
config-2.6.35-28-generic vmcoreinfo-2.6.35-25-generic
grub vmcoreinfo-2.6.35-27-generic
initrd.img-2.6.35-25-generic vmcoreinfo-2.6.35-28-generic
initrd.img-2.6.35-27-generic vmlinuz-2.6.35-25-generic
initrd.img-2.6.35-28-generic vmlinuz-2.6.35-27-generic
lost+found vmlinuz-2.6.35-28-generic
我们可以看到都是一些内核启动文件,很明显有些是我们不需要的,其实以上都还是我已经卸载了俩比较老的内核的情况了,没商量,不需要的就当垃圾处理掉。
首先请用uname -a看下自己当前启动的是哪个内核。
expired@expired:~$ uname -a
Linux expired 2.6.35-28-generic #49-Ubuntu SMP Tue Mar 1 14:39:03 UTC 2011 x86_64 GNU/Linux
从中可以看到我此刻启动的是2.6.35-28-generic,再用dpkg命令看下你的机器上都有哪些内核文件。
expired@expired:~$ dpkg --get-selections |grep linux-p_w_picpath
linux-p_w_picpath-2.6.35-22-generic deinstall
linux-p_w_picpath-2.6.35-24-generic deinstall
linux-p_w_picpath-2.6.35-25-generic install
linux-p_w_picpath-2.6.35-27-generic install
linux-p_w_picpath-2.6.35-28-generic install
linux-p_w_picpath-generic install
不少,理论上除正在用的都可以删除,但刚升级的东西可能不稳定,为保险起见,保留1-2个之前版本吧。
运行apt-get remove命令卸载不需要的内核。
expired@expired:~$ sudo apt-get remove linux-p_w_picpath-2.6.35-25-generic
The following packages will be REMOVED:
linux-p_w_picpath-2.6.35-25-generic
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 139MB disk space will be freed.
Do you want to continue [Y/n]? y
出现以上提示问是否继续,按y或者直接回车继续。完成后会有如下提示:
DKMS: uninstall Completed.
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 2.6.35-25-generic /boot/vmlinuz-2.6.35-25-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 2.6.35-25-generic /boot/vmlinuz-2.6.35-25-generic
Generating grub.cfg ...
Found linux p_w_picpath: /boot/vmlinuz-2.6.35-28-generic
Found initrd p_w_picpath: /boot/initrd.img-2.6.35-28-generic
Found linux p_w_picpath: /boot/vmlinuz-2.6.35-27-generic
Found initrd p_w_picpath: /boot/initrd.img-2.6.35-27-generic
Found memtest86+ p_w_picpath: /memtest86+.bin
Found Windows 7 (loader) o