hidekiwiki

CentOS7で、/bootの容量が足りない場合の対処方法

カーネルのアップグレードを何度も繰り返していると、バックアップファイルが貯まり、
知らず知らずのうちに/bootが容量不足になります。
その場合は、yum-utilsを使うと比較的安全に古いカーネルを削除できます。
まずは、yum-utilsをインストール!!

yum install yum-utils

Loaded plugins: fastestmirror
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
base                                                                                                                                                                               | 3.6 kB  00:00:00
centosplus                                                                                                                                                                         | 3.4 kB  00:00:00
epel/x86_64/metalink                                                                                                                                                               | 5.4 kB  00:00:00
epel                                                                                                                                                                               | 4.3 kB  00:00:00
extras                                                                                                                                                                             | 3.4 kB  00:00:00
updates                                                                                                                                                                            | 3.4 kB  00:00:00
(1/4): extras/7/x86_64/primary_db                                                                                                                                                  |  98 kB  00:00:00
(2/4): updates/7/x86_64/primary_db                                                                                                                                                 | 1.3 MB  00:00:00
(3/4): epel/x86_64/updateinfo                                                                                                                                                      | 721 kB  00:00:01
(4/4): epel/x86_64/primary_db                                                                                                                                                      | 4.5 MB  00:00:02
Determining fastest mirrors
 * base: mirror.fairway.ne.jp
 * centosplus: mirror.fairway.ne.jp
 * epel: ftp.jaist.ac.jp
 * extras: ftp.yz.yamagata-u.ac.jp
 * updates: ftp.yz.yamagata-u.ac.jp
Resolving Dependencies
--> Running transaction check
---> Package yum-utils.noarch 0:1.1.31-40.el7 will be installed
--> Processing Dependency: python-kitchen for package: yum-utils-1.1.31-40.el7.noarch
--> Processing Dependency: libxml2-python for package: yum-utils-1.1.31-40.el7.noarch
--> Running transaction check
---> Package libxml2-python.x86_64 0:2.9.1-6.el7_2.3 will be installed
---> Package python-kitchen.noarch 0:1.1.1-5.el7 will be installed
--> Processing Dependency: python-chardet for package: python-kitchen-1.1.1-5.el7.noarch
--> Running transaction check
---> Package python-chardet.noarch 0:2.2.1-1.el7_1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================================================================================================================================
 Package                                              Arch                                         Version                                               Repository                                  Size
==========================================================================================================================================================================================================
Installing:
 yum-utils                                            noarch                                       1.1.31-40.el7                                         base                                       116 k
Installing for dependencies:
 libxml2-python                                       x86_64                                       2.9.1-6.el7_2.3                                       base                                       247 k
 python-chardet                                       noarch                                       2.2.1-1.el7_1                                         base                                       227 k
 python-kitchen                                       noarch                                       1.1.1-5.el7                                           base                                       267 k

Transaction Summary
==========================================================================================================================================================================================================
Install  1 Package (+3 Dependent packages)

Total download size: 856 k
Installed size: 4.3 M
Is this ok [y/d/N]: y
Downloading packages:
(1/4): libxml2-python-2.9.1-6.el7_2.3.x86_64.rpm                                                                                                                                   | 247 kB  00:00:00
(2/4): python-chardet-2.2.1-1.el7_1.noarch.rpm                                                                                                                                     | 227 kB  00:00:00
(3/4): python-kitchen-1.1.1-5.el7.noarch.rpm                                                                                                                                       | 267 kB  00:00:00
(4/4): yum-utils-1.1.31-40.el7.noarch.rpm                                                                                                                                          | 116 kB  00:00:09
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                      87 kB/s | 856 kB  00:00:09
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : python-chardet-2.2.1-1.el7_1.noarch                                                                                                                                                    1/4
  Installing : python-kitchen-1.1.1-5.el7.noarch                                                                                                                                                      2/4
  Installing : libxml2-python-2.9.1-6.el7_2.3.x86_64                                                                                                                                                  3/4
  Installing : yum-utils-1.1.31-40.el7.noarch                                                                                                                                                         4/4
  Verifying  : yum-utils-1.1.31-40.el7.noarch                                                                                                                                                         1/4
  Verifying  : python-kitchen-1.1.1-5.el7.noarch                                                                                                                                                      2/4
  Verifying  : libxml2-python-2.9.1-6.el7_2.3.x86_64                                                                                                                                                  3/4
  Verifying  : python-chardet-2.2.1-1.el7_1.noarch                                                                                                                                                    4/4

Installed:
  yum-utils.noarch 0:1.1.31-40.el7

Dependency Installed:
  libxml2-python.x86_64 0:2.9.1-6.el7_2.3                              python-chardet.noarch 0:2.2.1-1.el7_1                              python-kitchen.noarch 0:1.1.1-5.el7

Complete!

インストールが完了したので、次に、削除工程

最新のカーネルを3つだけ残して残りを削除。
package-cleanup --oldkernels --count=3コマンドを実行!!
[root@localhost boot]# package-cleanup --oldkernels --count=3
Loaded plugins: fastestmirror
--> Running transaction check
---> Package kernel.x86_64 0:3.10.0-327.13.1.el7 will be erased
---> Package kernel.x86_64 0:3.10.0-327.18.2.el7 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

==========================================================================================================================================================================================================
 Package                                      Arch                                         Version                                                   Repository                                      Size
==========================================================================================================================================================================================================
Removing:
 kernel                                       x86_64                                       3.10.0-327.13.1.el7                                       @updates                                       136 M
 kernel                                       x86_64                                       3.10.0-327.18.2.el7                                       @updates                                       136 M

Transaction Summary
==========================================================================================================================================================================================================
Remove  2 Packages

Installed size: 272 M
Is this ok [y/N]: y   ←「y」を入力。
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Erasing    : kernel.x86_64                                                                                                                                                                          1/2
  Erasing    : kernel.x86_64                                                                                                                                                                          2/2
  Verifying  : kernel-3.10.0-327.13.1.el7.x86_64                                                                                                                                                      1/2
  Verifying  : kernel-3.10.0-327.18.2.el7.x86_64                                                                                                                                                      2/2

Removed:
  kernel.x86_64 0:3.10.0-327.13.1.el7                                                                 kernel.x86_64 0:3.10.0-327.18.2.el7

Complete!

トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS