WG: cp command - problem with sparse [sparse file suuport under NTFS (Win2k)]
Wed Feb 2 12:24:00 GMT 2005
[Please don't CC me, send everything just to the ML]
On Feb 2 11:29, RE wrote:
> Hi Corinna,
> Eric Blake send me a mail with a reference to your post
> 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?
That's something which has to be debugged. Erik, your call. The question
is, does cp use lseek to skip over 128K of 0-bits and then simply writes
further? What Cygwin does is this, basically:
did_lseek = true;
if (current_position > actual_length)
if (filesystem supports sparse
AND current_position >= actual_length + (128 * 1024))
If make_file_sparse doesn't work, the strace will have an entry along
the lines of
0 = DeviceIoControl(1234, FSCTL_SET_SPARSE, ...
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader mailto:firstname.lastname@example.org
Red Hat, Inc.
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
More information about the Cygwin