This feature introduced in Solaris 11 SRU 30 is really an interesting one. It’s nothing you should really need often because usually ZFS will do the right thing when it works with your disk devices. However there are devices that “lie” about their block sizes, for example telling the world they are 512 sector devices, but in reality they would prefer writes and reads aligned to different boundaries. Those devices did and do this for a reason, as 512 Byte boundaries is still the baseline everyone can work with.
There was a way around this problem before: You could edit the sd.conf
, force a different block size, however this was something you had to do on each system where you plan to create zpools and you had to this for each disk drive type you have in use as the sd.conf
configuration was done based on the inquiry string.
With the new optional parameter called allocunit
you can control the ashift/code> value which in turn "controls" the alignment of the the blocks. You can set this when creating a pool and it doesn't depend on the configuration in the
sd.conf
file.
Let’s try this with blocks aligned to 512 Byte blocks:
Let’s try this out with 4096. One of the usual alignments prefered by flash devices.
And now with 8129 Byte alignments, another prefered alignment by other flash devices.
If you set a value that isn’t a power of 2, then the system will give you an error message: