filesyst. full: where are the files?

Marius Gedminas marius at pov.lt
Tue Aug 27 11:15:15 UTC 2013


On Tue, Aug 27, 2013 at 12:51:37PM +0200, oxy wrote:
> Hi gurus,
> 
> `df` shows 1.1T used on partition /
> but doing `du` i come up with ~240G.
> Where is the rest?
> 
> Here some code:  (comments start with ...)
> 
> # df -h
> /dev/md5        1.3T  1.1T  204G  84% /
> 
> # du -hs /home/usr1
> 1004G	/home/usr1
> 
> # du -s /home/usr1/* | awk '{ sum+=$1} END {print sum}'
> 238316748   ... it means 238G

BTW you can use du -c to produce a grand total.  Less typing than awk,
and also you can ask for human-friendly units:

  du -cs /home/usr1/*

> ... so maybe there are monster files in the $HOME/.* hidden dirs.
> ... Lets see:
> 
> # du -hs /home/usr1/.*
> 1004G	/home/usr1/.
> 27G	/home/usr1/..
> 
> ... Cannot see the hidden files ... trying harder...
> 
> # ls -d /home/usr1/.*
> ... this shows all hidden files. Thus
> 
> # du -hs `ls -d /home/usr1/.*`
> 1004G	/home/usr1/./
> 27G	/home/usr1/../
> 
> ... where are the hidden files now? du supresses them.

Perhaps du notices that it already counted everything under ./, so it
suppresses duplicates.

Try this:

  $ mkdir -p /tmp/foo/bar /tmp/baz
  $ du -s /tmp/foo /tmp/foo/bar /tmp/baz
  8	/tmp/foo
  4	/tmp/baz

What you want to do is list all hidden files *except* '.' and '..'.
Actually, let's take one step back: you want to list all files in
/home/usr1, including hidden files, but excluding '.' and '..'.  One
possible way to do that is

  du -hs $(ls -A /home/usr1)

> ... If i go a second level inside the $HOME/.* hidden dirs
> ... it works, but combersome:
> 
> # du -s `ls -d /home/usr1/.*/*` 2>/dev/null |grep -v '/home/usr1/./' | \
> grep -v '/home/usr1/../' | awk '{sum+=$1} END {print sum}'
> 405432
> 
> ... the above result means 405MB. So I still have ~860G
> ... to reach the above mentioned 1.1T used space. Whats wrong?

Hard to say.  Something must be going wrong with the way you're invoking
du or summing the results.


Good tools for finding where all your disk space is gone are
baobab/kfilelight (GUI tools, apt-get installable) or
https://github.com/mgedmin/webtreemap-du

Marius Gedminas
-- 
Writing setattr hooks properly is a black art. Writing persistent
setattr hooks is more like hearding bees blindfolded...
	-- Casey Duncan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: Digital signature
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20130827/f6912f22/attachment.sig>


More information about the ubuntu-users mailing list