From: jqb AT netcom DOT com (Jim Balter) Subject: Re: du does not find all directories 6 Feb 1997 23:47:46 -0800 Approved: cygnus DOT gnu-win32 AT cygnus DOT com Distribution: cygnus Message-ID: <32FAA900.7507.cygnus.gnu-win32@netcom.com> References: <199702061635 DOT KAA19917 AT utig DOT ig DOT utexas DOT edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 3.01Gold (WinNT; I) Original-To: Scott Kempf Original-CC: gnu-win32 AT cygnus DOT com Original-Sender: owner-gnu-win32 AT cygnus DOT com Scott Kempf wrote: > > >I find that du finds 335637 (presumably times 512) Bytes on my hard drive. > > On my win95 system, the conversion is 2K not 512. st_blocks is supposed to contain the number of 512-byte blocks (because that's what a block meant when st_blocks was invented by BSD; st_blksize is the filesystem's block (cluster, on Windows) size, which is a different beast, thus the confusion; st_blocks is *not* supposed to be in terms of st_blksize), but cygwin sets st_blocks to the number of 1024-byte blocks. So ld and ls divide st_blocks by 2, making them appear to report the number of 2048-byte blocks. fhandler.c should be fixed to report 512-byte blocks, but as a stopgap you can fudge the ST_NBLOCKS macro in usersrc/fileutils/system.h to assume 1024-byte blocks like is done for HP-UX, or to ignore st_blocks and just use st_size (the difference is that st_blocks is supposed to include filesystem overhead, such as unix indirect blocks, and exclude "sparse" blocks), and then rebuild ls and du. Is there any sort of mechanism for reporting such specific bugs and fixes, or do we just hope that someone at cygnus notices and makes the change? > Find a large file and do: > > ls -l large_file > du -s large_file > > This usually helps (unless it's sparse :-). Sparse files are reported properly only on unix systems that support st_blocks, but FAT (and, AFAIK, NTFS) does not have the notion of sparse files (files with all-zero blocks that don't take any space because the block number in the blocklist is 0). -- - For help on using this list, send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".