NTFS fragmentation

Vladimir Dergachev vdergachev@rcgardis.com
Wed Aug 2 22:33:00 GMT 2006


Hi all, 

       I have encountered a rather puzzling fragmentation that occurs when 
writing files using Cygwin. 

       What happens is that if one creates a new file and writes data to it
(whether via a command line redirect or with a Tcl script - have not tried C 
yet) the file ends up heavily fragmented. 

       In contrast, native Windows utilities do not exhibit this issue.

       Someone suggested to me that Windows requires an expected file length 
to be passed at the time of open, thus I searched on Google and 
found "fsutil" program that allows to reserve space on the filesystem.

       I attached a small Tcl script that, when run, creates two 30 MB files - 
one using regular open/write pair (and which is fragmented into about 300 
pieces on my system) and one using fsutil/open in append mode/seek 0 method.

      To see the problem defragment your system, run the test script and then 
run analyze and ask to view report. You will see a.dat at top of the list, 
while b.dat never appears in the report. 

       Despite the workaround, it is still kinda hard for me to believe that 
anyone has designed a filesystem that needs to know what is the file size 
going to be - especially for a single program writing on an almost empty 
disk. Perhaps there is some sort of environment variable that I need to set ?

        Any suggestions and comments would be greatly appreciated.        
Please CC me - I am not on the list.

                           thank you very much

                                        Vladimir Dergachev

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ntfs_test.tcl
Type: text/x-tcl
Size: 1099 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20060802/20913b62/attachment.bin>
-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


More information about the Cygwin mailing list