du vs. df

Arthur S. Kamlet ask at cbnews.att.com
Thu Nov 29 06:45:40 AEST 1990


In article <143 at raysnec.UUCP>, shwake at raysnec.UUCP (Ray Shwake) writes:
 > 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.
 
 
Also, du silently fails to report about unreadable directories.
-- 
Art Kamlet  a_s_kamlet at att.com  AT&T Bell Laboratories, Columbus



More information about the Comp.unix.questions mailing list