This is the mail archive of the
mailing list for the Cygwin project.
Re: WG: cp command - problem with sparse [sparse file suuport under NTFS (Win2k)]
- From: Corinna Vinschen <corinna-cygwin at cygwin dot com>
- To: cygwin at cygwin dot com
- Cc: RE <eicher_und_bergmann at yahoo dot de>
- Date: Wed, 2 Feb 2005 12:21:02 +0100
- Subject: Re: WG: cp command - problem with sparse [sparse file suuport under NTFS (Win2k)]
- References: <EGECIPGBMFENJDOHIEMIMEMMCBAA.firstname.lastname@example.org>
- Reply-to: cygwin at cygwin dot com
[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:email@example.com
Red Hat, Inc.
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html