Windows – How to get the physical sector size of a drive that doesn’t have any recognized volumes

advanced-formathard drivewindows

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?

Best Answer

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.

Related Question