#!/bin/sh
# DF-4482 PoC setup: 2 md drives w/ GPT vinum partitions + mirrored vinum volume
kldload vinum >/dev/null 2>&1
# create two vinum-typed GPT partitions on md0/md1
for u in 0 1; do
  dd if=/dev/zero of=/dev/md${u} bs=512 count=2 >/dev/null 2>&1
  gpt create -f md${u} >/dev/null 2>&1
  gpt add -t vinum -s 8192 md${u} >/dev/null 2>&1
done
printf "drive d1 device /dev/md0s0\ndrive d2 device /dev/md1s0\nvolume vol\n plex org concat\n  sd length 3m drive d1\n plex org concat\n  sd length 3m drive d2\n" > /tmp/vc.txt
vinum create -f /tmp/vc.txt >/dev/null 2>&1
vinum setstate stale vol.p1.s0 >/dev/null 2>&1
vinum list | tr -d "\r" | grep -E "^V |^P |^S "
