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

apple.stackexchange https://apple.stackexchange.com/questions/57249

  •  17-12-2020
  •  | 
  •  

Question

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)

Was it helpful?

Solution

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.

OTHER TIPS

I had this same issue. I finally resolved it by connecting to the drive using eSATA instead of USB or Firewire. My USB/FW enclosure has an eSATA port on the back, and I connected to that instead of USB. Bypassing the USB circuit in the external enclosure allowed Mac Disk Utility to directly recognize the WD30EZRX 3.0 TB drive, and to partition it correctly to that size.

Luckily I have an older Macbook Pro with and Express/34 slot and an eSATA adapter for that. I don't know how we are going fix this with newer MacBooks. Perhaps newer USB interfaces can correctly represent the Advanced Format sector info.

There are several possible explanations for what you are seeing:


1. Diskutil is reporting incorrect information

On my system, I have a Western Digital Black 750 plugged into the sata port previously occupied by my super drive

I documented the install here:
https://spuder.wordpress.com/2011/02/17/hard-drive-upgrade/

Even though my advanced format drive has 4k sectors, the Block Size reports 512 Bytes. Since a Block is a collection of sectors, It would seem that my sector size is 512, and my block size is also 512.

spuders-MacBook-Pro:~ spuder$ diskutil info /dev/disk0| grep -E "Total Size:|Device Block Size:"
   Total Size:               750.2 GB (750156374016 Bytes) (exactly 1465149168 512-Byte-Blocks)
   Device Block Size:        512 Bytes 

However further investigation casts doubt on the output of diskutil

According to this website ( How to get HFS+ filesystem blocksize ), You can query the block size using the stat command.

Spuders-MacBook-Pro:~ spuder$ stat -f "%k" ~/.ssh/id_rsa.pub 
4096

4096 seems more like it.

So one possible solution is that diskutil simply can't be trusted.

It would be great if some other people could compare the output of their diskutil.


2. The usb enclosure does not support 4k sectors

This is the more likely answer.

If a hard drive enclosure supports 4k, it is likely to brag about it.

Here is an enclosure which people have reported working with 4k http://www.amazon.com/StarTech-com-3-5-Inch-Removable-Enclosure-S352U2RER/dp/B002GWQ4IW

This could easily be tested by someone who has access to a 4k drive, and an enclosure that is known to support 4k.


3. The drive is mis-reporting the sector size

According to this wiki, drives are not guaranteed to report the correct sector size

Unfortunately, some HDD manufacturers do not properly respond to the device inquiry sizes. ... The problem is that some HDDs misrepresent 4KB sector disks as having a physical sector size of 512 bytes.

http://wiki.illumos.org/plugins/viewsource/viewpagesrc.action?pageId=1147716

Additional Resources
http://pressf1.pcworld.co.nz/showthread.php?110190-4K-Sector-HDD-in-an-external-enclosure

Licensed under: CC-BY-SA with attribution
Not affiliated with apple.stackexchange
scroll top