如何查看特定文件的碎片?

发布于 2024-09-01 08:02:53 字数 69 浏览 2 评论 0原文

有没有一种工具可以向我显示磁盘上的特定文件,它的碎片程度如何? (如果我要以线性方式读取该文件,物理磁盘需要进行多少次查找)

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)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

携余温的黄昏 2024-09-08 08:02:53

Sysinternals 工具 contig 与参数 -a可以对文件夹及其子文件夹中的一个文件或所有文件执行此操作。

The Sysinternals tool contig with parameter -a can do this for a file or all files in a folder and its subfolders.

停顿的约定 2024-09-08 08:02:53

您可以使用 DeviceIoControl FSCTL_GET_VOLUME_BITMAPFSCTL_GET_RETRIEVAL_POINTERSFSCTL_MOVE_FILE,请参阅 对文件进行碎片整理

如果您搜索 FSCTL_MOVE_FILE,您还可以找到不同的代码示例。
这是 C 另一个位于 .NET 中。

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.

清风夜微凉 2024-09-08 08:02:53

如果您使用 Linux,filefrag 就是您正在寻找的工具。
使用 -v 参数和文件名来获取碎片的详细列表。
http://linux.die.net/man/8/filefrag

filefrag is the tool you're looking for, if you're using Linux.
Use -v parameter with filename to get detailed list of fragmentation.
http://linux.die.net/man/8/filefrag

七颜 2024-09-08 08:02:53

当然,“碎片”是值得怀疑的:

  1. 文件可能在同一个柱面中是碎片。没有寻道开销,只有旋转延迟。或者不是,因为这些部分可能是最佳顺序(这一个的机会接近于零)。
  2. 文件可能是“连续的”,但跨越多个柱面。即使按顺序读取也会导致查找。
  3. 该文件可能位于条带集上,并且您不知道边界在哪里。您可以跳到同一驱动器上的另一个控制器、另一个主轴或另一个分区。

小心你得出的结论。

And, of course, "fragmentation" is suspect:

  1. The file may be in pieces in the same cylinder. No seek overhead, just rotational latency. Or not as the pieces may be an optimal order (chances are near zero for this one).
  2. The file may be "contiguous" but across several cylinders. Even reading sequentially will result in seeks.
  3. The file may be on a stripe set and you have no idea where the boundaries are. You may skip to another controller, another spindle, or another partition on the same drive.

Be careful about what conclusions you draw.

过潦 2024-09-08 08:02:53

fsutil file queryallocranges offset=长度= 将显示您需要管理员权限的文件范围。

fsutil file queryallocranges offset=<o> length=<l> <file> will show you the file's extents you will need admin rights.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文