Re: Whole lot of dir's in /lib/modules - can I delete them?
William Kenworthy <[email protected]> Mon, 27 Apr 2026 10:17:15 +0800
| Newsgroups | gmane.linux.gentoo.user |
|---|---|
| Organization | me@home |
| Message-ID | <[email protected]> |
On 27/4/26 03:35, Michael wrote: > On Sunday, 26 April 2026 18:10:10 British Summer Time > [email protected] wrote: >> On 4/27/26 12:10 AM, Michael wrote: >>> On Sunday, 26 April 2026 16:52:30 British Summer Time >>> >>> [email protected] wrote: >>>> Dear all, >> [snip] >> >>>> Andrew >>> Whenever you build a kernel with various options built as modules >>> [M], as opposed to building them in-kernel [*], the compiled >>> modules are stored under /lib/modules/. >>> >>> You can find all available modules of your current kernel with: >>> >>> find /lib/modules/$(uname -r) -type f -name '*.ko*' >>> >>> If you have cleared out old kernel images and initramfs files from >>> your /efi/ or /boot/, then you have no use for their old module >>> files hanging around in your /lib/modules/ and you can safely >>> delete them manually to recover disk space. >> Thanks Michael, that's what I though. I've been using the prebuilt >> kernel, "-bin" for a while hence a whole lot of modules but have to >> get back to my own build which usually has stuff all built-in. And >> yes, I have been deleting stuff in /efi/EFI/Gentoo but didn't think >> of /lib/modules. >> >> Thanks, >> Andrew > I tend to keep two or three previous kernels and their modules on my > system at a time, just in case something goes wrong with the current > kernel release. I must admit I only had to revert to previous kernels > rarely, because of bugs or a corrupt fs, so this is not a regular > occurrence. With disk space being relatively cheap it doesn't hurt to > keep a the last couple of kernels and their modules, just in case. Also there is /etc/kernels to manage, and I usually copy the matching /boot to /lib/modules to keep a copy handy after a couple of disasters - also ensures they are backed up. BillK