Re: how does "du" deal with hard links?

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

 



Robert P. J. Day wrote:
  i'm wondering if i should be surprised about something i just
noticed WRT how "du" tries to avoid [re]counting files that it's
already seen via hard links.


  if i check their disk usage individually, i get:

$ for r in git* ; do
du -s $r
done
26340   git
26292   git.local
26292   git.nolinks
$

  but if i use wildcards, notice the difference:

$ du -s git*
26340   git
9672    git.local
26292   git.nolinks
$


  i can see what's happening, i just didn't realize that that's how
"du" operated.  is that deliberate?

I guess so, since du provides the -l option which will count a file's size multiple times if it's hardlinked rather then just counting it the first time it's seen.

As you said it makes sense not to count hardlinked files more than once if you're trying to get a real estimate of disk usage. We'd get very whacky answers on some of our servers based on the number of hardlinks we sometimes use.

Simon.

--
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux