How I want storage systems to handle disk block sizes
What I mean by a storage system here is anything that exports what look like disks through some mechanism, whether that's iSCSI, AoE, FibreChannel, a directly attached smart controller of some sort, or something I haven't heard of. As I mentioned last entry, I have some developing opinions on how these things should handle the current minefield of logical and physical block sizes.
First off, modern storage systems have no excuse for not knowing about logical block size versus physical block size. The world is no longer a simple place where all disks can be assumed to have 512 byte physical sectors and you're done. So the basic behavior is to pass through the logical and physical block sizes of the underlying disk that you're exporting. If you're exporting something aggregated together from multiple disks, you should obviously advertise the largest block size used by any part of the underlying storage.
(If the system has complex multi-layered storage it should try hard to propagate all of this information up through the layers.)
You should also provide the ability to explicitly configure what logical and physical block sizes a particular piece of storage advertises. You should allow physical block sizes to be varied up and down from their true value and for logical block sizes to be varied up (and down if you support making that work). It may not be obvious why people need all of this, so let me mention some scenarios:
- you may want to bump the physical block size of all your storage to
4kb regardless of the actual disks used so that your filesystems
et al will be ready and optimal when you start replacing your
current 512 byte disks with 4kb disks. (Possibly) wasting a bit
of space now beats copying terabytes of data later.
- similarly you may be replacing 512 byte disks with 4kb disks (because
they're all that you can get) but your systems really don't deal well
with this so you want to lie to them about it. There are other related
scenarios that I'll leave to your imagination.
- you may want to set a 4 kb logical sector size to see how your software copes with it in various ways. Sometime in the future setting it will also be a future-proofing step (just as setting a 4 kb physical block size is today).
It would be handy if storage systems had both global and per-whatever settings for these. Global settings are both easier and less error prone for certain things; with a global setting, for example, I can make sure that I never accidentally advertise a disk as having 512 byte physical sectors.
(Why this now matters very much is the subject for a future entry.)