Hi,

thanks a lot for your quick response.

Sorry, i must have missed the -links option, that's exactly what i am
looking for.

In my case du would have counted "twice", because the other hard link is
not in the directory du is searching in.

Thanks again and thank you all for your commitment!

Benjamin

On 30.10.19 19:08, Bernhard Voelker wrote:
> On 10/30/19 5:01 PM, Benjamin Arnold wrote:
>> i was trying to determine the "real size" of a incremental backup
>> created with rsync and hardlinks. To be more specific: "how much space
>> will be freed if i delete this backup?"
>>
>> I've got it working, but in a very sloppy way.
>>
>> I wondered if it was possible and reasonable to add a feature to du or
>> find, so that one can include only files with inode counter = 1.
> 
> 'du' doesn't count twice:
> 
>   $ mkdir d1 \
>       && dd if=/dev/zero of=d1/x bs=1M count=20 status=none \
>       && cp -al d1 d2
> 
>   $ ls -lihog d1/x d2/x
>   805939 -rw-r--r-- 2 20M Oct 30 19:04 d1/x
>   805939 -rw-r--r-- 2 20M Oct 30 19:04 d2/x
> 
>   $ du -shxc d1 d2
>   21M    d1
>   4.0K    d2
>   21M    total
> 
> FWIW: find has a "-links N" option.
> 
> Does that answer your question?
> 
> Have a nice day,
> Berny

Reply via email to