How to create 1G zeroed sparse file in windows?

Solution 1:

FSUtil File CreateNew temp 0x100000
FSUtil Sparse SetFlag temp
FSUtil Sparse SetRange temp 0 0x100000

Solution 2:

May be this will help you: "SparseChecker" - manages sparse files on Windows NTFS It allows to operate with files, not with individual blocks of files as "fsutil" does.

Solution 3:

What @Mehrdad said is correct.

However, whatever you write to the file (even ranges of zero) would be considered data to the operating system (and thus space allocated) and only FSCTL_SET_ZERO_DATA() would allow non-space occupying zeros to be written.

fsutil sparse setflag [file]

would allow a file to be set as sparse file.