WG: cp command - problem with sparse [sparse file suuport under NTFS (Win2k)]

RE eicher_und_bergmann@yahoo.de
Wed Feb 2 10:29:00 GMT 2005

-----Ursprüngliche Nachricht-----
Von: RE [mailto:eicher_und_bergmann@yahoo.de]
Gesendet: Mittwoch, 2. Februar 2005 10:40
An: corinna-cygwin@cygwin.com
Cc: 41FF88C8.5060604@byu.net
Betreff: cp command - problem with sparse [sparse file suuport under
NTFS (Win2k)]

Hi Corinna,

Eric Blake send me a mail with a reference to your post

Attached please find your post of February 1

Well, I am not a programmer but I am looking for a solution for the
following.  And I think that cp.exe from fileutils/coreutils might do the
job.  But so far I wasn't successful.

I have files on my HD that contain large amounts of zeroes (between 4 and
100 MB of zeroes) and I want to convert them into sparse files.  I already
tried the GNU fileutils with their cp command.  They say that it converts
standard files into sparse files by using the command

"cp --sparse=always c:\test.cfg c:\test2.cfg"

Everything works fine with that cp command, except the fact that I do not
get a sparse file.  Even when I copy a sparse file, the sparse attribute is
no longer present in the copy and the occupied space on my HD is the same as
with the original file.

What am I doing wrong?  Is there a bug with cp.exe?  Is the command I am
using not correct?

I tried already different PCs with NTFS (OS = Win2k SP4)

Your help and assistance would be appreciated very

Thanks and regards,


Corinna wrote:

On Feb  1 06:48, Eric Blake wrote:
> Hash: SHA1
> This question came up on the coreutils list:
> Does cygwin provide any support for sparse files on NTFS volumes that
> support it?  lseek() could be patched to use FSCTL_SET_ZERO_DATA when a
> seek jumps past the end of a file open for writing, but there is still the
> issue of when that file is given the FSCTL_SET_SPARSE attribute.

lseek already creates sparse files automatically in a write after lseek,
if the lseek seeked more than 128K beyond EOF.  128K is the value which
has been found to be the smallest sparse block size at which making
the file sparse makes a difference on XP.


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