Zion Ahead

Well-Known Member
Nov 10, 2006
347
0
166
/boot partition is nearly 100% full.

I want to clean it. Is there a quick way to delete files older than X date?

What sample command would I run for example to delete all files older than the latest vmlinuz-2.6.9-89.0.19.ELsmp

Code:
lrwxrwxrwx   1 root root   16 Apr  4  2006 vmlinuz -> vmlinuz-2.6.16.1
-rw-r--r--   1 root root 1.5M Apr  4  2006 vmlinuz-2.6.16.1
-rw-r--r--   1 root root 1.4M Jun  8  2005 vmlinuz-2.6.9-11.EL
-rw-r--r--   1 root root 1.5M Jul  7  2006 vmlinuz-2.6.9-34.0.2.EL
-rw-r--r--   1 root root 1.5M Mar  8  2006 vmlinuz-2.6.9-34.EL
-rw-r--r--   1 root root 1.4M Feb 27  2007 vmlinuz-2.6.9-42.0.10.ELsmp
-rw-r--r--   1 root root 1.4M Aug 23  2006 vmlinuz-2.6.9-42.0.2.ELsmp
-rw-r--r--   1 root root 1.4M Oct  6  2006 vmlinuz-2.6.9-42.0.3.ELsmp
-rw-r--r--   1 root root 1.4M Jan 30  2007 vmlinuz-2.6.9-42.0.8.ELsmp
-rw-r--r--   1 root root 1.4M Jul 12  2006 vmlinuz-2.6.9-42.ELsmp
-rw-r--r--   1 root root 1.4M Feb 19  2005 vmlinuz-2.6.9-5.0.3.EL
-rw-r--r--   1 root root 1.4M Jun 26  2007 vmlinuz-2.6.9-55.0.2.ELsmp
-rw-r--r--   1 root root 1.4M Sep 27  2007 vmlinuz-2.6.9-55.0.9.ELsmp
-rw-r--r--   1 root root 1.4M May  2  2007 vmlinuz-2.6.9-55.ELsmp
-rw-r--r--   1 root root 1.4M May  8  2008 vmlinuz-2.6.9-67.0.15.ELsmp
-rw-r--r--   1 root root 1.4M Dec 19  2007 vmlinuz-2.6.9-67.0.1.ELsmp
-rw-r--r--   1 root root 1.4M Jun 26  2008 vmlinuz-2.6.9-67.0.20.ELsmp
-rw-r--r--   1 root root 1.4M Jul 23  2008 vmlinuz-2.6.9-67.0.22.ELsmp
-rw-r--r--   1 root root 1.4M Feb  3  2008 vmlinuz-2.6.9-67.0.4.ELsmp
-rw-r--r--   1 root root 1.4M Mar 15  2008 vmlinuz-2.6.9-67.0.7.ELsmp
-rw-r--r--   1 root root 1.5M Jan 14  2009 vmlinuz-2.6.9-78.0.13.ELsmp
-rw-r--r--   1 root root 1.5M Aug  5  2008 vmlinuz-2.6.9-78.0.1.EL
-rw-r--r--   1 root root 1.5M Aug  5  2008 vmlinuz-2.6.9-78.0.1.ELsmp
-rw-r--r--   1 root root 1.5M Apr 30  2009 vmlinuz-2.6.9-78.0.22.ELsmp
-rw-r--r--   1 root root 1.5M Oct  8  2008 vmlinuz-2.6.9-78.0.5.EL
-rw-r--r--   1 root root 1.5M Nov 19  2008 vmlinuz-2.6.9-78.0.8.ELsmp
-rw-r--r--   1 root root 1.5M Sep 15 06:25 vmlinuz-2.6.9-89.0.11.ELsmp
-rw-r--r--   1 root root 1.5M Nov  3 16:43 vmlinuz-2.6.9-89.0.16.ELsmp
-rw-r--r--   1 root root 1.5M Jan  8 05:52 vmlinuz-2.6.9-89.0.19.ELsmp
-rw-r--r--   1 root root 1.5M Aug 24 07:03 vmlinuz-2.6.9-89.0.9.ELsmp
 

cPanelDon

cPanel Quality Assurance Analyst
Staff member
Nov 5, 2008
2,545
12
268
Houston, Texas, U.S.A.
cPanel Access Level
DataCenter Provider
Twitter
/boot partition is nearly 100% full.

I want to clean it. Is there a quick way to delete files older than X date?

What sample command would I run for example to delete all files older than the latest vmlinuz-2.6.9-89.0.19.ELsmp

