Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using git-annex, an extension to the DVCS git, which is designed for handling large files. It makes heavy use of symlinks. The actual large files are moved to the .git/annex directory and the original files are symlinked to there.

I am running out of disk space, and need to clear up, and see what's using all my space. Usually I'd use a disk usage tool like ncdu, Baobab or Filelight. However they treat the symlink as essentially empty, and only count the file that it is pointing to as using any space. Which means when I use git-annex, it shows no space used in the main directories and lots of space used in the .git/annex directory. This is not helpful.

Is there any (graphical or ncurses) based disk usage programme for linux (apt-get installable would be easie that is capable (through options or not) of counting a symlink as using up the space that the original file uses up? Many have options for different behaviour for hard links, so makes sense that some should h

(I know counting symlinks as using space has flaws, like counting the space space twice, broken symlinks, etc. But that's OK for my purposes)

share|improve this question
Maybe it's doable with fsview Also, take a look here:… – Mihai Todor Aug 1 '12 at 18:40

GNU du has the --dereference option, which dereferences symbolic links when computing disk usage. However, du refuses to count the same space twice, which may be a deal-breaker in your situation:

% mkdir foo bar baz
% dd if=/dev/zero of=foo/test bs=1024 count=10000
10000+0 records in
10000+0 records out
10240000 bytes (10 MB) copied, 0.0176239 s, 581 MB/s
% (cd bar; ln -s ../foo/test)
% (cd baz; ln -s ../foo/test)
% du -hc bar baz
4.0K    bar
4.0K    baz
8.0K    total
% du -hc --dereference bar baz
9.8M    bar
4.0K    baz
9.8M    total

If you don't have multiple symlinks to the same target, though, I think --dereference does what you want.

share|improve this answer
You can always run dd through for, like this: for dir in foo bar; do du -hc --dereference "$dir"; done – Hubert Kario Sep 9 '12 at 15:32

git-annex has a list of related software including some git-annex aware disk usage tools - gadu and sizes.

share|improve this answer

nowadays, git-annex has its own solutions for this problem. you can use:

git annex info --fast * get actual disk usage (and more) from the files directly from git-annex. it can also operate on remote repositories, which is very useful:

git annex info --fast --not --in here .

... would give you the amount of data that is not in the current repository for example.

i have also used ncdu with this small patch with good results.

the upstream forum discussing this is "du" equivalent on an annex? and has more suggestions, like du -L, gadu and sizes that were mentionned in other answers here.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.