Linux Wi-Fi Drivers: Getting Difficult Chipsets Working
Your Linux server suddenly reports:
No space left on device
Updates fail.
Applications stop writing data.
A database may refuse to start.
Logs stop recording.
The immediate temptation is:
“Find something big and delete it.”
That can be dangerous.
The better approach is:
identify the full filesystem → locate what is consuming it → understand why → clean it up safely → prevent it happening again.
Two of the most useful Linux tools for that investigation are:
du — reports disk usage for files and directories
ncdu — provides an interactive terminal view of disk usage
But before using either of them, start somewhere else.
Start With df, Not du
First establish which filesystem is actually full.
Run:
df -hT
For example:
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda2 ext4 80G 74G 2.1G 98% /
/dev/sdb1 ext4 500G 210G 265G 45% /srv/data
Here:
/ is almost full
while:
/srv/data has plenty of space.
That distinction matters.
Scanning /srv/data will not explain why the root filesystem is at 98%.
To check one filesystem:
df -h /
or:
df -h /var
Think of the tools like this:
df tells you which filesystem has the problem.
du tells you where its visible files are consuming space.
Check Inodes Too
A filesystem can report plenty of free gigabytes and still refuse to create files.
That can happen when it has run out of inodes.
Check:
df -ih
If you see something like:
IUse%
100%
the problem may be millions of tiny files rather than a few huge ones.
Common causes include:
application caches
mail queues
sessions
temporary files
monitoring data
broken cleanup jobs
Your existing article correctly identifies inode exhaustion as a separate failure mode that cannot be fixed by simply deleting one large file. (hgmssp.com)
Find the Biggest Top-Level Directories
If / is the full filesystem, start with:
sudo du -xhd1 / | sort -hr
This is one of the most useful Linux disk-space commands.
-x
Stay on the current filesystem.
GNU documents -x as --one-file-system, meaning du does not descend into directories mounted from another filesystem.
-h
Human-readable sizes.
-d1
Only show one directory level.
sort -hr
Largest entries first.
You might see:
62G /
38G /var
12G /usr
8.1G /home
2.4G /opt
Now you know where to go next.
Follow the Biggest Directory
If /var is using 38 GB:
sudo du -xhd1 /var | sort -hr
Suppose that gives:
36G /var
29G /var/log
4.8G /var/lib
1.2G /var/cache
Continue:
sudo du -xhd1 /var/log | sort -hr
This is disk-space investigation at its simplest:
start broad → identify biggest branch → move down one level → repeat.
You rarely need a giant command that analyses everything at once.
Use ncdu When You Want to Explore Interactively
ncdu is particularly useful over SSH because it gives you an interactive directory browser without needing a graphical desktop.
On Debian/Ubuntu:
sudo apt install ncdu
On Fedora and many Red Hat-derived systems:
sudo dnf install ncdu
Then scan the root filesystem:
sudo ncdu -x /
The -x option again prevents the scan from crossing filesystem boundaries. The current ncdu manual explicitly documents -x/--one-file-system for this purpose.
You can move through directories and quickly see where space is concentrated.
That makes ncdu excellent for:
exploration.
I would still be more cautious about using it for deletion.
Use ncdu to Find Things — Not Necessarily Delete Them
ncdu can allow direct deletion.
That convenience can also be dangerous.
Before removing a large item, ask:
What created it?
Is it currently in use?
Is it a database?
Is it a VM disk?
Is it a backup?
Does its application have a supported cleanup command?
On a production server, I prefer:
ncdu identifies the problem
then:
the relevant application/tool performs the cleanup.
For example:
large Docker directory
→ use Docker tools.
large systemd journal
→ use journalctl.
database storage
→ use the database's management tools.
Do not simply delete whatever is large.
Find Individual Large Files
Sometimes one file explains the entire problem.
For files larger than 1 GB on the root filesystem:
sudo find / -xdev -type f -size +1G -exec ls -lh {} \; 2>/dev/null
Possible discoveries include:
runaway logs
database dumps
forgotten ISO images
virtual disks
backup archives
core dumps
But remember:
large does not mean unnecessary.
A 40 GB database file may be exactly what you expect.
A 40 GB debug log growing by 5 GB an hour probably is not.
Logs Are Often the Symptom, Not the Cause
Suppose:
/var/log/application.log = 28 GB
The easy reaction is:
delete the log.
The better question is:
why did it become 28 GB?
Inspect recent entries:
sudo tail -100 /var/log/application.log
Watch it grow:
sudo tail -f /var/log/application.log
You might discover:
application crash loop
authentication failure every second
debug logging left enabled
broken dependency
missing log rotation
Deleting the file may reclaim space temporarily.
Fixing the cause stops it returning tomorrow.
Check the systemd Journal
On systems using systemd:
sudo journalctl --disk-usage
If the journal has become excessive, supported cleanup options include:
sudo journalctl --vacuum-time=14d
or:
sudo journalctl --vacuum-size=500M
Review the logs first.
If a server has just experienced a major failure, those logs may contain the evidence explaining why.
Docker Can Consume Huge Amounts of Space
If:
/var/lib/docker
is enormous, do not manually start deleting files inside it.
Check:
docker system df
For more detail:
docker system df -v
Then inspect:
docker ps -a
docker images
docker volume ls
Docker provides its own cleanup mechanisms, including:
docker system prune
but review what it intends to remove carefully.
The principle is the same:
let the platform manage its own data structures.
The Important Puzzle: df Says Full but du Doesn't
This is one of the best sections in your current article and definitely worth retaining.
Imagine:
df says 70 GB used
but:
du can only account for 45 GB.
That can happen for several reasons. (hgmssp.com)
The most important one is:
Deleted Files Still Open by a Process
Linux can delete a directory entry while a running process still holds the underlying file open.
That means:
du no longer sees the file
but:
the filesystem has not reclaimed its storage.
Check:
sudo lsof +L1
You might find:
java 4821 app 12w REG ... 15G /var/log/app.log (deleted)
The filename is gone.
The Java process still has 15 GB open.
Deleting more files will not solve that particular problem.
The space is released when the process closes the file.
Often that means safely:
reloading
restarting
the responsible service.
Do not restart an important production service without considering the impact.
Your current article correctly calls this out as one of the main reasons df and du can disagree. (hgmssp.com)
Mounted Filesystems Can Hide Data
Another confusing scenario:
Files were written into:
/mnt/data
Then a separate filesystem was mounted over that path.
The original files still occupy space on the underlying filesystem, but you cannot normally see them while the new filesystem is mounted over them.
Check:
findmnt /mnt/data
Inspecting the hidden underlying directory may require unmounting the filesystem.
On a production system, do not casually run:
sudo umount /mnt/data
without understanding what is using it.
That may interrupt applications.
Apparent Size and Real Disk Usage Are Different
A sparse file might report:
100G
through:
ls -lh
while:
du -h
reports only:
12G
That is not necessarily an error.
By default, GNU du measures allocated filesystem space, whereas --apparent-size reports the logical size visible to applications. Sparse files can therefore appear much larger than the physical storage they currently consume.
Compare:
du -h large-file
with:
du -h --apparent-size large-file
This matters with:
virtual disks
databases
sparse images
For a filesystem-full investigation, the allocated size is usually the more useful figure.
du Is an Estimate, Not Absolute Storage Truth
GNU itself warns that du may not exactly describe underlying physical storage use on filesystems involving:
compression
copy-on-write
deduplication
shared blocks
network filesystems.
So do not assume:
du totals must equal df exactly.
Use both tools to answer different questions.
Package Caches Can Be Safe Wins
For Debian/Ubuntu:
sudo apt clean
To remove automatically installed packages no longer required:
sudo apt autoremove
Review the proposed removal list.
For Fedora:
sudo dnf clean all
Again, the advantage here is that you are using the package manager's supported cleanup mechanism rather than manually removing files from package-management directories.
Don't Randomly Delete From /var/lib
A large:
/var/lib
is not permission to clean it manually.
It may contain active data belonging to:
MySQL
PostgreSQL
Docker
package managers
applications
monitoring platforms
Similarly, avoid blindly deleting from:
/boot
/etc
/usr
/lib
A full filesystem is bad.
A full filesystem plus a damaged application or unbootable server is worse.
A Better Disk-Space Investigation Workflow
When a Linux server is filling up, use this sequence:
1. Check the affected filesystem:
df -hT
2. Check inode exhaustion:
df -ih
3. Scan the top level without crossing mounts:
sudo du -xhd1 / | sort -hr
4. Follow the largest directory:
sudo du -xhd1 /var | sort -hr
5. Use interactive investigation if useful:
sudo ncdu -x /
6. Find unusually large files:
sudo find / -xdev -type f -size +1G -exec ls -lh {} \;
7. If df and du disagree:
sudo lsof +L1
8. Check logs, containers, package caches and application data.
9. Clean up using the application's supported management tools.
10. Recheck:
df -h
11. Fix the reason the disk filled.
That final step is the most important.
Prevent the Next Disk-Space Emergency
Once space has been recovered, ask why the warning arrived so late.
Consider:
storage monitoring
alert thresholds
log rotation
backup retention
journal limits
container cleanup
application retention policies
capacity planning
A server running at:
98% disk utilisation
should ideally have generated an alert long before an employee noticed something had stopped working.
The goal is not to become extremely good at emergency du commands.
It is to need them less often.
How Hamilton Group Can Help
Hamilton Group can help businesses diagnose and prevent Linux storage problems involving:
Linux servers
full filesystems
du and ncdu
log growth
Docker
database storage
backup retention
server monitoring
capacity planning
disk-space alerts
For production systems, we can identify not just what is large, but why it became large and how to stop it happening again.
Visit hgmssp.com or call 01423 438 953.
0 comments
- Be the first to comment.