Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Wed, 2 Feb 2005 12:21:02 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Cc: RE Subject: Re: WG: cp command - problem with sparse [sparse file suuport under NTFS (Win2k)] Message-ID: <20050202112102.GI7084@cygbert.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com, RE References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2i [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 > <41FF88C8 DOT 5060604 AT byu DOT net> > > 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: On lseek: did_lseek = true; On write: if (did_lseek) if (current_position > actual_length) if (filesystem supports sparse AND current_position >= actual_length + (128 * 1024)) make_file_sparse If make_file_sparse doesn't work, the strace will have an entry along the lines of 0 = DeviceIoControl(1234, FSCTL_SET_SPARSE, ... Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader mailto:cygwin AT cygwin DOT com Red Hat, Inc. -- 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/