Is there a tool that would show me for a specific file on disk, how fragmented it is? (How many seeks does physical disk need to make if I were to read that file in a linear fashion)
You can use DeviceIoControl
with FSCTL_GET_VOLUME_BITMAP
, FSCTL_GET_RETRIEVAL_POINTERS
and FSCTL_MOVE_FILE
, see Defragmenting Files.
You can also find different code examples if you search for FSCTL_MOVE_FILE
.
Here is one in C and another in .NET.