How can I determine the sector size on an external hard drive?

15

5

Hard drives are transitioning from 512 byte to 4096 byte sector sizes, and it looks like Windows XP won't support these newer drives without additional software (such as WDalign from Western Digital)

My question is: how does this affect external hard drives? I'll be buying a 1TB USB external drive, and it'll be plugged into a mix of Windows 7 and XP machines. Is there an easy way to tell what the sector size on an external hard drive is?

sigint

Posted 2010-03-17T00:12:18.777

Reputation: 325

1

Please note that hard drive sector size != filesystem allocation unit (a.k.a "cluster") size as reported by the OS. NTFS, for example uses 4kB-sized allocation units but (on old HDDs) these are made up of 8 HDD sectors. http://en.wikipedia.org/wiki/Allocation_unit

– sigint – 2010-03-17T08:49:45.340

2

There is more information and, I think, a better answer over on Stack Overflow to the question How can i determine the sector size in windows. The suggestion there is to use the command fsutil fsinfo ntfsinfo <volume pathname>

– irrational John – 2013-09-14T23:11:15.790

Answers

12

Run wmic partition get BlockSize, StartingOffset, Name, Index from a Windows Command Prompt. The output looks like:

BlockSize  Index  Name                   StartingOffset
512        0      Disk #0, Partition #0  1048576
512        1      Disk #0, Partition #1  105906176
512        0      Disk #1, Partition #0  32256

Where block size is the drive's sector size. It unfortunately doesn't list the drive letter.

Also as I understand the article, the drive will still list that it has 512 byte sectors even though internally it uses 4kb sectors. So the only way may be to get the drive's spec sheet.

shf301

Posted 2010-03-17T00:12:18.777

Reputation: 7 582

1The HDD may indeed misreport blocksize to the OS. However, if I try this on Win7 (which supports 4k sectors), it ought to report the correct blocksize. At least that way I can put a "don't use this on XP without WDAlign" sticker on the external hard drive.

Any fellow commenters with 4k-sector drives, please chime in with your experiences. Thanks! – sigint – 2010-03-18T17:11:17.493

This answer is wrong. wmic partition tells you something about the partition, not the drive, and it returns 512 even when the drive presents itself to the host computer with 4096 bytes per logical sector or when the drive has 4096 bytes per physical sector. – balazer – 2020-01-05T00:47:31.267

2

The reason why this actually does not work is explained in this answer over on Stack Overflow. The blocksize reported by that wmic command is apparently the logical sector size and may not agree with the physical sector size of the drive. The suggestion on SO was to use the fsutil command.

– irrational John – 2013-09-14T23:17:09.737

8

I just verified this with WMIC on my windows XP box. This is the query:

C:\>wmic DISKDRIVE get bytespersector, caption  
BytesPerSector  Caption  
512             WDC WD1600AAJS-60M0A0  
4096            TrekStor HDD USB Device

The newer Toshiba external disk is reported as 4096 bytes.

milind110

Posted 2010-03-17T00:12:18.777

Reputation: 81

wmic DISKDRIVE get bytespersector tells you the logical sector size as presented to the host computer. The physical sector size can be different. – balazer – 2020-01-05T00:52:31.967

2

I know that you dont use linux, but just for the record:

smartctl -i /dev/...

shows

Sector Size:      512 bytes logical/physical

Eun

Posted 2010-03-17T00:12:18.777

Reputation: 1 723

1

You can do this via a command prompt. Open up CMD (Windows+r then type cmd) and run chkdsk driveletter: chkdsk c: It will be listed as x bytes in each allocation unit.

alt text

Unfundednut

Posted 2010-03-17T00:12:18.777

Reputation: 6 650

2I believe this talks about the file system, not the disk itself. – Joey – 2010-03-17T13:58:55.617

This helped me get the info I wanted. Thank you. – dimitarvp – 2016-10-21T15:35:52.127

another way to get block size is save an empty text file, right click, view properties, and note the "size on disk" value (windows typically defaults to 4k) – nothingisnecessary – 2017-01-06T23:14:36.903

