du vs. df
Ray Shwake
shwake at raysnec.UUCP
Thu Nov 22 04:08:32 AEST 1990
pjh at mccc.uucp (Pete Holsberg) writes:
>From TFM, it appears to me that "df <filesystem>" and "du -s
><filesystem>" should give complementary reports, the first giving the
>number of 512 byte blocks remaining in <filesystem> and the latter, the
>number used. On a 3B2/400 running SVR3.1.2, they don't. "du -s /usr2"
>reports 1049 blocks used. "df -t /usr2" reports 108424 free, 117404
>total, or 8980 blocks used. The only files that exist in /usr2 are
>directory files.
While complementary in some respects, du and df will not provide
complementary results since they source their information in
different fashion. (Note: what follows is based on the System III
and System V boxes with which I'm familiar.)
'df' pulls its information from the superblocks. "df -t" shows
the total block size of the file system, *including* space allocated
to the boot block, superblock, etc. which, by definition are not
available (not free) for user use.
'du', on the other hand, looks at the space consumed by the files
and directories themselves. Some implementations will double-count
the space consumed by linked files, others will not.
More information about the Comp.unix.questions
mailing list