I deleted 44.6 GB and df moved by 5

●1 ●27 ●90
calendar_today ago • schedule1 min read

On August 28 my laptop sat at 88 % disk. I deleted a 44.6 GB video intermediate I could rebuild any time. du on the folder dropped 44 GB. df on the filesystem moved 5. XFCE's thumbnailer, tumblerd, still had the file open, and a deleted file's blocks come back only when the last descriptor closes. pkill -x tumblerd returned the space instantly.

When du and df disagree, the gap is deleted-but-open files, and lsof +L1 names them. For the usual case, where something real grew, the order is two commands:

du -ah / --exclude=/proc --exclude=/sys --exclude=/dev 2>/dev/null \
  | sort -rh | head -n 20
find / -xdev -type f -size +500M -exec ls -lh {} \; 2>/dev/null

The -h in sort -rh is load-bearing. I fed four size lines to both variants: sort -rn ranked 850K above 13G because it reads leading digits and stops. The excludes matter too: /proc/kcore on my laptop reports 128 TiB on an 868 GB disk, and any scan that walks it wastes minutes or reports nonsense.

On a server, when the full file is a log a live service still writes, skip rm and truncate in place with : > access.log, which keeps every open descriptor valid and frees the space without a restart.

Thresholds, exclude patterns and a recent-growth variation are on the find large files page.

🔥 Join developers growing publicly
Share your knowledge, build in public, and grow your developer presence with a global community.

More Posts

My 30-day log cleanup kept a file that was 30 and a half days old

BashSnippets - Oct 8

The log was deleted. Its 48M was still allocated.

BashSnippets - Oct 28

I killed the process I started. The port stayed taken.

BashSnippets - Nov 5

I escaped the dot correctly and sed still rewrote a file marked DO NOT CHANGE

BashSnippets - Oct 13

ShellCheck rates SC2086 as info. It let rm delete two files I never named.

BashSnippets - Sep 29
chevron_left
4k Points • 118 Badges
North America • bashsnippets.xyz
77Posts
35Comments
10Connections
Linux user who got tired of Googling the same bash commands every time I sat down at a terminal. Sta... Show more

Related Jobs

View all jobs →

Commenters (This Week)

1 comment
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!