FreeBSD ZFS Compression – How to Determine Real File Size

dufindfreebsdlszfs

I'm using zfs on my FreeBSD 9.0 x64 and pretty happy with it, but I find it hard to count directory real, not compressed, size.

Surely I can walk over the directory and count every file size with ls, but I'd expect some extra key for du for that purpose.

So, how can I tell the directory size for dir placed on zfs with compression on?

Thamk you in advance for the advice, I simple can't rememeber there is no such a 'simple' way, without 'find ./ -type d -exec ls -l '{}' \; | awk …'!

Best Answer

Use the du with its -A flag:

root@pg78:/usr/local/pgsql/data/base/218204 # du -A -h 221350.219
1.0G    221350.219
root@pg78:/usr/local/pgsql/data/base/218204 # du -h 221350.219
501M    221350.219

Very handy. It even works with -d for recursive goodness:

root@pg78:/usr/local/pgsql/data/base # du -h -c -d0 .
387G    .
387G    total
root@pg78:/usr/local/pgsql/data/base # du  -A -h -c -d0 .
518G    .
518G    total