如何确定Windows中的扇区大小

sho*_*ner 47 sector hard-drive windows-7

如何在Windows 7中确定物理扇区大小(例如,如果我有一个具有4,096字节扇区的高级格式驱动器而不是传统的512字节扇区)?

我知道通过单击文件并获取属性我们可以找到NTFS 群集大小,但这与硬盘驱动器的扇区大小不同.

注意:我们询问Windows 7,因为它(和Windows Vista SP1)了解4096高级格式化硬盘的存在.

Chr*_*ler 61

你想要fsutil.确保以管理员身份运行命令提示符.

C:\Windows\system32>fsutil fsinfo ntfsinfo c:
NTFS Volume Serial Number :       0xf4ca5d7cca5d3c54
Version :                         3.1
Number Sectors :                  0x00000000378fd7ff
Total Clusters :                  0x0000000006f1faff
Free Clusters  :                  0x00000000000e8821
Total Reserved :                  0x0000000000000910
Bytes Per Sector  :               512
Bytes Per Physical Sector :       512
Bytes Per Cluster :               4096
Bytes Per FileRecord Segment    : 1024
Clusters Per FileRecord Segment : 0
Mft Valid Data Length :           0x00000000196c0000
Mft Start Lcn  :                  0x00000000000c0000
Mft2 Start Lcn :                  0x000000000097ffff
Mft Zone Start :                  0x000000000051f920
Mft Zone End   :                  0x000000000051f9a0
RM Identifier:        0652C3D3-7AA9-11DA-ACAC-C80AA9F2FF32
Run Code Online (Sandbox Code Playgroud)

  • 当属性*每个物理扇区的字节数:<不支持>*这意味着512 (6认同)

Ian*_*oyd 28

我想扩展Chris Gessler的答案,并注意到没有已知的方法可以使用Windows Management Instrumentation(WMI)获取驱动器的物理扇区,例如wmic.

鉴于我有一个高级格式驱动器(即它每个扇区使用4,096字节而不是512):

C:\Windows\system32>fsutil fsinfo ntfsinfo d:
NTFS Volume Serial Number :       0xa016d8a616d87eaa
Version :                         3.1
Number Sectors :                  0x00000000747057ff
Total Clusters :                  0x000000000e8e0aff
Free Clusters  :                  0x000000000e7b2813
Total Reserved :                  0x0000000000000000
Bytes Per Sector  :               512
Bytes Per Physical Sector :       4096
Run Code Online (Sandbox Code Playgroud)

WMI都没有DiskDrive:

wmic:root\cli>diskdrive
Availability  BytesPerSector  Capabilities  CapabilityDescriptions                                       Caption
              512             {3, 4, 10}    {"Random Access", "Supports Writing", "SMART Notification"}  ST1000DM003-9YN162 ATA Device
Run Code Online (Sandbox Code Playgroud)

也不是Partition:

wmic:root\cli>partition get BlockSize, StartingOffset, Name, Index
BlockSize  Index  Name                   StartingOffset
512        0      Disk #0, Partition #0  1048576
Run Code Online (Sandbox Code Playgroud)

可以报​​告基础物理扇区的大小.当您意识到它们都报告Windows正在使用的扇区大小时,这是有意义的.这每扇区512个字节-驱动器恰好是不同的内部.

那是因为只有Windows 8支持使用 4k扇区.Windows 7了解驱动器可能是4k,并且可以将其4k 群集与硬盘驱动器的底层4k 扇区对齐.


Gre*_*gor 27

Windows 10更新:

现在有一个sectorInfo子命令可以提供更好的信息:

C:\>fsutil fsinfo sectorInfo C:

LogicalBytesPerSector :                                 512
PhysicalBytesPerSectorForAtomicity :                    4096
PhysicalBytesPerSectorForPerformance :                  4096
FileSystemEffectivePhysicalBytesPerSectorForAtomicity : 4096
Device Alignment :                                      Aligned (0x000)
Partition alignment on device :                         Aligned (0x000)
Performs Normal Seeks
Trim Not Supported
Run Code Online (Sandbox Code Playgroud)

  • 不适用于 Windows 7 旗舰版。 (2认同)

小智 13

  1. 在命令行中运行msinfo32,该命令行应弹出名为"System Information"的GUI窗口
  2. 在左侧窗格中,选择"系统摘要 - >组件 - >存储 - >磁盘".这应该加载右窗格中所有驱动器的信息
  3. 找到所需的驱动器并检查"字节/扇区"的值.它应该说"Bytes/Sector 4096"


Ant*_*oba 9

如果您想以编程方式使用它,则需要从结构中发送IOCTL_DISK_GET_DRIVE_GEOMETRY_EX和使用Geometry.BytesPerSectorDISK_GEOMETRY_EX

  • 仅报告逻辑扇区大小.将"STORAGE_ACCESS_ALIGNMENT_DESCRIPTOR"结构从"IOCTL_STORAGE_QUERY_PROPERTY"传递到"DeviceIoControl"将获得逻辑和物理扇区大小.唯一的缺点是它不适用于外部硬盘 - "DeviceIoControl"返回`ERROR_INVALID_FUNCTION`(至少,我还没有找到一种方法使其适用于外部硬盘). (4认同)

Cyc*_*ode 6

您可以从命令行使用wmic

C:\Windows\System32\wmic partition get BlockSize, StartingOffset, Name, Index

BlockSize  Index  Name                   StartingOffset
512        0      Disk #0, Partition #0  32256
512        1      Disk #0, Partition #1  370195176960
Run Code Online (Sandbox Code Playgroud)

BlockSize是驱动器的扇区大小。

  • “BlockSize”是*逻辑*扇区大小,而不是“fsutil fsinfo ntfsinfo c:”报告的*物理大小*。来源:我有一个 4,096 AF 驱动器,fsutil 报告为 4096,`BlockSize` 报告为 512。 (6认同)

小智 5

电源外壳:

$wql = "SELECT Label, Blocksize, Name FROM Win32_Volume WHERE FileSystem='NTFS'"
Get-WmiObject -Query $wql -ComputerName '.' | Select-Object Label, Blocksize, Name
Run Code Online (Sandbox Code Playgroud)

输出示例:

Label            Blocksize Name
-----            --------- ----
OSDisk                4096 C:\
Windows RE Tools      4096 \\?\Volume{b042c778-cd66-4381-9312-3f4311321675}\
PS C:\>
Run Code Online (Sandbox Code Playgroud)