#!/bin/sh # slogthedog.sh - Detect ZFS pools missing SLOGs and offer to add one. # Because sometimes the sync log needs a good boy. clear cat << "EOF" __ __ /o \_ <___/---' 🐢 SLOG THE DOG v1.0 ------------------------------- Fetching sync logs since 2025 EOF echo "" echo "πŸ” Scanning ZFS pools for missing SLOGs..." for pool in $(zpool list -H -o name); do if ! zpool status "$pool" | grep -q 'logs'; then echo "πŸ›‘ Pool '$pool' has no SLOG." echo -n "Do you want to add a SLOG device to this pool? [y/N]: " read answer if [ "$answer" = "y" ] || [ "$answer" = "Y" ]; then echo "" echo "🐾 Available GPT-capable drives:" gpart show | grep "GPT" | awk '{print $1}' | sort -u echo -n "πŸ‘‰ Enter device name to use (e.g. nvd0 or nvme0n1): " read dev echo "" echo "🧼 Prepping /dev/$dev..." gpart destroy -F /dev/$dev >/dev/null 2>&1 gpart create -s GPT /dev/$dev gpart add -t freebsd-zfs -l slog_${pool} -s 16G /dev/$dev echo "βž• Adding /dev/gpt/slog_${pool} as log device to $pool..." zpool add "$pool" log /dev/gpt/slog_${pool} echo "βœ… SLOG added to pool '$pool' using /dev/gpt/slog_${pool}" echo "" else echo "❌ Skipping pool '$pool'" fi else echo "βœ… Pool '$pool' already has a SLOG." fi done echo "" echo "🏁 Done. Slog the Dog is waggin’ his tail. All pools checked."