# how to clean useless kernel in /boot/



## xwwu (Jan 15, 2012)

Dear friends,

Server has been upgraded to be 9.0. but there are 4 kernels in /boot/: GENERIC/, kernel/, kernel.old/, and kernel.old1/. According to the upgrade documents, just kernel is useful, so can I delete other kernels? 

Need your help. Thanks.


----------



## vand777 (Jan 15, 2012)

xwwu said:
			
		

> Dear Friends:
> 
> server has been upgraded to be 9.0. but there are 4 kernels in /boot/:
> 
> ...



You can delete kernel.old and kernel.old1. I think (but not 100% sure) that you can delete GENERIC as well (I just do not have such directory in my boxes, so I do not know the origin of this folder). I assume that you copied your previous working generic kernel into GENERIC folder in the past. If so, then this folder can be deleted.


----------



## gkontos (Jan 15, 2012)

xwwu said:
			
		

> Dear Friends:
> 
> server has been upgraded to be 9.0. but there are 4 kernels in /boot/:
> 
> ...



Yes, nuke them 

Just for your reference, when you install a new kernel, the old one is automatically being moved to /boot/kernel.old, that way if you have problems booting your new kernel you can always boot with the old.


----------



## Beastie (Jan 15, 2012)

The default kernel (at least up till 8.2) used to be a gziped directory called GENERIC. So it must be left over from a previous installation.
As you have read /boot/kernel is your current kernel and any kernel.old? is a backup done during upgrades.

So you can simply keep /boot/kernel and remove the other 3 using *rm -r* for example.


----------



## xwwu (Jan 15, 2012)

Beastie said:
			
		

> The default kernel (at least up till 8.2) used to be a gziped directory called GENERIC. So it must be left over from a previous installation.
> As you have read /boot/kernel is your current kernel and any kernel.old? is a backup done during upgrades.
> 
> So you can simply keep /boot/kernel and remove the other 3 using *rm -r* for example.



Thanks! I will do it


----------



## da1 (Jan 15, 2012)

If you don;t know which kernel was booted last time, a little paranoia doesn;t hurt. Since I have no idea to find out which kernel was booted I would first do:[CMD=""]nextboot -k kernel[/CMD] and [cmd=""]reboot[/cmd] which means that the OS will boot /boot/kernel. If the OS comes up with no problems and everything is running fine, remove the other kernels.

I'm a bit paranoid when it comes to messing with the kernel. As a side note, I would keep 1 "old" kernel image (be it GENERIC or another one).


----------



## xwwu (Jan 15, 2012)

da1 said:
			
		

> If you don;t know which kernel was booted last time, a little paranoia doesn;t hurt. Since I have no idea to find out which kernel was booted I would first do:[CMD=""]nextboot -k kernel[/CMD] and [cmd=""]reboot[/cmd] which means that the OS will boot /boot/kernel. If the OS comes up with no problems and everything is running fine, remove the other kernels.
> 
> I'm a bit paranoid when it comes to messing with the kernel. As a side note, I would keep 1 "old" kernel image (be it GENERIC or another one).



but in /boot/ of 9.0, GENERIC is much smaller than kernel and kernel.old. I think there are many difference than 8.2. and other question is: where is src for kernel? Is it still in /usr/src/sys/i386/conf?


----------



## gkontos (Jan 15, 2012)

xwwu said:
			
		

> but in /boot/ of 9.0, GENERIC is much smaller than kernel and kernel.old. I think there are many difference than 8.2.



boot/kernel contains the kernel and the associated modules. It is very normal to be different in sizes as new modules are always added. 



			
				xwwu said:
			
		

> and other question is: where is src for kernel? Is it still in /usr/src/sys/i386/conf?



This is the location of the configuration options for the i386 kernel platform.


----------



## DutchDaemon (Jan 15, 2012)

Note that when using freebsd-update in combination with a custom kernel, the generic kernel can be placed in /boot/GENERIC; freebsd-update will then update _that_ kernel if necessary, leaving your custom kernel in /boot/kernel alone to be updated manually.


----------

