如何确定 Windows 7 中的物理扇区大小(例如,如果我有一个具有 4,096 字节扇区而不是传统 512 字节扇区的高级格式驱动器)?
我知道通过单击文件并获取属性,我们可以找到 NTFS Cluster Size,但这与硬盘驱动器的扇区大小不同。
注意:我们询问 Windows 7 是因为它(和 Windows Vista SP1)了解 4096 高级格式硬盘的存在。
如何确定 Windows 7 中的物理扇区大小(例如,如果我有一个具有 4,096 字节扇区而不是传统 512 字节扇区的高级格式驱动器)?
我知道通过单击文件并获取属性,我们可以找到 NTFS Cluster Size,但这与硬盘驱动器的扇区大小不同。
注意:我们询问 Windows 7 是因为它(和 Windows Vista SP1)了解 4096 高级格式硬盘的存在。
你想要 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
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
我想扩展 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
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
也不Partition
:
wmic:root\cli>partition get BlockSize, StartingOffset, Name, Index
BlockSize Index Name StartingOffset
512 0 Disk #0, Partition #0 1048576
可以报告底层物理扇区大小。当您意识到它们都报告 Windows 正在使用的扇区大小时,这是有道理的。每个扇区 512 字节 - 驱动器恰好在内部不同。
这是因为只有 Windows 8 支持使用4k 扇区。Windows 7 了解驱动器可能是 4k,并努力将其 4k Clusters与硬盘驱动器的底层 4k Sectors对齐。
wmic diskdrive
现在确实显示每个扇区的物理字节数Bytes per Sector
:
C:\Windows\system32>wmic
wmic:root\cli>diskdrive
Availability BytesPerSector Capabilities CapabilityDescriptions
4096 {3, 4} {"Random Access", "Supports Writing"}
虽然wmic partition
仍然是错误的。
视窗 10.0.19041.804
如果你想以编程方式拥有它,你需要从结构发送IOCTL_DISK_GET_DRIVE_GEOMETRY_EX
和使用Geometry.BytesPerSector
DISK_GEOMETRY_EX
您可以从命令行使用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
BlockSize
是驱动器的扇区大小。
电源外壳:
$wql = "SELECT Label, Blocksize, Name FROM Win32_Volume WHERE FileSystem='NTFS'"
Get-WmiObject -Query $wql -ComputerName '.' | Select-Object Label, Blocksize, Name
输出示例:
Label Blocksize Name
----- --------- ----
OSDisk 4096 C:\
Windows RE Tools 4096 \\?\Volume{b042c778-cd66-4381-9312-3f4311321675}\
PS C:\>
如果您真的想以编程方式拥有它,则需要将IOCTL_STORAGE_QUERY_PROPERTY
提供set发送STORAGE_PROPERTY_QUERY
到. 这给出了物理和逻辑扇区大小。PropertyId
StorageAccessAlignmentProperty
注意:这仅适用于 Windows Vista 及更高版本。