Code:
lrwxrwxrwx   1 root root   16 Apr  4  2006 vmlinuz -> vmlinuz-2.6.16.1
-rw-r--r--   1 root root 1.5M Apr  4  2006 vmlinuz-2.6.16.1
-rw-r--r--   1 root root 1.4M Jun  8  2005 vmlinuz-2.6.9-11.EL
-rw-r--r--   1 root root 1.5M Jul  7  2006 vmlinuz-2.6.9-34.0.2.EL
-rw-r--r--   1 root root 1.5M Mar  8  2006 vmlinuz-2.6.9-34.EL
-rw-r--r--   1 root root 1.4M Feb 27  2007 vmlinuz-2.6.9-42.0.10.ELsmp
-rw-r--r--   1 root root 1.4M Aug 23  2006 vmlinuz-2.6.9-42.0.2.ELsmp
-rw-r--r--   1 root root 1.4M Oct  6  2006 vmlinuz-2.6.9-42.0.3.ELsmp
-rw-r--r--   1 root root 1.4M Jan 30  2007 vmlinuz-2.6.9-42.0.8.ELsmp
-rw-r--r--   1 root root 1.4M Jul 12  2006 vmlinuz-2.6.9-42.ELsmp
-rw-r--r--   1 root root 1.4M Feb 19  2005 vmlinuz-2.6.9-5.0.3.EL
-rw-r--r--   1 root root 1.4M Jun 26  2007 vmlinuz-2.6.9-55.0.2.ELsmp
-rw-r--r--   1 root root 1.4M Sep 27  2007 vmlinuz-2.6.9-55.0.9.ELsmp
-rw-r--r--   1 root root 1.4M May  2  2007 vmlinuz-2.6.9-55.ELsmp
-rw-r--r--   1 root root 1.4M May  8  2008 vmlinuz-2.6.9-67.0.15.ELsmp
-rw-r--r--   1 root root 1.4M Dec 19  2007 vmlinuz-2.6.9-67.0.1.ELsmp
-rw-r--r--   1 root root 1.4M Jun 26  2008 vmlinuz-2.6.9-67.0.20.ELsmp
-rw-r--r--   1 root root 1.4M Jul 23  2008 vmlinuz-2.6.9-67.0.22.ELsmp
-rw-r--r--   1 root root 1.4M Feb  3  2008 vmlinuz-2.6.9-67.0.4.ELsmp
-rw-r--r--   1 root root 1.4M Mar 15  2008 vmlinuz-2.6.9-67.0.7.ELsmp
-rw-r--r--   1 root root 1.5M Jan 14  2009 vmlinuz-2.6.9-78.0.13.ELsmp
-rw-r--r--   1 root root 1.5M Aug  5  2008 vmlinuz-2.6.9-78.0.1.EL
-rw-r--r--   1 root root 1.5M Aug  5  2008 vmlinuz-2.6.9-78.0.1.ELsmp
-rw-r--r--   1 root root 1.5M Apr 30  2009 vmlinuz-2.6.9-78.0.22.ELsmp
-rw-r--r--   1 root root 1.5M Oct  8  2008 vmlinuz-2.6.9-78.0.5.EL
-rw-r--r--   1 root root 1.5M Nov 19  2008 vmlinuz-2.6.9-78.0.8.ELsmp
-rw-r--r--   1 root root 1.5M Sep 15 06:25 vmlinuz-2.6.9-89.0.11.ELsmp
-rw-r--r--   1 root root 1.5M Nov  3 16:43 vmlinuz-2.6.9-89.0.16.ELsmp
-rw-r--r--   1 root root 1.5M Jan  8 05:52 vmlinuz-2.6.9-89.0.19.ELsmp
-rw-r--r--   1 root root 1.5M Aug 24 07:03 vmlinuz-2.6.9-89.0.9.ELsmp
Anyone please?
Warning: While practicing extreme caution, older kernel RPMs may be removed using the OS package manager. If your OS is CentOS, YUM may be that tool.

For information on using YUM, please refer to its official manual page as accessed via the following command:
Code:
# man yum
First, check what kernel you're using, and do not attempt to remove it:
Code:
# uname -a
Also check what kernel RPMs are installed, and be sure to keep both the currently used kernel as well as some others to choose from as seen when checking the kernel RPM versions installed. If one version does not work (e.g., failure to boot properly) it helps to have a backup to try (with on-site assistance from data center staff).

To simply obtain a list of the installed kernel packages (RPMs), try the following:
Code:
# rpm -q kernel kernel-smp
An alternative to the above command, but one that will take longer to complete, is the following:
Code:
# rpm -qa | grep -i kernel | sort
At one's own risk, an older kernel RPM may be removed using "yum remove" followed by the package name and version, exactly as displayed by the output from "rpm" as seen by the last command.

Warning: If there is any uncertainty involved or if this is unfamiliar please escalate the request to the on-site data center staff as only they could help if something were to go wrong.
 
  • Like
Reactions: x-origin