The short answer is bytes, not sectors. But the sector size influences the allocation block size.
The size of an allocation block is a power of two bytes, and must be at least as large as the logical sector size as reported by the drive. The default allocation block size depends on the total size of the volume. The constraint is that we only have 32 bits to store allocation block numbers, so allocation block size needs to be large enough that when multiplied by 2^32 is greater than or equal to the total volume size.
For volumes in the gigabyte range, the default allocation block size is 4KiB. As you get to terabytes and larger, we start to increase the default allocation block size. I think it was in Mountain Lion that we adjusted the algorithm used by newfs_hfs to determine the default allocation block size. We wanted to pick an allocation block size such that the volume could still grow its total size without running out of allocation blocks (so that if the user had partitioned a large drive, and then decided to merge the partitions, we could simply grow the file system and continue to use the same allocation block size). Off hand, I'm not positive about that growth factor; I think it was 4X.
There's another wrinkle. Some drives report different physical and logical sector sizes. The common example is a hard disk that reports its logical sector size as 512 bytes, but actually uses 4096 bytes per sector internally. They can optionally report their physical sector size. If they do, we try to make sure the allocation block size is at least as large as that physical size (up to 4KiB) so that file content and metadata are conveniently aligned on physical sector boundaries.
Hope that helps.
-Mark On Mar 15, 2013, at 9:59 AM, Chris Murphy < email@hidden> wrote: Is the default HFSJ/X allocation block size defined as 4KB, or as 8 sectors?
I'm wondering if 4Kn allocation blocks will remain 4KB (1 sector), or become 32KB (8 sectors).
Do not post admin requests to the list. They will be ignored.
Filesystem-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
|