bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: du feature request: option like -x to exclude bind mounts


From: Jim Meyering
Subject: Re: du feature request: option like -x to exclude bind mounts
Date: Tue, 07 Oct 2008 13:58:19 +0200

Nicholas Leippe <address@hidden> wrote:
> Currently, du -x properly excludes other filesystems that are mounted.
> But if the same filesystem is mounted again with -o bind (linux, possibly
> other oses), it still includes them in the count.
>
> An option to exclude them from the count as well would be convenient.

du's --exclude option excludes based on device number,
and two bind-mounted directories share the same device number,
it's not sensible to make --exclude do what you want.

I was going to suggest that you run "du -x some-top-dir" where
some-top-dir contains both of your bind-mounted directories,
thinking the total would reflect that one is essentially linked
to the other, ...

But that doesn't work.  The space is counted twice because du
recognizes same dev/ino pairs only when the link count (st_nlink)
is 2 or larger.  Relaxing that by removing a single line/disjunct
solves the problem at the expense of requiring significantly more
memory in the common case: one dev/ino pair is stored for every
single non-directory encountered, rather than only those with
two or more links.

This might require a new option.  I'll think about it.
If you don't hear anything in a week or two, please ping
the list.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]