MacOS – How to fix “512 bytes per sector” to “4096 bytes per sector” for an “Advanced Format” 4K sector USB hard drive

hard drivehfs+macos

Mac OS X 10.7.4 has a Sharkoon Quickdeck Pro USB enclosure attached. That USB enclosure contains a 4TB Advanced Format hard drive which has 4096 bytes (4K) sector size. The drive is GPT/GUID partitioned.

When listing the properties os the drive, it is being seen as "512 bytes per sector":

$ diskutil info W | grep -E 'Total Size:|Volume Free Space:|Device Block Size:'
   Total Size:               4.0 TB (4000787022336 Bytes) (exactly 7814037153 512-Byte-Blocks)
   Volume Free Space:        4.0 TB (4000772390912 Bytes) (exactly 7814008576 512-Byte-Blocks)
   Device Block Size:        512 Bytes

Or when formatting the disk with newfs_hfs the drive is being seen as "512b sector size".

$ sudo newfs_hfs -N -J /dev/disk3s1
7814037153 sectors (512 bytes per sector)
HFS Plus format parameters:
    volume name: "untitled"
    block-size: 8192
    total blocks: 488377322
    journal-size: 311296k
    first free catalog node id: 16
    catalog b-tree node size: 8192
    initial catalog file size: 354418688
    extents b-tree node size: 4096
    initial extents file size: 16777216
    attributes b-tree node size: 8192
    initial attributes file size: 354418688
    initial allocation file size: 61054976 (7453 blocks)
    data fork clump size: 65536
    resource fork clump size: 65536

How to make/force OS X to recognize Advanced Format 4K sector size drives as 4096 bytes per sector using command line tools

or

which USB drive/enclosure natively supports 4K sectors on OS X?

PS When reading the source code of newfs_hfs the sectorSize value seems to be derived from this function call ioctl(fso, DKIOCBLKSIZE, &dip.sectorSize)

Best Answer

You may have a non-issue that you're worrying about. I have experienced this with several "enclosured" hard drives. The enclosure manufacturers want to sell more units, so they have developed their devices for the lowest common denominator--often Windows XP and USB.

The newer hard drive mechanisms utilize 4k blocks for better performance and media utilization. "Most" newer systems can directly talk to drives with the 4k interface. Unfortunately, I would assume these "most newer systems" represent less than 20% of the total market.

The enclosures manufacturers write and build the hardware/software interfaces between the native mechanism and the computer. This interface translates the eight 512-byte USB calls to single 4k SATA commands, aligning the USB blocks so they don't break the 4k boundaries.

new_hfs is reporting the USB controller's capabilities.