From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750980AbcBJVFu (ORCPT ); Wed, 10 Feb 2016 16:05:50 -0500 Received: from mail-pf0-f174.google.com ([209.85.192.174]:36406 "EHLO mail-pf0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750752AbcBJVFs (ORCPT ); Wed, 10 Feb 2016 16:05:48 -0500 Date: Wed, 10 Feb 2016 13:05:46 -0800 (PST) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Linus Torvalds cc: "J. Bruce Fields" , Linux Kernel Subject: Re: kernel pruning script.. In-Reply-To: Message-ID: References: User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 8 Feb 2016, Linus Torvalds wrote: > > I run this by hand every now and then. I'm probably doing it all wrong. > > > > --b. > > > > #!/bin/bash > > > > # because I use CONFIG_LOCALVERSION_AUTO, not the same version again and > > # again, /boot and /lib/modules/ eventually fill up. > > # Dumb script to purge that stuff: > > > > ssh "root@$1" ' > > > > for f in $(ls /lib/modules); do > > if rpm -qf "/lib/modules/$f" >/dev/null; then > > echo "keeping $f (installed from rpm)" > > elif [ $(uname -r) = "$f" ]; then > > echo "keeping $f (running kernel) " > > else > > echo "removing $f" > > rm -f "/boot/initramfs-$f.img" "/boot/System.map-$f" > > rm -f "/boot/vmlinuz-$f" "/boot/config-$f" > > rm -rf "/lib/modules/$f" > > new-kernel-pkg --remove $f > > fi > > done > > ' I do something similar to this on a regular basis as well, but I also rm -rf /lib/firmware/$f