zpool with gpt partitions on 4K disks

Hi all

I'd like to set up a server with 8 3TB disks as a zfs storage pool. Currently I am testing the setup in VMware, as the hardware is not finished yet. I'd like to use GPT labeled partitions for the zpool.

First I initialized the storage disks with GPT (da0 contains the OS partitions):
# gpart create -s GPT /dev/da1
...
# gpart create -s GPT /dev/da8

Then I created 4K aligned partitions on all drives
# gpart add -t freebsd-zfs -a 4k -l storage1 /dev/da1
...
# gpart add -t freebsd-zfs -a 4k -l storage8 /dev/da8

If I now create a zpool like so
# zpool create tank mirror gpt/storage1 gpt/storage2

it seems the partitions are not 4k aligned after all
# zdb | grep ashift
ashift: 9


Am I doing anything wrong?

If I additionally use gnop
# gnop -S 4096 /dev/gpt/storage1

and then create the pool with
# zpool create tank mirror gpt/storage1.nop gpt/storage2.nop

I get an ashift of 12.
But why is that necessary? Or should I ignore ashift? Or may this be a problem only in VMware?

Thanks in advance for any insights, I'd like to understand what is going on.
Herbert
 
The 4k alignment does not change the apparent block size of the disk, it will still be 512 bytes/sector if the drive reports it like that. That's why you have to use the gnop(8) trick to create a virtual disk device with 4096 byte sectors and create the pool using the .nop device(s).
 
Back
Top