Enforce 4k sectors in FreeBSD


FreeBSD defaults to 512k sectors, and there’s no provision in ZFS on FreeBSD to change this. If you try the following that works on Solaris and ZFSonLinux, you’ll be told the option doesn’t exist:

# echo "Does not work on FreeBSD"
# zpool create - 

But you can use:

# gnop create -S 4096 /dev/diskid/DISK-xxxxxxxxxxxxxx

Once you’ve done that, create your zpool on it/them and export:

# zpool create [..] tank mirror \
    /dev/diskid/DISK-xxxxxxxxxxxxxx.nop \
# zpool export tank

Delete the providers, then re-import the pool.

# gnop destroy /dev/diskid/DISK-xxxxxxxxxxxxxx.nop
# gnop destroy /dev/diskid/DISK-yyyyyyyyyyyyyy.nop
# zpool import tank

Now you have the correct sector size.

Author bio and support


Ruben Schade is a technical writer and IaaS engineer in Sydney, Australia who refers to himself in the third person in bios. Wait, not BIOS… my brain should be EFI by now.

The site is powered by Hugo, FreeBSD, and OpenZFS on OrionVM, everyone’s favourite cloud infrastructure provider.

If you found this post helpful or entertaining, you can shout me a coffee or buy some silly merch. Thanks!