[CentOS] LIMITING NUMBER OF KERNEL VERSIONS RETAINED

Mon Jan 14 20:31:29 UTC 2008
David Hrbáč <hrbac.conf at seznam.cz>

Chris Geldenhuis napsal(a):
> Hi
> 
> Some time ago there was a discussion on the above subject. I have 
> scanned the past few month's mailing list archives and cannot find the 
> relevant mail(s).
> 
> Could somebody please repost the solution or point me at the correct 
> resource.
> 
> I would also appreciate advice on how to do this on a RHEL4 server being 
> updated with up2date.
> 
> Is it safe just to delete the old kernel and initrd files from the boot 
> partition and the grub conf file?
> 
> TIA
> 
> ChrisG

Hi,
I use this within my kikstart scripts:
if [ $(rpm -q kernel | wc -l) -gt 1 ]; then rpm -e $(rpm -q kernel | sed 
'$d'); fi
if [ $(rpm -q kernel-smp | wc -l) -gt 1 ]; then rpm -e $(rpm -q 
kernel-smp | sed '$d'); fi

David Hrbáč