November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

Categories

November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

Boot Partition Full ( CentOS 7 )

Boot Partition Full ( CentOS 7 )

root@RHEL7HARDEN:~# df -h

Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg0-root   96G   15G   77G  16% /
devtmpfs              3.8G     0  3.8G   0% /dev
tmpfs                 3.8G  152K  3.8G   1% /dev/shm
tmpfs                 3.8G  9.1M  3.8G   1% /run
tmpfs                 3.8G     0  3.8G   0% /sys/fs/cgroup
/dev/sda1             283M  270M     0 100% /boot
/dev/mapper/vg0-home  577G  124G  424G  23% /home

Limit to only 2 kernels.

root@RHEL7HARDEN:~# vim /etc/yum.conf

installonly_limit=2

Below command will remove all the old kernels keeping the recent 2 kernels.

root@RHEL7HARDEN:~# package-cleanup –oldkernels –count=2
Loaded plugins: fastestmirror, langpacks
–> Running transaction check
—> Package kernel.x86_64 0:3.10.0-123.el7 will be erased
—> Package kernel.x86_64 0:3.10.0-229.1.2.el7 will be erased
—> Package kernel.x86_64 0:3.10.0-229.4.2.el7 will be erased
—> Package kernel-devel.x86_64 0:3.10.0-229.1.2.el7 will be erased
—> Package kernel-devel.x86_64 0:3.10.0-229.4.2.el7 will be erased
–> Finished Dependency Resolution
base/7/x86_64                              | 3.6 kB  00:00:00
epel/x86_64/metalink                       | 3.2 kB  00:00:00
extras/7/x86_64                            | 3.4 kB  00:00:00
google-chrome                              | 951 B   00:00:00
nux-dextop/x86_64                          | 2.9 kB  00:00:04
updates/7/x86_64                           | 3.4 kB  00:00:00

Dependencies Resolved

=====================================================================
Package        Arch       Version          Repository      Size
=====================================================================
Removing:
kernel        x86_64   3.10.0-123.el7       @anaconda      127 M
kernel        x86_64   3.10.0-229.1.2.el7   @updates       131 M
kernel        x86_64   3.10.0-229.4.2.el7   @updates       131 M
kernel-devel  x86_64   3.10.0-229.1.2.el7   @updates       32 M
kernel-devel  x86_64   3.10.0-229.4.2.el7   @updates       32 M

Transaction Summary
=====================================================================
Remove  5 Packages

Installed size: 453 M
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Erasing    : kernel-devel.x86_64                           1/5
Erasing    : kernel.x86_64                                 2/5
warning: file /lib/modules/3.10.0-229.1.2.el7.x86_64/weak-updates: remove failed: No such file or directory
warning: file /lib/modules/3.10.0-229.1.2.el7.x86_64/modules.softdep: remove failed: No such file or directory
warning: file /lib/modules/3.10.0-229.1.2.el7.x86_64/modules.devname: remove failed: No such file or directory
Erasing    : kernel-devel.x86_64                           3/5
Erasing    : kernel.x86_64                                 4/5
warning: file /lib/modules/3.10.0-123.el7.x86_64/modules.softdep: remove failed: No such file or directory
warning: file /lib/modules/3.10.0-123.el7.x86_64/modules.devname: remove failed: No such file or directory
Erasing    : kernel.x86_64                                 5/5
warning: file /lib/modules/3.10.0-229.4.2.el7.x86_64/weak-updates: remove failed: No such file or directory
warning: file /lib/modules/3.10.0-229.4.2.el7.x86_64/modules.softdep: remove failed: No such file or directory
warning: file /lib/modules/3.10.0-229.4.2.el7.x86_64/modules.devname: remove failed: No such file or directory
Verifying  : kernel-3.10.0-229.4.2.el7.x86_64              1/5
Verifying  : kernel-3.10.0-123.el7.x86_64                  2/5
Verifying  : kernel-devel-3.10.0-229.4.2.el7.x86_64        3/5
Verifying  : kernel-3.10.0-229.1.2.el7.x86_64              4/5
Verifying  : kernel-devel-3.10.0-229.1.2.el7.x86_64        5/5

Removed:
kernel.x86_64 0:3.10.0-123.el7
kernel.x86_64 0:3.10.0-229.1.2.el7
kernel.x86_64 0:3.10.0-229.4.2.el7
kernel-devel.x86_64 0:3.10.0-229.1.2.el7
kernel-devel.x86_64 0:3.10.0-229.4.2.el7

Complete!

root@RHEL7HARDEN:~# df -h

Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg0-root   96G   15G   77G  16% /
devtmpfs              3.8G     0  3.8G   0% /dev
tmpfs                 3.8G  152K  3.8G   1% /dev/shm
tmpfs                 3.8G  9.1M  3.8G   1% /run
tmpfs                 3.8G     0  3.8G   0% /sys/fs/cgroup/dev/sda1             283M  142M  123M  54% /boot
/dev/mapper/vg0-home  577G  124G  424G  23% /home

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>