Gregg's MOTD

Tips & Tricks that I've Encountered Over the Years...

How to Clean Up the Fedora Root Folder

September 06, 2023 — Gregg Szumowski

OK, so you’re running Fedora and you’re getting warnings that you’re running out of disk space on the root folder. What are your options?

The first thing to consider is resizing the root partition size. For that you can find instructions here

If that is not an option, then the next thing you probably should do is find out which folders/directories are causing the issue. You can use the du command and some piping to figure this out:

Search the largest folders

$ sudo du --exclude="/home" -x -h -a / | sort -r -h | head -30

Common cleanable folders

Sometimes the issue is found in the docker cache:

$ docker system prune -a

or previous kernel versions:

$ sudo dnf remove $(dnf repoquery --installonly --latest-limit=-2 -q)

Journal logs

$ sudo journalctl --vacuum-size=100M

Caches

The dnf package cache can be cleaned up too:

$ sudo dnf clean packages

You can also try cleaning up the Fedora version cache:

$ sudo dnf system-upgrade clean

Tags: cli, fedora, disk-space, clean, resize, sysadmin, motd