This article will show you how to clean up RHEL root folder
Search large folder in root folder
Run below command
sudo du --exclude="/home" -x -h -a / | sort -r -h | head -30
# Example output
33G /
29G /var
27G /var/lib
26G /var/lib/docker
25G /var/lib/docker/volumes
As you can see above docker occupied quite large portion of root folder, to move docker data out of root folder follow below post
Clean up docker data
Run below command
docker system prune -a
Check your root folder space again
Run below command to check.
df -h
# Example output
Filesystem Size Used Avail Use% Mounted on
devtmpfs 24G 0 24G 0% /dev
tmpfs 24G 16K 24G 1% /dev/shm
tmpfs 24G 26M 24G 1% /run
tmpfs 24G 0 24G 0% /sys/fs/cgroup
/dev/mapper/rhel-root 50G 8.4G 42G 17% /
RHEL8 root folder check
Run below command
sudo du --exclude="/home" -x -h -a / | sort -r -h | head -30
# If output contains below
29G /
24G /var
22G /var/lib/containers/storage/overlay
22G /var/lib/containers/storage
22G /var/lib/containers
You can run below command to clean up root folder, similar as docker
sudo podman system prune -a
# Mine as an example
Deleted Networks
k8s-pod-network
Total reclaimed space: 107.3GB
Reference
- https://developers.redhat.com/blog/2020/12/10/how-to-clean-up-the-fedora-root-folder#search_the_largest_folders
- https://access.redhat.com/solutions/5408561