Cygwin api to punch a hole into a file?

Thomas Wolff towo@towo.net
Tue Dec 5 14:40:14 GMT 2023


Am 05/12/2023 um 14:53 schrieb Corinna Vinschen via Cygwin:
> On Dec  5 07:36, Thomas Wolff via Cygwin wrote:
>>
>> Am 01.12.2023 um 12:02 schrieb Corinna Vinschen via Cygwin:
>>> On Dec  1 11:22, Cedric Blancher via Cygwin wrote:
>>>> Not all filesystems have a 128k block/stripe size, and certainly most
>>>> filesystems have smaller minimum hole sizes than 128k (e.g. 512bytes
>>>> is common, ref pathconf _PC_MIN_HOLE_SIZE).
>>> There's no _PC_MIN_HOLE_SIZE in Linux or POSIX.  In Windows, a sparse
>>> file uses chunks of 64K.  You can see this even with a file of just
>>> a single block.  Try this:
>>>
>>>     $ touch x
>>>     $ chattr +S x
>>>
>>>     $ echo 1234567890123456789012345678901234567890123456789012345678901234567890123456789 >> x
>>>     $ ls -ls x
>>>     1 -rw-r--r-- 1 corinna vinschen 80 Dec  1 11:56 x
>>>
>>>     [repeat echo and ls -ls until...]
>>>
>>>     $ echo 1234567890123456789012345678901234567890123456789012345678901234567890123456789 >> x
>>>     $ ls -ls x
>>>     1 -rw-r--r-- 1 corinna vinschen 720 Dec  1 11:56 x
>>>     $ echo 1234567890123456789012345678901234567890123456789012345678901234567890123456789 >> x
>>>     $ ls -ls x
>>>     64 -rw-r--r-- 1 corinna vinschen 800 Dec  1 11:56 x2
>>>     ^^
>>>     This
>> For me, it goes up from 1 to 4, then in steps of 4KB.
> Is that a local NTFS, did you actually call
>
>    chattr +S x
>
> after touching the file, and did you check with
>
>    lsattr x
>
> that x is actually sparse?
Ups, sorry, I was just throwing my 2p into something. Yes, on a local 
NTFS; setting chattr +s does not change it but lsattr says:
---a-------- .ls-s

So why does chattr not seem to work?
Thomas

> Corinna
>



More information about the Cygwin mailing list