如何确定哪个文件占用给定扇区?

38 hard-drive bad-sectors

我有一个有 3 个坏扇区的硬盘。我知道扇区号,计算机仍然可以启动到 Windows。我想通过制造商的硬盘诊断工具运行扇区修复,但在此之前,我想知道哪些文件受到影响。有没有办法找出哪些文件或文件占用了这些扇区?

Rob*_*ier 26

尝试 nfi.exe - Windows NT 文件系统 (NTFS) 文件扇区信息实用程序。从Microsoft OEM Support Tools Phase 3 SR2 下载

> nfi.exe
Dumps information about an NTFS volume, and optionally determines
which volume and file contains a particular sector.

Usage: nfi drive-letter [logical-sector-number]

        Drive-letter can be a single character or a character followed
        by a colon (i.e., C or C: are acceptable).

        Logical-sector-number is a decimal or 0x-prefixed hex
        number, specifying a sector number relative to the volume
        whose drive letter is given by drive-letter. If not
        specified, then information about every file on the volume
        is dumped.

   nfi NT-device-path physical-sector-number

        Determines which volume a given physical sector on a drive is
        within, and then which file on the volume it is in.

        NT-device-path is the NT-style path to a physical device.
        It must not include a partition specification.

        Physical-sector-number is a decimal or 0x-prefixed hex
        number, specifying a sector number relative to the physical
        drive whose device path is given by NT-device-path.

    nfi full-win32-path

        Dumps information about a particular file. full-win32-path
        must start with a drive letter and a colon.
Run Code Online (Sandbox Code Playgroud)

请注意,您必须省略“\\?” 块设备路径的前缀。例子:

C:\Users\admin\Downloads>nfi \Device\Harddisk0\DR0 28521816
NTFS File Sector Information Utility.
Copyright (C) Microsoft Corporation 1999. All rights reserved.


***Physical sector 28521816 (0x1b33558) is in file number 5766 on drive C.
\IMAGES\win7HDD.vhd
    $DATA (nonresident)
        physical sectors 32863720-34098663 (0x1f575e8-0x2084de7)
        physical sectors 28519912-32863719 (0x1b32de8-0x1f575e7)
        physical sectors 25727944-26291143 (0x18893c8-0x1912bc7)
        physical sectors 95163976-115106143 (0x5ac1648-0x6dc615f)
Run Code Online (Sandbox Code Playgroud)

  • 也可以在回程机器上找到https://web.archive.org/web/20150329185738/http://download.microsoft.com/download/win2000srv/utility/3.0/nt45/en-us/oem3sr2.zip (4认同)

qua*_*ote 23

这是使用WinHex的过程,这是一个方便的十六进制编辑器,可以直接检查和编辑驱动器。 要非常小心; 如果使用不当,此工具可能会损坏您的系统。尽可能以只读方式打开磁盘。

  1. 由于您已经有了坏扇区位置,您可以直接在 WinHex 中打开驱动器(“打开磁盘”工具栏按钮),然后导航到该扇区以查看数据(“转到扇区”工具栏按钮)。假设您的扇区位置是物理扇区地址,您需要在此步骤中打开您的物理驱动器。

    不会直接识别文件,但左侧窗格应识别包含该扇区的分区及其相应的相对扇区地址。

  2. 如果您确定的分区是 NTFS 或 FAT 分区,我们可以直接打开该分区(再次“打开磁盘”)。这将在新选项卡中打开分区,因此您可以根据需要来回切换。在分区选项卡中,再次使用“转到扇区”功能,但这次输入转换的扇区(驱动器视图中标识的“相对扇区”)。

    现在,在左侧窗格中,您应该会看到有关“可见驱动器空间的分配”的部分。下面是簇号、物理扇区号、逻辑(相对)扇区号和文件名(如果该扇区实际上属于一个文件)。

如果这些步骤没有立即给您答复,则您的坏扇区可能未在使用中。如果结果不清楚,您可能需要进行更多挖掘才能找到答案。


Syn*_*ech 8

大多数碎片整理程序会显示一个磁盘映射,显示磁盘上的所有集群,然后您可以单击(查找标记为的那些)以查看位于该集群中的文件。

正如 Walter 所说,过去十年左右的任何磁盘和操作系统组合都将确保自动从坏扇区重新定位文件(驱动器固件通常会处理此问题,但磁盘工具chkdsk或碎片整理程序通常也会这样做)。


碎片整理程序:

在此处输入图片说明

碎片整理文件:

在此处输入图片说明

选择:

在此处输入图片说明


Syn*_*ech 7

Sysinternals 的DiskView正是执行此功能:显示驱动器的磁盘映射,并让您查看哪些文件占用哪些集群。

不幸的是,似乎没有一种方法可以显示系统文件的名称。

DiskView 主窗口 DiskView 系统文件


Nor*_*rtM 5

您可以fsutil从管理员命令提示符使用。子命令volume有子子命令querycluster。请参阅Windows 命令行参考 Fsutil

Fsutil 将逻辑驱动器中的簇号作为输入参数,而不是扇区号。但是计算这个数字应该很容易:
cluster# = (absolute_sector - start_of_partition_sector) /sectors_per_cluster。

示例输出:

c:\tmp> fsutil volume querycluster C: 5235
Cluster 0x0000000000001473, verwendet von
 ----D \Program Filesx86)\LibreOffice 4\program\fwilo.dll::$DATA
Run Code Online (Sandbox Code Playgroud)


qua*_*ote 2

RunTime 的DiskExplorer允许您按扇区检查驱动器。它是付费软件(NTFS 版本 70 美元),但可以免费试用。它们有适用于 NTFS、FAT 和 Linux (ext2/3) 的版本。

替代文本