Why the result of linux commands "df" and "du" are different after deleting file?
Applies to
- ONTAP 9
- NFS
Answer
du
walks through the target and counts the space usage of each object- The target can be a directory, subdirectory, file, or the entire filesystem
df
queries the filesystem for the current space usage
Additional Information
- When objects are deleted, they are unlinked from the filesystem
- Unlinked objects take up space until their blocks are reclaimed, but the objects are no longer reported to clients
du
will report space usage as if the blocks have been reclaimeddf
will slowly show changes in space usage as the blocks of the deleted object(s) are reclaimed