Files in /

Esa Karkkainen freebsd.lists at
Tue Dec 4 20:13:17 UTC 2018

On Tue, Dec 04, 2018 at 08:40:18AM -0500, Robert Huff wrote:
> 	And - if you're trying to track down what's gobbling disk space -
> try this, aimed at the suspect directory:
> 	du -k | sort -n -r | head -n 25

I'm using a variation of that

du -axk / | sort -rn 

Which I usually redirect to a file, so I don't need to run the same
command again and again.

But I digress, the command will list every directory and file within
the / filesystem, Each directory will contain sum of the files within,
for example

# du -axk / | sort -rn | head -2
1860504	/
1761543	/boot
# df -k /
Filesystem 1024-blocks    Used     Avail Capacity  Mounted on
tank/root    180339052 1860536 178478516     1%    /

So df show usage of 1 860 536 KiB and df shows 1 860 504 KiB, difference
of 32 KiB, the numbers will not match exactly. In this case there is a
0.000018% difference between disk usage shown by df and du.

Second largest directory is /boot, sum of the file sizes within /boot
directory is 1 761 543 KiB.

The "du -axk" keeps du within one filesystem, so it will not wander to
other filesystems like /proc, possibly /var, if it is a separate
filesystem etc.

The "sort -rn" sorts the lines, using the first column, sort order is
largest to smallest number.



"In the beginning the Universe was created. This has made a lot of
people very angry and been widely regarded as a bad move."
        -- Douglas Adams 1952 - 2001

More information about the freebsd-questions mailing list