Apple - What are the sector sizes on Mac OS X?

In terminal, you can use diskutil to get information about the drive, including the device block size:

$ diskutil info / | grep "Block Size"
  Device Block Size:        512 Bytes

First, note that Device Block Size is different from the block size in use by the filesystem. The former value as reported by diskutil refers to the raw block size used by the hardware. I haven't found an easy way to check the latter value by the command line, but you can just create a zero-byte file then do Get Info from the Finder. It will say 0 bytes, but 4k used on disk.

Second, you can create an HFS+ filesystem with larger than 4k block sizes using the command line program newfs_hfs. The easiest way is to use Disk Utility to partition the drive and create a partition with the default formatting, then use /bin/df to determine the block device (an example only: /dev/disk0s2). Then unmount that partition (using umount /dev/diskXXX or Disk Utility), and to reformat as HFS+ with 64k blocks do:

newfs_hfs -v VolumeName -b 65536 /dev/disk0s2

Use the Get Info tip above to verify that a small file now occupies 64k on disk (it may say 65k for powers-of-10 units).

Performance is the main reason you might want to do this, if most of the data to be stored are large files (such as MP3s, photo, video, .zip files, etc), and it also helps with keeping disk fragmentation low. Obviously don't bother if you plan on storing mostly small files.

I have found that on large drives (> 1 TB) formatted as HFS with the default 4k block size, when the drive nears capacity, write performance degrades terribly. I'm guessing that is due to the partition being fragmented and having to hunt and peck for free blocks in order to write out the last 1% of data. I'm hoping that larger block sizes will alleviate this problem somewhat.


The OS X device block size can be determined by executing the following command from a Terminal window prompt:

diskutil info / | grep "Block Size"

Which will output the following information:

Device Block Size: 512 Bytes

The file system block size can be determined by using the stat utility:

stat -f %k .

Which will show you the Optimal file system I/O operation block size in bytes:

4096