getting to 4K disk blocks in ZFS

Darren Pilgrim list_freebsd at bluerosetech.com
Mon Oct 13 18:48:40 UTC 2014


On 9/10/2014 6:22 PM, Steven Hartland wrote:
> From: "Aristedes Maniatis" <ari at ish.com.au>
>> Should the FreeBSD project change this minimum in the next release?
>> There seems to be no downside and a huge amount of pain for people
>> who stumble along with the defaults not knowing what a mess they are
>> creating to solve later.
>
> The downside is wasted space which can be significant and hence when
> I last suggested just this it was unfortunately rejected.

I always found that justification rather weak.

If the default is 512b and you use 4k disks, you kill performance, 
create a massive headache of a correction task, and prevent ZFS from 
doing its data integrity assurance.

If the default is 4k and (for the limited time they're still common) you 
use true 512b disks, you can waste space.  Sure, but how much space?  I 
nerd-sniped myself, and calculated it against my own systems:

On my own Maildir (literally everything except spam since 1999):

Average size of files modulo 4096: 3137
Total files: 2651888

ashift=12 would add 512 B slack per file--about 2.5% of the set's 54 GB 
on-disk size.  Maildirs are historically one of the worst cases for 
slack.  The worst case of an extra 3584 B slack per file would be 17.6%. 
  A 25% slack allowance is typically what I use for planning IMAP 
storage requirements, so we're not even out of bounds.

On the Samba server at work, which holds roughly two decades of office 
documents and other "human" files:

Average size of files modulo 4096: 1260
Total files: 351892

Here, ashift=12 would add 2.5 kB slack per file--about 0.26% of the 
set's 350 GB on-disk size.  The worst case would be 0.36% slack.

In other words, it likely doesn't matter except in specific cases where 
you're already worrying about effective disk usage.


More information about the freebsd-stable mailing list