SUMMARY: Discrepancies between "df" and "du" outputs

From: Loris Serena (loris.serena_at_bt.com)
Date: 11/30/05

  • Next message: Charles Gagnon: "Solaris x86 on Dell Desktops"
    To: "'sunmanagers@sunmanagers.org'" <sunmanagers@sunmanagers.org>
    Date: Wed, 30 Nov 2005 14:42:30 -0000
    
    

    Thank you to all who replied (too many to mention)

    >From the FAQ:

    Subject: 5.10) Where is my disk space? The "du" and "df" commands
    disagree.

       If a process is holding open a file, and that file is removed, the space
       belonging to the file is not freed until the process either exits or
       closes the file. This space is counted by "df" but not by "du". This
       often happens in /var/log or /var/adm when a long-running process (e.g.
       syslog) is holding open a file. In the case of syslog, send it a HUP
       (e.g. kill -HUP <syslog's process ID>).

       You can use LSOF
    (ftp://ftp.cerias.purdue.edu/pub/tools/unix/sysutils/lsof
    <ftp://ftp.cerias.purdue.edu/pub/tools/unix/sysutils/lsof> )
       to find which processes are holding open a particular file.

       Thanks to Stefan Voss <s dot voss at terradata.de> and
            Michael R. Zika <zika at oconto dot tamu dot edu>

       Under Solaris 2.6 and later, files which have been unlinked can
       still be accessed through the /proc interface. If a process is
       holding open such a file for writing, but it's inconvenient or
       impractical to kill the process or get it to close the file, you can
       free up the disk space by truncating (not removing) the file from
       under /proc; e.g.,

            # cd /proc/1234/fd
            # ls -l
            c--------- 1 root 24, 12 Jan 1 11:33 0
            c--------- 1 root 24, 12 Jan 1 11:33 1
            c--------- 1 root 24, 12 Jan 1 11:33 2
            --w------- 1 root 314159265 Jan 1 11:37 3
            # : > 3
            # ls -l
            c--------- 1 root 24, 12 Jan 1 11:33 0
            c--------- 1 root 24, 12 Jan 1 11:33 1
            c--------- 1 root 24, 12 Jan 1 11:33 2
            --w------- 1 root 0 Jan 1 11:38 3

       Thanks to Dan Astoorian <djast at cs dot toronto dot edu>

       Brian Poole <raj at cerias dot purdue dot edu> writes:

               Another possible cause of df & du disagreeing is if the files are
               being 'hidden' under a mount. I ran into this recently where I
               had a large number of files in /tmp (from adding patches in
    single
               user mode) that were on the root partition. Thus when I was
               looking for them in multiuser mode, I couldn't find them because
               of the tmpfs overlay. I exported the root partition via NFS and
               upon mounting it found the hidden files and deleted them.

    > -----Original Message-----
    > From: Loris Serena
    > Sent: 30 November 2005 12:54
    > To: sunmanagers@sunmanagers.org
    > Subject: Discrepancies between "df" and "du" outputs
    >
    > Hello Managers,
    >
    > On a Production V240 running Solaris 9 I came across the following:
    >
    >
    > [itl-app2]/app1$ df
    > <snip>
    > /dev/md/dsk/d116 7.0G 6.4G 555M 93% /app1
    >
    > [itl-app2]/app1$ du -sk .
    > 1432714 .
    >
    > Am I missing something here or is there a reason why df reports 6.4Gb
    > while du only reports 1.4Gb?
    > And more important, how do I get those missing 5Gb back in df?
    >
    > Thanks in advance for your help
    >
    > Loris
    >
    >
    >
    >
    >
    >
    BT Communications Ireland Limited
    is a wholly owned subsidiary of BT Group plc
    Registered in Ireland, Registration No. 141524
    Grand Canal Plaza, Upper Grand Canal Street, Dublin, Ireland

    This electronic message contains information (and may contain files) from BT
    Communications Ireland Limited which may be privileged or confidential. The
    information is intended to be for the sole use of the individual(s) or
    entity named above. If you are not the intended recipient be aware that any
    disclosure, copying, distribution or use of the contents of this information
    and or files is prohibited. If you have received this electronic message in
    error, please notify us by telephone or email (to the numbers or address
    above) immediately. http://www.btireland.ie
    _______________________________________________
    sunmanagers mailing list
    sunmanagers@sunmanagers.org
    http://www.sunmanagers.org/mailman/listinfo/sunmanagers


  • Next message: Charles Gagnon: "Solaris x86 on Dell Desktops"

    Relevant Pages

    • Discrepancies between "df" and "du" outputs
      ... Am I missing something here or is there a reason why df reports 6.4Gb while ... how do I get those missing 5Gb back in df? ... Grand Canal Plaza, Upper Grand Canal Street, Dublin, Ireland ... If you are not the intended recipient be aware that any ...
      (SunManagers)
    • SUMMARY: ! bad user in /var/cron/log
      ... the password for the user ldap has been set before the issue appeared. ... $ grep passwd /etc/nsswitch.conf ... This electronic message contains information from BT ... If you are not the intended recipient be aware that any ...
      (SunManagers)
    • SUMMARY: Remove files/directories whose name start with a dash
      ... I ended up with one file and one directory whose filename begins with a dash ... Grand Canal Plaza, Upper Grand Canal Street, Dublin, Ireland ... This electronic message contains information from ... If you are not the intended recipient be aware that any ...
      (SunManagers)
    • SUMMARY: cron job output to BOTH email AND log file.
      ... The "tee" command is the way to go and the following is what does what I ... Grand Canal Plaza, Upper Grand Canal Street, Dublin, Ireland ... This electronic message contains information from ... If you are not the intended recipient be aware that any ...
      (SunManagers)
    • SUMMARY: telnet in script.
      ... Subject: telnet in script. ... >> Grand Canal Plaza, Upper Grand Canal Street, Dublin, Ireland ... If you are not the intended recipient be ... > This electronic message contains information (and may contain ...
      (SunManagers)