I'm using Ubuntu Linux 14. I'm running out of disk space
[rails@server ~]$ df -h /
Filesystem Size Used Avail Use% Mounted on
/dev/simfs 30G 29G 1.5G 96% /
Is there a way to view a more detailed breakdown of what "df" is calculating for each sub-directory? Before I had been using
du -a / | sort -n -r | head -n 15
to find the top directories using space, but then I noticed that "du" is not the same as "df" and in my case, "du" was vastly underreporting how much space was being used ("du" said only 4GB of space was being used)
df
doesn't deal with directories per se. It checks on what each filesystem thinks is its usage viastatvfs
syscall.du
deals with actual files, it will tell you how much each file is supposed to occupy on disk (unless it's a sparse file). The discrepancy you see is probably due to blocks of data still being claimed on the filesystem (that is there were files, they were unlinked so there's no path to file, but application still keeps that disk space open and in use ). – Sergiy Kolodyazhnyy Nov 09 '19 at 01:35fsck
to fix the filesystem. I'd start with those two. If the issue is lots of open anonymous files ( solsof | grep -i deleted
probably ), identify what application opens those files and maybe switch to a different, less aggressive app ( though might not be easy if your business depends on it ) – Sergiy Kolodyazhnyy Nov 09 '19 at 02:30