On Mon, Jun 13, 2011 at 5:50 AM, Roy Sigurd Karlsbakk <r...@karlsbakk.net> 
wrote:
>> If anyone has any ideas be it ZFS based or any useful scripts that
>> could help here, I am all ears.
>
> Something like this one-liner will show what would be allocated by everything 
> if hardlinks weren't used:
>
> # size=0; for i in `find . -type f -exec du {} \; | awk '{ print $1 }'`; do 
> size=$(( $size + $i )); done; echo $size

Oh, you don't want to do that: you'll run into max argument list size issues.

Try this instead:

(echo 0; find . -type f \! -links 1 | xargs stat -c " %b %B *+" $p; echo p) | dc

;)

xargs is your friend (and so is dc... RPN FTW!).  Note that I'm not
printing the number of links because find will print a name for every
link (well, if you do the find from the root of the relevant
filesystem), so we'd be counting too much space.

You'll need the GNU stat(1).  Or you could do something like this
using the ksh stat builtin:

(
echo 0
find . -type f \! -links 1 | while read p; do
    xargs stat -c " %b %B *+" $p
done
echo p
) | dc

Nico
--
_______________________________________________
zfs-discuss mailing list
zfs-discuss@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/zfs-discuss

Reply via email to