File fragmentation

Rob Bosch robbosch at
Sat Aug 19 17:16:10 GMT 2006


I was looking at this a little on the MSDN site and found this information
setfilevaliddata.asp).  It mentions here that all files have a "File Size",
"Allocation Size", as well as valid data length.  It isn't clear, however,
how functions such as the copy "grab" the right amount of space for the
copied file (copied files are usually less fragmented if large enough free
blocks exist).  I'm not sure if it is a call to create, then move the
pointer, then set end of file...seems convoluted.  I wonder how the copy
feature does it.

Not sure if this helps at all or not.  I couldn't find anything else in the
create file functions that allow a parameter to define the file size.


-----Original Message-----
From: hashproduct at [mailto:hashproduct at] On Behalf Of Matt
Sent: Monday, August 14, 2006 5:33 PM
To: Rob Bosch
Cc: rsync at
Subject: Re: File fragmentation

On 8/13/06, Rob Bosch <robbosch at> wrote:
> Is this something that should be implemented at the rsync level or cygwin
> level?  It would seem that is the opportunity to "pre-allocate" is
> it would be useful to make sure space is available for the new file.

Only rsync knows how much data it plans to write, so rsync would have
to make some sort of call to provide the eventual file size.  I don't
know anything about the Windows call for preallocating space or
whether it is available through Cygwin.  If I get a chance, I will try
to find out.


More information about the rsync mailing list