Skip to content

Instantly share code, notes, and snippets.

@ianblenke
Last active December 1, 2021 11:35
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ianblenke/e97786eaa0a24abe544d6c74b8c0a294 to your computer and use it in GitHub Desktop.
Save ianblenke/e97786eaa0a24abe544d6c74b8c0a294 to your computer and use it in GitHub Desktop.
FreeBSD ZFS: Putting a ZIL mirror and an L2ARC on only 2 SSD drives
#!/bin/bash
# Based on this blog post: https://clinta.github.io/FreeNAS-Multipurpose-SSD/
set -xe
ssd1=ada2
ssd2=ada3
pool=tank
gpart create -s gpt $ssd1
gpart create -s gpt $ssd2
gpart add -a 4k -b 128 -t freebsd-zfs -s 30G $ssd1
gpart add -a 4k -b 128 -t freebsd-zfs -s 30G $ssd2
gpart add -a 4k -t freebsd-zfs $ssd1
gpart add -a 4k -t freebsd-zfs $ssd2
zil1=$(gpart list $ssd1 | grep rawuuid | head -1 | cut -c13-)
arc1=$(gpart list $ssd1 | grep rawuuid | tail -1 | cut -c13-)
zil2=$(gpart list $ssd2 | grep rawuuid | head -1 | cut -c13-)
arc2=$(gpart list $ssd2 | grep rawuuid | tail -1 | cut -c13-)
zpool add $pool log mirror gptid/$zil1 gptid/$zil2
zpool add $pool cache gptid/$arc1
zpool add $pool cache gptid/$arc2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment