DF-4895 / setup_vinum.sh
#!/bin/sh # DF-4895 PoC setup (guest, root) # # RAID-5 vinum volume on 2 md (malloc) drives with 3 subdisks: # s0 on drive d1 (/dev/md0s0) # s1 on drive d2 (/dev/md1s0) at driveoffset 0 # s2 on drive d2 (/dev/md1s0) at driveoffset 4361s # stripesize 16k = 32 sectors, 3 subdisks => stripe group i covers volume # sectors [i*64,(i+1)*64); parity ordinal = 2 - (i % 3), so 2 of every 3 # groups keep their parity block on d2 and every group keeps >=1 data block # on d2. Every 32KB write is a normal read-modify-write (first phase reads, # second phase writes via complete_raid5_write()). kldload vinum >/dev/null 2>&1 for u in 0 1; do mdconfig -d -u $u >/dev/null 2>&1 mdconfig -a -t malloc -s 12m -u $u >/dev/null 2>&1 dd if=/dev/zero of=/dev/md${u} bs=1m count=12 >/dev/null 2>&1 gpt create -f md${u} >/dev/null 2>&1 gpt add -t vinum -s 16384 md${u} >/dev/null 2>&1 done printf "drive d1 device /dev/md0s0\n" > /tmp/vc.txt printf "drive d2 device /dev/md1s0\n" >> /tmp/vc.txt printf "volume rv\n" >> /tmp/vc.txt printf " plex org raid5 16k\n" >> /tmp/vc.txt printf " sd length 2m drive d1\n" >> /tmp/vc.txt printf " sd length 2m drive d2\n" >> /tmp/vc.txt printf " sd length 2m driveoffset 4361s drive d2\n" >> /tmp/vc.txt vinum create -f /tmp/vc.txt >/dev/null 2>&1 for o in rv.p0.s0 rv.p0.s1 rv.p0.s2 rv.p0 rv; do vinum setstate -f up $o >/dev/null 2>&1 done sleep 1 echo "== initial state ==" vinum list | tr -d '\r' | grep -E "^D |^V |^P |^S " # sanity: single 32KB roundtrip with everything up dd if=/dev/zero bs=512 count=64 2>/dev/null | tr '\0' '\165' > /tmp/sanity dd of=/dev/vinum/vol/rv bs=32768 seek=2 count=1 if=/tmp/sanity 2>/dev/null dd if=/dev/vinum/vol/rv bs=32768 skip=2 count=1 of=/tmp/sanity_out 2>/dev/null cmp -s /tmp/sanity /tmp/sanity_out && echo "SANITY: 32KB roundtrip OK" || echo "SANITY: FAILED" |