How can I get the physical sector size of a drive that doesn't have any recognized volumes?

6

1

Windows can tell me the logical and physical sector size of the drive responsible for a partition/volume via the fsutil fsinfo sectorinfo x: command (where x is my drive letter). How can I get this information for a drive that doesn't have any drive letters or volumes of any kind?

I am using Windows 8.1 Pro, but I hope an answer would work for at least Windows 7 as well.

Things I know about but that don't help

  • wmic partition get BlockSize, Name is wrong because it only gives the logical sector size and also doesn't work if there are no partitions on the drive.
  • wmic diskdrive get BytesPerSector, Name again only gives me the logical sector size, but does work on all hard drives. There doesn't appear to be a property of Win32_DiskDrive that has the physical size.
  • fsutil fsinfo ntfsinfo \\?\Volume{...}\ only works for drives with partitions, and NTFS partitions at that.
  • The sectorinfo version of the above doesn't work at all with that special volume syntax (Error: The system cannot find the path specified.).
  • System Information (msinfo32) shows only the logical bytes per sector.
  • Device Manager does not appear to list anything related to the drive geometry.

I don't want to initialize the drive or create a volume on it because that would blow away the contents that Windows isn't seeing.

I also know about IOCTL_DISK_GET_DRIVE_GEOMETRY_EX, but using that would require writing and compiling a program. Preferably without third-party tools, how can I find the physical sector size of a hard drive in Windows?

Ben N

Posted 2016-02-15T01:14:39.120

Reputation: 32 973

wmic diskdrive get BytesPerSector, Name again only gives me the logical sector size How did you determine that? This answer to a similar question shows wmic diskdrive get BytesPerSector returning 4096 for a drive in XP, while XP didn't even support 512e (4K physical / 512 logical) as far as I remember. – dxiv – 2016-02-15T02:40:04.533

@dxiv Well, it definitely gets the logical bytes per sector on my machine (512): fsutil fsinfo sectorinfo says I have 512 logical and 4K physical. Also, it's not the OS that decides the logical. – Ben N – 2016-02-15T03:18:23.657

Microsoft support policy for 4K sector hard drives in Windows: Any large-sector disks, such as 4K native, 512E, or any non-512 native disks, are not supported by Microsoft on any Windows XP-based version of the operating system. My reading of it is that wmic would never misreport a logical sector size as 4K under XP. Which only leaves the possibility for 4K to be the physical sector size in that scenario. Maybe things changed later on. Sorry, I don't have a 4K drive handy to test now. – dxiv – 2016-02-15T03:49:58.663

Answers

7

While writing this other answer, I found the solution: PowerShell! The Get-Disk cmdlet returns information about all drives currently connected, even if they're not even partitioned yet. To see info on known disks, use this command:

Get-Disk | Format-List

One of my drives (actually a mounted VHD file because I don't have a scratch drive on hand) shows up as this:

UniqueId           : 6002248038B7BF29A1D79765E555C965
Number             : 1
Path               : \\?\scsi#disk&ven_msft&prod_virtual_disk#2&<redacted>
Manufacturer       : Msft
Model              : Virtual Disk
SerialNumber       :
Size               : 100 MB
AllocatedSize      : 0
LogicalSectorSize  : 512
PhysicalSectorSize : 512
NumberOfPartitions : 0
PartitionStyle     : RAW
IsReadOnly         : False
IsSystem           : False
IsBoot             : False

Notice how the PartitionStyle is RAW - I haven't even initialized this disk yet! The PhysicalSectorSize property is the physical sector size in bytes.

The Get-PhysicalDisk cmdlet does something similar, but returns a lot more information. Both cmdlets are supported starting in Windows 8.

Ben N

Posted 2016-02-15T01:14:39.120

Reputation: 32 973

Great answer, shame it's not supported in Windows 7. – Hashim – 2018-04-23T18:22:15.667