雙系統,linux boot空間不足解決方法
很多同學都是在自己的機器上安裝雙系統,也就是說用來裝linux的空間不會很多。在裝的過程中都喜歡把boot掛單獨掛分割槽,一般設定100M,
可隨著linux升級,往往會攢下好幾個核心,某一天系統會提示你升級失敗,空間不足了。。。
更改boot分割槽大大小不曉得可不可以做到,貌似linux下還沒有無損分割槽的概念。
既然已經知道是boot空間不足了,那首先我們看看裡面都有神馬東西!!
[email protected]:~$ 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看下自己當前啟動的是哪個核心。
[email protected]:~$ 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命令看下你的機器上都有哪些核心檔案。
[email protected]:~$ dpkg --get-selections |grep linux-image
linux-image-2.6.35-22-generic deinstall
linux-image-2.6.35-24-generic deinstall
linux-image-2.6.35-25-generic install
linux-image-2.6.35-27-generic install
linux-image-2.6.35-28-generic install
linux-image-generic install
不少,理論上除正在用的都可以刪除,但剛升級的東西可能不穩定,為保險起見,保留1-2個之前版本吧。
執行apt-get remove命令解除安裝不需要的核心。
[email protected]:~$ sudo apt-get remove linux-image-2.6.35-25-generic
The following packages will be REMOVED:
linux-image-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 image: /boot/vmlinuz-2.6.35-28-generic
Found initrd image: /boot/initrd.img-2.6.35-28-generic
Found linux image: /boot/vmlinuz-2.6.35-27-generic
Found initrd image: /boot/initrd.img-2.6.35-27-generic
Found memtest86+ image: /memtest86+.bin
Found Windows 7 (loader) on /dev/sda1
Found Windows Vista (loader) on /dev/sda4
done
現在的ubuntu會自動重建啟動選單grub.cfg,所以就一步到位了。解除安裝完後可以用df命令看下boot分割槽的空間使用情況。
[email protected]:~$ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda9 19223252 9429624 8817144 52% /
/dev/sda7 93207 53279 35116 61% /boot
ok,已經騰出35m空間了,現在可以執行sudo apt-get upgrade升級了。
再用dpkg看下還剩什麼東西。
[email protected]:~$ dpkg --get-selections | grep linux-image
linux-image-2.6.35-25-generic deinstall
linux-image-2.6.35-27-generic install
linux-image-2.6.35-28-generic install
linux-image-generic install
linux-image-2.6.35-25-generic 顯示deinstall,表示已經刪除,也許你覺得留著這個也不好看,那就重啟後再執行一次解除安裝命令就可以了:
[email protected]:~$apt-get remove linux-image-2.6.35-25-generic
轉自:http://www.asmylife.com/ubuntu-boot-no-space