2012年10月17日水曜日

Ubuntuでbootを逼迫している古いLinuxカーネルを削除

慣習に従って/bootディレクトリのパーティションを分けていたら(確か100M)、カーネルの更新のたびに、カーネルイメージがインストールされて、それが残って、/bootパーティションを逼迫していた。dist-upgradeができない状態に。
古いカーネルは不要なので削除する。ちなみに、Ubuntuのバージョンは12.04です。
インストールされているカーネルを確認する。

[*****@*****] $ dpkg -l | grep linux-image
rc  linux-image-3.2.0-23-generic           3.2.0-23.36                             Linux kernel image for version 3.2.0 on 64 bit x86 SMP
rc  linux-image-3.2.0-25-generic           3.2.0-25.40                             Linux kernel image for version 3.2.0 on 64 bit x86 SMP
rc  linux-image-3.2.0-26-generic           3.2.0-26.41                             Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii  linux-image-3.2.0-27-generic           3.2.0-27.43                             Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii  linux-image-3.2.0-29-generic           3.2.0-29.46                             Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii  linux-image-3.2.0-31-generic           3.2.0-31.50                             Linux kernel image for version 3.2.0 on 64 bit x86 SMP
iU  linux-image-3.2.0-32-generic           3.2.0-32.51                             Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii  linux-image-generic                    3.2.0.31.34                             Generic Linux kernel image
いっぱいある。結構たくさんある。なんとなく少しは戻れるように3.2.0-29以前を削除することにする
[****@***] $ sudo apt-get remove linux-image-3.2.0-2{3,5,6,7,9}-generic -y
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package linux-image-3.2.0-23-generic is not installed, so not removed
Package linux-image-3.2.0-25-generic is not installed, so not removed
Package linux-image-3.2.0-26-generic is not installed, so not removed
The following packages will be REMOVED:
  linux-image-3.2.0-27-generic linux-image-3.2.0-29-generic
0 upgraded, 0 newly installed, 2 to remove and 66 not upgraded.
15 not fully installed or removed.
After this operation, 298 MB disk space will be freed.
Setting up ubuntu-keyring (2011.11.21.1) ...
...(略) ...
Processing triggers for initramfs-tools ...
update-initramfs: Generating /boot/initrd.img-3.2.0-32-generic
よくみたら最初の方はrcだった。とりあえず、
sudo apt-get update && sudo apt-get upgrade -y && sudo apt-get dist-upgrade -y && sudo apt-get autoremove -y
してOK。df -hするとbootパーティションが半分くらい空いたが、また消すのめんどくさいな。
調べてみると、今の時代ではbootを別パーティションにする必要はないっぽい。
 参考:https://forums.ubuntulinux.jp/viewtopic.php?pid=12939

0 件のコメント:

コメントを投稿