1153187Spjd#!/bin/sh 2153187Spjd# $FreeBSD: releng/11.0/tests/sys/geom/class/raid3/9_test.sh 293821 2016-01-13 09:14:27Z ngie $ 3153187Spjd 4153187Spjd. `dirname $0`/conf.sh 5153187Spjd 6153187Spjdecho "1..1" 7153187Spjd 8153187Spjdddbs=2048 9153187Spjdnblocks1=1024 10153187Spjdnblocks2=`expr $nblocks1 / \( $ddbs / 512 \)` 11293438Sngiesrc=`mktemp $base.XXXXXX` || exit 1 12293438Sngiedst=`mktemp $base.XXXXXX` || exit 1 13153187Spjd 14293438Sngieus0=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1 15293438Sngieus1=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1 16293438Sngieus2=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1 17293438Sngie 18153187Spjddd if=/dev/random of=${src} bs=$ddbs count=$nblocks2 >/dev/null 2>&1 19153187Spjd 20293438Sngiegraid3 label $name /dev/${us0} /dev/${us1} /dev/${us2} || exit 1 21153187Spjddevwait 22153187Spjd 23153187Spjd# 24153187Spjd# Writing without PARITY component and rebuild of PARITY component. 25153187Spjd# 26153187Spjdgraid3 remove -n 2 $name 27293438Sngiedd if=/dev/zero of=/dev/${us2} bs=512 count=`expr $nblocks1 + 1` >/dev/null 2>&1 28153187Spjddd if=${src} of=/dev/raid3/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1 29153187Spjdgraid3 insert -n 2 $name md${us2} 30153187Spjdsleep 1 31153187Spjd# Remove DATA component, so PARITY component can be used while reading. 32153187Spjdgraid3 remove -n 1 $name 33293438Sngiedd if=/dev/zero of=/dev/${us1} bs=512 count=`expr $nblocks1 + 1` >/dev/null 2>&1 34153187Spjd 35153187Spjddd if=/dev/raid3/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1 36153187Spjdif [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then 37153187Spjd echo "not ok 1" 38153187Spjdelse 39153187Spjd echo "ok 1" 40153187Spjdfi 41153187Spjd 42153187Spjdrm -f ${src} ${dst} 43