While checking the root partition on my desktop today, I noticed that its usage is at 89% with just 6GiB free. For this reason, I wanted to find out what’s consuming most spaces and whether I can clean it up a bit.
# df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/fedora_watamem-root 56G 47G 6.3G 89% /
The first two commands that come to my mind are du
and ncdu
. In this post, I’ll use ncdu
to investigate the disk usages on the ‘/’ partitions.
According to the man(ual) page of ncdu
, we can pass -x
option to instruct ncdu
to not cross filesystem boundaries. Hence to check the disk usage for /
, I can run the following command:
# ncdu -x /
Here is the output:
cdu 1.17 ~ Use the arrow keys to navigate, press ? for help
--- / -----------------------------------------------------------
25.4 GiB [#####################] /usr
19.5 GiB [################ ] /var
1.8 GiB [# ] /opt
143.4 MiB [ ] /root
46.9 MiB [ ] /etc
736.0 KiB [ ] /srv
e 16.0 KiB [ ] /lost+found
12.0 KiB [ ] /mnt
e 4.0 KiB [ ] /media
e 4.0 KiB [ ] /docker
e 4.0 KiB [ ] /afs
e 4.0 KiB [ ] /.cache
@ 0.0 B [ ] lib64
@ 0.0 B [ ] sbin
@ 0.0 B [ ] lib
@ 0.0 B [ ] bin
Using the up and down arrow keys, I can navigate on each line, and hit the enter key when I want to drill down to the sub directories.
In my case, I found out that /var/lib/dnf/system-upgrade/fedora-a3256cee7c7d69ad
consumes about 7.0 GiB. This directory can be cleaned up as I already successfully upgraded this desktop to Fedora 37 (beta).
ncdu 1.17 ~ Use the arrow keys to navigate, press ? for help
--- /var/lib/dnf/system-upgrade ------------------------------------------------------------------------
/..
7.0 GiB [##############] /fedora-a3256cee7c7d69ad
289.0 MiB [ ] /rpmfusion-nonfree-53006c82d9a8b278
143.9 MiB [ ] /code-1a27fa61fdd77ffb
86.8 MiB [ ] /google-chrome-6ed7e4f336f6863c
53.2 MiB [ ] fedora-filenames.solvx
51.9 MiB [ ] /rpmfusion-free-368ecaf16d0ab606
24.9 MiB [ ] fedora.solv
24.5 MiB [ ] code-filenames.solvx
4.0 MiB [ ] /fedora-modular-04280d7da8729cb0
2.2 MiB [ ] fedora-modular-filenames.solvx
1.9 MiB [ ┌───Item info──────────────────────────────────────────────┐
952.0 KiB [ │ │
628.0 KiB [ │ Name: fedora-a3256cee7c7d69ad │
536.0 KiB [ │ Path: /var/lib/dnf/system-upgrade │
496.0 KiB [ │ Type: Directory │
472.0 KiB [ │ │
292.0 KiB [ │ Disk usage: 7.0 GiB (7,568,142,336 B) │
188.0 KiB [ │ Apparent size: 7.0 GiB (7,538,167,991 B) │
112.0 KiB [ │ │
44.0 KiB [ │ Press i to hide this window │
44.0 KiB [ └──────────────────────────────────────────────────────────┘
44.0 KiB [ ] /brave-browser-rpm-release.s3.brave.com_x86_64_-d55d330619c02b48
36.0 KiB [ ] /updates-fd4d3d0d1c34d49a
28.0 KiB [ ] /copr:copr.fedorainfracloud.org:fcsm:cryfs-12590adf66eeef1b
16.0 KiB [ ] brave-browser-rpm-release.s3.brave.com_x86_64_.solv
12.0 KiB [ ] fedora-cisco-openh264.solv
...
Note, to display the ‘Item info’, highlight on directory or file and hit the ‘i’ key.
Okay, let’s clean up this fedora-a3256cee7c7d69ad
directory, and verify it.
# dnf system-upgrade clean
Cleaning up downloaded data...
# df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/fedora_watamem-root 56G 40G 14G 74% /
Alright, the /
partition has 14 GiB available free space, and I’m happy with this for now.
Reference: