[comp.unix.questions] SUMMARY: finding disk usage of partitions

rbunten@miclon.uucp (Rob Bunten) (08/11/90)

Thanks for the responses to my original request for the disk usage of
directories, not including stuff mounted from other partitions. The responses
were from:

xie@math.arizona.edu
    suggested using df(1) :-)

dietrich@cernvax.cern.ch
    sent a program which is used to determine the number of files and
    directories and the occupied disk space in a file hierarchy beginning at
    startdirectory. I have the source, but haven't managed to get it to run on
    SunOS.

meissner@osf.org
    mentions that the gnu fileutils 1.3 package contains a du rewrite that adds
    a -f option to prevent du from crossing filesystem boundaries.

tmdg@ti.co.uk
    has a program that reports file fragmentation that could possibly be
    adapted.

eirik@elf.tn.cornell.edu
    suggested the following (this is what I used):

    Apparently you want a way to tell du not to cross mount points; if
    not, I am probably answering a different question than the one you
    asked.  It also sounds like you are ignoring all but local partitions.
     
    Assuming you have root permissions on the machine with the disks,
    there is a way of doing what you want.  It is, in a sense, cheating,
    but I'd rather cheat than lose.  :-)
      
    Here's the idea: export all file systems you're interested in to
    localhost, and mount them via NFS.  As an example, the following shows
    the usage in my root partition:
       
    exportfs -i -o root=localhost,access=localhost /
    mount -n localhost:/ /mnt
    du /mnt
    mount -f localhost:/ /mnt
    umount /mnt

chip@chinacat.unicom.com
    has written a du reimplementation. It is more oriented towards the SysV
    world, but it might be usable.

paul@ixi-limited.co.uk
    suggests:

    find / -fstype nfs -prune -o -type f -exec du -s {} \; | \
    awk ' { total = total + $1 } END { print total }'

    However, this doesn't do quite what I wanted, as I wanted the totals for
    each directory.

Sorry for the delay in summarizing (the original posting was on 4th July).