X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A8482385840F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1700823714; bh=/vz2hhK6InDVa2U5TFqhOB2vlDoVBu4zP7P5RQZcEU4=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=OMoQm87tW1BLXQey6hFceF+4mRMSLpmoRw6Tt9XeWj4e/UySqJCLFGBQ7CO2RNnWP 4lYfcTAk61Pt6fL4PNQ98XMv0aAYBwfvEwc3ixE+aFhUI7aBXGBC+Fjt4OA0wJJ1n+ r+in3O5ytfZvlPGz/vPycPOh65SKotXlgZhTb4zk= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1A3B73858D3C Date: Fri, 24 Nov 2023 12:01:18 +0100 To: cygwin AT cygwin DOT com Subject: Re: Cygwin api to punch a hole into a file? Message-ID: Mail-Followup-To: cygwin AT cygwin DOT com References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Corinna Vinschen via Cygwin Reply-To: cygwin AT cygwin DOT com Cc: Corinna Vinschen Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" On Nov 23 23:36, Cedric Blancher via Cygwin wrote: > Linux has fallocate(fd, FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE, ...) > to punch a hole into a file, i.e. deallocate the blocks given and make > the file a "sparse file". We don't support the Linux-specific fallocate(2) call, only ftruncate(2) and posix_fallocate(3). Patches, as usual, thoughtfully considered. > But how can I do that with the Cygwin API? Does anyone have an example > for Cygwin, which is the Win equivalent to Linux fallocate(fd, > FALLOC_FL_PUNCH_HOLE|FALLOC_FL_KEEP_SIZE, 1048576, 2097152);? > > I tried with Cygwin 3.5, but the file was not sparse after that. Do you remember the discussion in August, starting here: https://cygwin.com/pipermail/cygwin-developers/2023-August/012664.html especially: https://cygwin.com/pipermail/cygwin-developers/2023-August/012679.html So, did you set the sparse mount option per https://cygwin.com/cygwin-ug-net/using.html#mount-table ? Also, chattr -S, which is independent from the mount option "sparse": https://cygwin.com/cygwin-ug-net/chattr.html Corinna -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple