Files in Windows and related sectors

Is there a way to guarantee that a file in Windows (using the NTFS file system) will use contiguous sectors on the hard drive? In other words, the first fragment of the file will be saved in a certain sector, the second fragment of the file will be saved in the next sector, etc.

I must add that I want to be able to create this file programmatically, so I would rather not just ask the user to defragment his hard drive after creating this file. If there is a way to programmatically defragment only the file that I am creating, then this will also be OK.

+4
source share
3 answers

I do not know such guarantees.

But also keep in mind that NTFS files consist of several data streams. So you are really looking for a way to guarantee continuity of flow .

+1
source

I believe that this cannot be achieved. You can only defragment a file after writing it.

0
source

Source: https://habr.com/ru/post/1276634/


All Articles