IBM Support

Causes of mismatch between disk usage reported by df and du

Question & Answer


Question

Why does the disk usage reported by df not match du?

Cause

  1. Perhaps the most common cause is files that are still open by an application, but have been unlinked (deleted).  This may be intentional, for example an application may use this technique to create hidden scratch files; or it may be accidental, a user may delete a large file without realising that it is currently open by an application.

    Such files and their details can be listed using "fuser -dV". For example:
    # fuser -dV /u02
    /u02:
    inode=7940   size=10431209472  fd=19     8716442
    inode=7931   size=17823825920  fd=19     10354918
    inode=7936   size=12891316224  fd=18     10485994
    inode=7945   size=5706391552   fd=19     11075828


    The size is in bytes. The number in the right hand column is the process id that is holding that file open. When that process terminates, the space will be released and this will be reflected in the df output.  Since the file is deleted from the directory, it is not possible to find its name.
     
  2. If the filesystem in question has nested filesystems, it is not valid to compare df and du.  du will count the usage in the nested filesystems, and it cannot count the usage in directory trees of the parent filesystem that may be hidden under the mount points.

    It is possible to view the hidden directory structure under a mount point without unmounting the child filesystem.  One way is to use a namefs mount.  For example, say there is a filesystem /audit.  To check if there are any files hidden in the root (/) filesystem under the /audit directory:
    # mkdir -p /temproot
    # mount -v namefs -r / /temproot
    # ls -lR /temproot/audit

    Any files listed reside in the parent / filesystem.
    Remember to unmount /temproot when done.
     
  3. The filesystem may be corrupted.  In this case, unmount and run "fsck -yvv" to make it consistent
     
  4. AIX 7.2 has an enhancement to release space in the background when large files are deleted.  If very large files are deleted there can be a time lag before df reports the freed space.  This should not be noticeable unless many terabytes of files are deleted
     
  5. There were bugs in early levels of AIX 7.2 where the background release did not work under certain conditions.  In this case, unmount/remount would reflect the freed space.

    IJ09280 FREEING UP INODES SOMETIMES DOES NOT FREE UP DISK SPACE.  fixed 7.2.2.19/7.2.3.0
    IJ12633 J2GT THREAD PERFORMANCE ISSUES  fixed 7.2.3.17
    IJ18827 j2gt won't delete recently added files right away  Fixed 7.2.3.18

Answer

SUPPORT

If additional assistance is required after completing all of the instructions provided in this document, please follow the step-by-step instructions below to contact IBM to open a case for software under warranty or with an active and valid support contract.  The technical support specialist assigned to your case will confirm that you have completed these steps.

1.  Document and/or take screen shots of all symptoms, errors, and/or messages that might have occurred. 

2.  Capture any logs or data relevant to the situation.

3.  Contact IBM to open a case:

   -For electronic support, please visit the IBM Support Community:
     https://www.ibm.com/mysupport
   -If you require telephone support, please visit the web page:
      https://www.ibm.com/planetwide/

4.  Provide a good description of your issue, and reference this Technote, and any issues you had with the instructions.

5.  Collect the system snap and upload all of the details and data for your case.

To collect a complete snap of your system information:

5.1) Remove previously gathered data

   # snap -r 

5.2) Copy related files from #1 and #2 to the snap data directory

   # mkdir -p /tmp/ibmsupt/testcase
   # cp <logs, screenshots, etc> /tmp/ibmsupt/testcase

5.3) Run the snap command with one of the following options to collect all info.

     * If you have already engaged with a support engineer, use the flags specified by your support team.

   # snap -aZc (Omits system dump data)   
     OR 
   # snap -ac (Use if system dump data is needed)

5.4) Rename the testcase to include your case number to ensure it is properly attached to your case

  # mv /tmp/ibmsupt/snap.pax.Z /tmp/ibmsupt/yourcase#[.optional_description].snap.pax.Z

5.5) Upload the file by one of the following options (a, b, or c)

     a) Attach to your case
     https://www.ibm.com/mysupport/s/my-cases

     b) Upload to the Enhanced Customer Data Repository(ECuRep) 
     https://www.secure.ecurep.ibm.com/app/upload_sf

     c) Upload to the Blue Diamond FTP server (Blue Diamond Customers Only)
     https://msciportal.im-ies.ibm.com

* Note: For information about blue diamond upload see:

     http://www.ibm.com/support/docview.wss?uid=nas8N1020947

[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG10","label":"AIX"},"Component":"","Platform":[{"code":"PF002","label":"AIX"}],"Version":"All Versions","Edition":"","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}}]

Document Information

Modified date:
08 May 2020

UID

ibm10887143