The
Sparse file allocation is really fast but leads to fragmentation, the
FastAllocate is faster than
Full Pre-Write but still to slow.
So I was digging around it and found about the Instant File Initialization (IFI) used by SQL Server and how they implement it.
The Win32 call consists in:
-
CreateFile, using Normal file attribute, don't use sparse here
-
SetFilePointerEx, lets walk virtually to the position we want, let's say 20GB
-
SetEndOfFile, just set that the file ends here (similar to sparse until here)
-
SetFileValidData, the magic happens here, just pass the same 20GB
But there is two catchs:
1 - need admin rights...
2 - need to enable the
SeManageVolumePrivilege privilege
Found a working implementation here:
https://stackoverflow.com/a/76854526/459583
I did try it in C# and it did work good, allocated 100GB in less than one second, checked the file in Defraggler and it has only one fragment.
So, is there any chance that this could be implemented in Tixati? If no, is there any way the file allocation be transferred to some
shell command?
Thanks for the great app!