Enforce 4k sectors in FreeBSD

Software

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 \
    /dev/diskid/DISK-yyyyyyyyyyyyyy.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

Me!

Ruben Schade is a technical writer and infrastructure architect in Sydney, Australia who refers to himself in the third person. Hi!

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

If you found this post helpful or entertaining, you can shout me a coffee or send a comment. Thanks ☺️.