Be careful with du

Recently, I was little bit surprised by the output of du command. It turned out that size of a directory can vary, heavily, depending on the filesystem that is used for storing files. I was examining the size of application at different locations and what struck me were the differences in size reports.

# at pfs
> du -s -h directory
16G	directory

# at afs
> du -s -h directory
6.3G    directory

# at tmpfs
> du -s -h directory
6.4G    directory

# how much space does it really take
> tar cf - directory | dd of=/dev/null bs=1M
...
6.7 GB copied, 23.1807 s, 291 MB/s