Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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 manpages.ubuntu.com/manpages/lucid/man1/fsview.1.html Also, take a look here: superuser.com/questions/9847/… –  Mihai Todor Aug 1 '12 at 18:40
add comment

2 Answers

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
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

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.