Allocation units are not related to the sector size, other than an allocation unit has to contain X sectors. It's the cluster size which is something Windows filesystems support to prevent the MFT/FAT from being too large relative to the actual data you want to store on the device. You'll see 4k allocation unit on 512-byte sector disks everywhere. – LawrenceC – 2019-12-09T14:52:13.917

1

Windows XP works just fine with modern drives that have 4096 bytes per physical sector. The main issue is that a drive with 4096 bytes per physical sector and 512 bytes per logical sector (512-byte emulation or "512e") will perform sub-optimally if the partitions aren't aligned with physical sectors. Windows XP's built-in partitioning tools don't do the proper alignment for these modern drives. To partition a drive with proper alignment, do the partitioning in a newer operating system, or using a modern 3rd-party tool or a tool provided by the hard drive vendor. This is advised regardless of whether the drive uses 512 or 4096 bytes per physical sector.

You can check the alignment of existing partitions using msinfo32 (Windows XP and later):

  • msinfo32.exe > Components > Storage > Disks > Partition Starting Offset (make sure it's a multiple of the physical sector size, or a multiple of 1,048,576 bytes for SSDs)

There are three different sector sizes of concern: a drive's physical sector size, a drive's logical sector size, and the logical sector size presented to the host computer. The logical sector size presented to the host computer can be different from a drive's logical sector size if the drive is connected via a bridge that does sector size translation. External USB drives often do translation from 512 bytes per logical sector at the SATA interface with the drive inside the enclosure to 4096 bytes per logical sector at the USB interface with the host computer. This translation enables Windows XP to use more than 2 TB of a drive.

fsutil in Windows 10 can tell you a drive's physical sector size and the logical sector size presented to the host computer:

C:> fsutil fsinfo sectorInfo c:
LogicalBytesPerSector :                                 512
PhysicalBytesPerSectorForAtomicity :                    4096
PhysicalBytesPerSectorForPerformance :                  4096
FileSystemEffectivePhysicalBytesPerSectorForAtomicity : 4096
Device Alignment :                                      Aligned (0x000)
Partition alignment on device :                         Aligned (0x000)

To get the logical & physical sector sizes of a SATA drive behind a USB bridge, you can pass a SMART query through the bridge to the SATA drive using smartctl (included in the GSmartControl package for Windows):

C:\Program Files\GSmartControl> smartctl -a -d sat pd11
smartctl 6.5 2016-05-07 r4318 [i686-w64-mingw32-xp-sp3] (sf-6.5-1)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Western Digital Green
...
Sector Sizes:     512 bytes logical, 4096 bytes physical

None of Windows XP's built-in tools can get the physical sector size of a drive. You need to use smartctl or a similar tool to query the drive.

To get the logical sector size of a drive as presented to the host computer:

  • msinfo32.exe > Components > Storage > Disks > Bytes/Sector. (works in Windows XP and later)
  • wmic DISKDRIVE get bytespersector, caption (Works in Windows XP only)
  • fsutil fsinfo ntfsinfo c: ("Bytes per sector". Works in Windows XP and later)
  • fsutil fsinfo sectorInfo c: ("LogicalBytesPerSector". Works in Windows 10 and later)

Many external USB Western Digital drives over 2 TB can be configured for Windows XP compatibility by changing the logical sector size presented to the host computer.

balazer

Posted 2010-03-17T00:12:18.777

Reputation: 86

-1

Your physical HDD will have a physical sector size defined by manufacturer (512 or 4096 on newer storage), and then on top of that your file system creates a logical sector size.

If the two are not aligned, you will have read, modify, writes from two blocks if the data you are modifying spans two blocks.

For SSDs, altough they logically work the same way on data access, I believe their physical sectors are 1024 (due to flash memory), therefore you will need to algn the partition accordingly, Align=1024.

Some Guy

Posted 2010-03-17T00:12:18.777

Reputation: 1

2This does not really address the author's question. – Ramhound – 2012-08-29T17:05:39.343