Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Creating 4k-aligned FreeBSD slices with headroom
gpart create -s GPT ada1
gpart create -s GPT ada2
gpart create -s GPT ada3
# find out the sector count of each of these disks
dmesg | grep ada | grep sectors
# OK, 3,907,029,168 512-byte sectors per disk.
# make a bunch of disks that use up a little bit less space than max
# in case I need to replace one of these drives with slightly fewer sectors
gpart add -b 2048 -s 3906824301 -t freebsd-zfs -l power ada1
gpart add -b 2048 -s 3906824301 -t freebsd-zfs -l wisdom ada2
gpart add -b 2048 -s 3906824301 -t freebsd-zfs -l courage ada3
gnop create -S 4096 gpt/power
gnop create -S 4096 gpt/wisdom
gnop create -S 4096 gpt/courage
zpool create triforce raidz gpt/power.nop gpt/wisdom.nop gpt/courage.nop
zdb | grep ashift # verify ashift is 12 for a 4K-aligned disk
# kick out the 4k-alignment struts
zpool export triforce
gnop destroy gpt/power.nop gpt/wisdom.nop gpt/courage.nop
# -d: look in /dev/gpt (to keep labels)
zpool import -d /dev/gpt triforce
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.