- Add a geom_raid3 specific cleanup function and trap on that function at
exit so things are cleaned up properly - Use attach_md for attaching md(4) devices - Don't hardcode /tmp for temporary files, which violates the kyua sandbox MFC after: 3 weeks Sponsored by: EMC / Isilon Storage Division
This commit is contained in:
parent
e17c940fa1
commit
ad8ebc35bb
@ -5,4 +5,11 @@ name="$(mktemp -u graid3.XXXXXX)"
|
||||
class="raid3"
|
||||
base=`basename $0`
|
||||
|
||||
graid3_test_cleanup()
|
||||
{
|
||||
[ -c /dev/$class/$name ] && graid3 stop $name
|
||||
geom_test_cleanup
|
||||
}
|
||||
trap graid3_test_cleanup ABRT EXIT INT TERM
|
||||
|
||||
. `dirname $0`/../geom_subr.sh
|
||||
|
@ -5,15 +5,11 @@
|
||||
|
||||
echo "1..2"
|
||||
|
||||
us0=45
|
||||
us1=`expr $us0 + 1`
|
||||
us2=`expr $us0 + 2`
|
||||
us0=$(attach_md -t malloc -s 1M) || exit 1
|
||||
us1=$(attach_md -t malloc -s 2M) || exit 1
|
||||
us2=$(attach_md -t malloc -s 3M) || exit 1
|
||||
|
||||
mdconfig -a -t malloc -s 1M -u $us0 || exit 1
|
||||
mdconfig -a -t malloc -s 2M -u $us1 || exit 1
|
||||
mdconfig -a -t malloc -s 3M -u $us2 || exit 1
|
||||
|
||||
graid3 label $name /dev/md${us0} /dev/md${us1} /dev/md${us2} 2>/dev/null || exit 1
|
||||
graid3 label $name /dev/${us0} /dev/${us1} /dev/${us2} 2>/dev/null || exit 1
|
||||
devwait
|
||||
|
||||
# Size of created device should be 2MB - 1024B.
|
||||
@ -30,8 +26,3 @@ if [ $sectorsize -eq 1024 ]; then
|
||||
else
|
||||
echo "not ok 2"
|
||||
fi
|
||||
|
||||
graid3 stop $name
|
||||
mdconfig -d -u $us0
|
||||
mdconfig -d -u $us1
|
||||
mdconfig -d -u $us2
|
||||
|
@ -5,22 +5,19 @@
|
||||
|
||||
echo "1..1"
|
||||
|
||||
us0=45
|
||||
us1=`expr $us0 + 1`
|
||||
us2=`expr $us0 + 2`
|
||||
ddbs=2048
|
||||
nblocks1=1024
|
||||
nblocks2=`expr $nblocks1 / \( $ddbs / 512 \)`
|
||||
src=`mktemp /tmp/$base.XXXXXX` || exit 1
|
||||
dst=`mktemp /tmp/$base.XXXXXX` || exit 1
|
||||
src=`mktemp $base.XXXXXX` || exit 1
|
||||
dst=`mktemp $base.XXXXXX` || exit 1
|
||||
|
||||
us0=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1
|
||||
us1=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1
|
||||
us2=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1
|
||||
|
||||
dd if=/dev/random of=${src} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us0 || exit 1
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1
|
||||
|
||||
graid3 label -r $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
|
||||
graid3 label -r $name /dev/${us0} /dev/${us1} /dev/${us2} || exit 1
|
||||
devwait
|
||||
|
||||
dd if=${src} of=/dev/raid3/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
@ -32,8 +29,4 @@ else
|
||||
echo "ok 1"
|
||||
fi
|
||||
|
||||
graid3 stop $name
|
||||
mdconfig -d -u $us0
|
||||
mdconfig -d -u $us1
|
||||
mdconfig -d -u $us2
|
||||
rm -f ${src} ${dst}
|
||||
|
@ -5,22 +5,19 @@
|
||||
|
||||
echo "1..1"
|
||||
|
||||
us0=45
|
||||
us1=`expr $us0 + 1`
|
||||
us2=`expr $us0 + 2`
|
||||
ddbs=2048
|
||||
nblocks1=1024
|
||||
nblocks2=`expr $nblocks1 / \( $ddbs / 512 \)`
|
||||
src=`mktemp /tmp/$base.XXXXXX` || exit 1
|
||||
dst=`mktemp /tmp/$base.XXXXXX` || exit 1
|
||||
src=`mktemp $base.XXXXXX` || exit 1
|
||||
dst=`mktemp $base.XXXXXX` || exit 1
|
||||
|
||||
us0=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1
|
||||
us1=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1
|
||||
us2=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1
|
||||
|
||||
dd if=/dev/random of=${src} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us0 || exit 1
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1
|
||||
|
||||
graid3 label -w $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
|
||||
graid3 label -w $name /dev/${us0} /dev/${us1} /dev/${us2} || exit 1
|
||||
devwait
|
||||
|
||||
dd if=${src} of=/dev/raid3/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
@ -32,8 +29,4 @@ else
|
||||
echo "ok 1"
|
||||
fi
|
||||
|
||||
graid3 stop $name
|
||||
mdconfig -d -u $us0
|
||||
mdconfig -d -u $us1
|
||||
mdconfig -d -u $us2
|
||||
rm -f ${src} ${dst}
|
||||
|
@ -5,31 +5,28 @@
|
||||
|
||||
echo "1..1"
|
||||
|
||||
us0=45
|
||||
us1=`expr $us0 + 1`
|
||||
us2=`expr $us0 + 2`
|
||||
nblocks1=9
|
||||
nblocks2=`expr $nblocks1 - 1`
|
||||
nblocks3=`expr $nblocks2 / 2`
|
||||
|
||||
mdconfig -a -t malloc -s $nblocks1 -u $us0 || exit 1
|
||||
mdconfig -a -t malloc -s $nblocks1 -u $us1 || exit 1
|
||||
mdconfig -a -t malloc -s $nblocks1 -u $us2 || exit 1
|
||||
us0=$(attach_md -t malloc -s $nblocks1) || exit 1
|
||||
us1=$(attach_md -t malloc -s $nblocks1) || exit 1
|
||||
us2=$(attach_md -t malloc -s $nblocks1) || exit 1
|
||||
|
||||
dd if=/dev/random of=/dev/md${us0} count=$nblocks1 >/dev/null 2>&1
|
||||
dd if=/dev/random of=/dev/md${us1} count=$nblocks1 >/dev/null 2>&1
|
||||
dd if=/dev/random of=/dev/md${us2} count=$nblocks1 >/dev/null 2>&1
|
||||
dd if=/dev/random of=/dev/${us0} count=$nblocks1 >/dev/null 2>&1
|
||||
dd if=/dev/random of=/dev/${us1} count=$nblocks1 >/dev/null 2>&1
|
||||
dd if=/dev/random of=/dev/${us2} count=$nblocks1 >/dev/null 2>&1
|
||||
|
||||
graid3 label -w $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
|
||||
graid3 label -w $name /dev/${us0} /dev/${us1} /dev/${us2} || exit 1
|
||||
devwait
|
||||
# Wait for synchronization.
|
||||
sleep 2
|
||||
graid3 stop $name
|
||||
# Break one component.
|
||||
dd if=/dev/random of=/dev/md${us1} count=$nblocks2 >/dev/null 2>&1
|
||||
dd if=/dev/random of=/dev/${us1} count=$nblocks2 >/dev/null 2>&1
|
||||
# Provoke retaste of the rest components.
|
||||
true > /dev/md${us0}
|
||||
true > /dev/md${us2}
|
||||
true > /dev/${us0}
|
||||
true > /dev/${us2}
|
||||
sleep 1
|
||||
|
||||
dd if=/dev/raid3/${name} of=/dev/null bs=1k count=$nblocks3 >/dev/null 2>&1
|
||||
@ -39,8 +36,3 @@ if [ $ec -eq 0 ]; then
|
||||
else
|
||||
echo "ok 1"
|
||||
fi
|
||||
|
||||
graid3 stop $name
|
||||
mdconfig -d -u $us0
|
||||
mdconfig -d -u $us1
|
||||
mdconfig -d -u $us2
|
||||
|
@ -5,22 +5,19 @@
|
||||
|
||||
echo "1..1"
|
||||
|
||||
us0=45
|
||||
us1=`expr $us0 + 1`
|
||||
us2=`expr $us0 + 2`
|
||||
ddbs=2048
|
||||
nblocks1=1024
|
||||
nblocks2=`expr $nblocks1 / \( $ddbs / 512 \)`
|
||||
src=`mktemp /tmp/$base.XXXXXX` || exit 1
|
||||
dst=`mktemp /tmp/$base.XXXXXX` || exit 1
|
||||
src=`mktemp $base.XXXXXX` || exit 1
|
||||
dst=`mktemp $base.XXXXXX` || exit 1
|
||||
|
||||
us0=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1
|
||||
us1=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1
|
||||
us2=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1
|
||||
|
||||
dd if=/dev/random of=${src} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us0 || exit 1
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1
|
||||
|
||||
graid3 label $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
|
||||
graid3 label $name /dev/${us0} /dev/${us1} /dev/${us2} || exit 1
|
||||
devwait
|
||||
|
||||
dd if=${src} of=/dev/raid3/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
@ -32,8 +29,4 @@ else
|
||||
echo "ok 1"
|
||||
fi
|
||||
|
||||
graid3 stop $name
|
||||
mdconfig -d -u $us0
|
||||
mdconfig -d -u $us1
|
||||
mdconfig -d -u $us2
|
||||
rm -f ${src} ${dst}
|
||||
|
@ -5,22 +5,19 @@
|
||||
|
||||
echo "1..1"
|
||||
|
||||
us0=45
|
||||
us1=`expr $us0 + 1`
|
||||
us2=`expr $us0 + 2`
|
||||
ddbs=2048
|
||||
nblocks1=1024
|
||||
nblocks2=`expr $nblocks1 / \( $ddbs / 512 \)`
|
||||
src=`mktemp /tmp/$base.XXXXXX` || exit 1
|
||||
dst=`mktemp /tmp/$base.XXXXXX` || exit 1
|
||||
src=`mktemp $base.XXXXXX` || exit 1
|
||||
dst=`mktemp $base.XXXXXX` || exit 1
|
||||
|
||||
us0=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1
|
||||
us1=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1
|
||||
us2=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1
|
||||
|
||||
dd if=/dev/random of=${src} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us0 || exit 1
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1
|
||||
|
||||
graid3 label $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
|
||||
graid3 label $name /dev/${us0} /dev/${us1} /dev/${us2} || exit 1
|
||||
devwait
|
||||
|
||||
dd if=${src} of=/dev/raid3/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
@ -36,8 +33,4 @@ else
|
||||
echo "ok 1"
|
||||
fi
|
||||
|
||||
graid3 stop $name
|
||||
mdconfig -d -u $us0
|
||||
mdconfig -d -u $us1
|
||||
mdconfig -d -u $us2
|
||||
rm -f ${src} ${dst}
|
||||
|
@ -5,22 +5,19 @@
|
||||
|
||||
echo "1..1"
|
||||
|
||||
us0=45
|
||||
us1=`expr $us0 + 1`
|
||||
us2=`expr $us0 + 2`
|
||||
ddbs=2048
|
||||
nblocks1=1024
|
||||
nblocks2=`expr $nblocks1 / \( $ddbs / 512 \)`
|
||||
src=`mktemp /tmp/$base.XXXXXX` || exit 1
|
||||
dst=`mktemp /tmp/$base.XXXXXX` || exit 1
|
||||
src=`mktemp $base.XXXXXX` || exit 1
|
||||
dst=`mktemp $base.XXXXXX` || exit 1
|
||||
|
||||
us0=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1
|
||||
us1=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1
|
||||
us2=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1
|
||||
|
||||
dd if=/dev/random of=${src} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us0 || exit 1
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1
|
||||
|
||||
graid3 label $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
|
||||
graid3 label $name /dev/${us0} /dev/${us1} /dev/${us2} || exit 1
|
||||
devwait
|
||||
|
||||
#
|
||||
@ -36,8 +33,4 @@ else
|
||||
echo "ok 1"
|
||||
fi
|
||||
|
||||
graid3 stop $name
|
||||
mdconfig -d -u $us0
|
||||
mdconfig -d -u $us1
|
||||
mdconfig -d -u $us2
|
||||
rm -f ${src} ${dst}
|
||||
|
@ -5,22 +5,19 @@
|
||||
|
||||
echo "1..1"
|
||||
|
||||
us0=45
|
||||
us1=`expr $us0 + 1`
|
||||
us2=`expr $us0 + 2`
|
||||
ddbs=2048
|
||||
nblocks1=1024
|
||||
nblocks2=`expr $nblocks1 / \( $ddbs / 512 \)`
|
||||
src=`mktemp /tmp/$base.XXXXXX` || exit 1
|
||||
dst=`mktemp /tmp/$base.XXXXXX` || exit 1
|
||||
src=`mktemp $base.XXXXXX` || exit 1
|
||||
dst=`mktemp $base.XXXXXX` || exit 1
|
||||
|
||||
us0=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1
|
||||
us1=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1
|
||||
us2=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1
|
||||
|
||||
dd if=/dev/random of=${src} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us0 || exit 1
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1
|
||||
|
||||
graid3 label $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
|
||||
graid3 label $name /dev/${us0} /dev/${us1} /dev/${us2} || exit 1
|
||||
devwait
|
||||
|
||||
#
|
||||
@ -36,8 +33,4 @@ else
|
||||
echo "ok 1"
|
||||
fi
|
||||
|
||||
graid3 stop $name
|
||||
mdconfig -d -u $us0
|
||||
mdconfig -d -u $us1
|
||||
mdconfig -d -u $us2
|
||||
rm -f ${src} ${dst}
|
||||
|
@ -5,22 +5,19 @@
|
||||
|
||||
echo "1..1"
|
||||
|
||||
us0=45
|
||||
us1=`expr $us0 + 1`
|
||||
us2=`expr $us0 + 2`
|
||||
ddbs=2048
|
||||
nblocks1=1024
|
||||
nblocks2=`expr $nblocks1 / \( $ddbs / 512 \)`
|
||||
src=`mktemp /tmp/$base.XXXXXX` || exit 1
|
||||
dst=`mktemp /tmp/$base.XXXXXX` || exit 1
|
||||
src=`mktemp $base.XXXXXX` || exit 1
|
||||
dst=`mktemp $base.XXXXXX` || exit 1
|
||||
|
||||
us0=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1
|
||||
us1=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1
|
||||
us2=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1
|
||||
|
||||
dd if=/dev/random of=${src} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us0 || exit 1
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1
|
||||
|
||||
graid3 label $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
|
||||
graid3 label $name /dev/${us0} /dev/${us1} /dev/${us2} || exit 1
|
||||
devwait
|
||||
|
||||
dd if=${src} of=/dev/raid3/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
@ -29,7 +26,7 @@ dd if=${src} of=/dev/raid3/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
# Rebuild of DATA component.
|
||||
#
|
||||
graid3 remove -n 1 $name
|
||||
dd if=/dev/zero of=/dev/md${us1} bs=512 count=`expr $nblocks1 + 1` >/dev/null 2>&1
|
||||
dd if=/dev/zero of=/dev/${us1} bs=512 count=`expr $nblocks1 + 1` >/dev/null 2>&1
|
||||
graid3 insert -n 1 $name md${us1}
|
||||
sleep 1
|
||||
|
||||
@ -40,8 +37,4 @@ else
|
||||
echo "ok 1"
|
||||
fi
|
||||
|
||||
graid3 stop $name
|
||||
mdconfig -d -u $us0
|
||||
mdconfig -d -u $us1
|
||||
mdconfig -d -u $us2
|
||||
rm -f ${src} ${dst}
|
||||
|
@ -5,22 +5,19 @@
|
||||
|
||||
echo "1..1"
|
||||
|
||||
us0=45
|
||||
us1=`expr $us0 + 1`
|
||||
us2=`expr $us0 + 2`
|
||||
ddbs=2048
|
||||
nblocks1=1024
|
||||
nblocks2=`expr $nblocks1 / \( $ddbs / 512 \)`
|
||||
src=`mktemp /tmp/$base.XXXXXX` || exit 1
|
||||
dst=`mktemp /tmp/$base.XXXXXX` || exit 1
|
||||
src=`mktemp $base.XXXXXX` || exit 1
|
||||
dst=`mktemp $base.XXXXXX` || exit 1
|
||||
|
||||
us0=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1
|
||||
us1=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1
|
||||
us2=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1
|
||||
|
||||
dd if=/dev/random of=${src} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us0 || exit 1
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1
|
||||
|
||||
graid3 label $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
|
||||
graid3 label $name /dev/${us0} /dev/${us1} /dev/${us2} || exit 1
|
||||
devwait
|
||||
|
||||
dd if=${src} of=/dev/raid3/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
@ -29,12 +26,12 @@ dd if=${src} of=/dev/raid3/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
# Rebuild of PARITY component.
|
||||
#
|
||||
graid3 remove -n 2 $name
|
||||
dd if=/dev/zero of=/dev/md${us2} bs=512 count=`expr $nblocks1 + 1` >/dev/null 2>&1
|
||||
dd if=/dev/zero of=/dev/${us2} bs=512 count=`expr $nblocks1 + 1` >/dev/null 2>&1
|
||||
graid3 insert -n 2 $name md${us2}
|
||||
sleep 1
|
||||
# Remove DATA component, so PARITY component can be used while reading.
|
||||
graid3 remove -n 1 $name
|
||||
dd if=/dev/zero of=/dev/md${us1} bs=512 count=`expr $nblocks1 + 1` >/dev/null 2>&1
|
||||
dd if=/dev/zero of=/dev/${us1} bs=512 count=`expr $nblocks1 + 1` >/dev/null 2>&1
|
||||
|
||||
dd if=/dev/raid3/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
|
||||
@ -43,8 +40,4 @@ else
|
||||
echo "ok 1"
|
||||
fi
|
||||
|
||||
graid3 stop $name
|
||||
mdconfig -d -u $us0
|
||||
mdconfig -d -u $us1
|
||||
mdconfig -d -u $us2
|
||||
rm -f ${src} ${dst}
|
||||
|
@ -5,29 +5,26 @@
|
||||
|
||||
echo "1..1"
|
||||
|
||||
us0=45
|
||||
us1=`expr $us0 + 1`
|
||||
us2=`expr $us0 + 2`
|
||||
ddbs=2048
|
||||
nblocks1=1024
|
||||
nblocks2=`expr $nblocks1 / \( $ddbs / 512 \)`
|
||||
src=`mktemp /tmp/$base.XXXXXX` || exit 1
|
||||
dst=`mktemp /tmp/$base.XXXXXX` || exit 1
|
||||
src=`mktemp $base.XXXXXX` || exit 1
|
||||
dst=`mktemp $base.XXXXXX` || exit 1
|
||||
|
||||
us0=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1
|
||||
us1=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1
|
||||
us2=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1
|
||||
|
||||
dd if=/dev/random of=${src} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us0 || exit 1
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1
|
||||
|
||||
graid3 label $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
|
||||
graid3 label $name /dev/${us0} /dev/${us1} /dev/${us2} || exit 1
|
||||
devwait
|
||||
|
||||
#
|
||||
# Writing without DATA component and rebuild of DATA component.
|
||||
#
|
||||
graid3 remove -n 1 $name
|
||||
dd if=/dev/zero of=/dev/md${us1} bs=512 count=`expr $nblocks1 + 1` >/dev/null 2>&1
|
||||
dd if=/dev/zero of=/dev/${us1} bs=512 count=`expr $nblocks1 + 1` >/dev/null 2>&1
|
||||
dd if=${src} of=/dev/raid3/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
graid3 insert -n 1 $name md${us1}
|
||||
sleep 1
|
||||
@ -39,8 +36,4 @@ else
|
||||
echo "ok 1"
|
||||
fi
|
||||
|
||||
graid3 stop $name
|
||||
mdconfig -d -u $us0
|
||||
mdconfig -d -u $us1
|
||||
mdconfig -d -u $us2
|
||||
rm -f ${src} ${dst}
|
||||
|
@ -5,35 +5,32 @@
|
||||
|
||||
echo "1..1"
|
||||
|
||||
us0=45
|
||||
us1=`expr $us0 + 1`
|
||||
us2=`expr $us0 + 2`
|
||||
ddbs=2048
|
||||
nblocks1=1024
|
||||
nblocks2=`expr $nblocks1 / \( $ddbs / 512 \)`
|
||||
src=`mktemp /tmp/$base.XXXXXX` || exit 1
|
||||
dst=`mktemp /tmp/$base.XXXXXX` || exit 1
|
||||
src=`mktemp $base.XXXXXX` || exit 1
|
||||
dst=`mktemp $base.XXXXXX` || exit 1
|
||||
|
||||
us0=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1
|
||||
us1=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1
|
||||
us2=$(attach_md -t malloc -s $(expr $nblocks1 + 1)) || exit 1
|
||||
|
||||
dd if=/dev/random of=${src} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us0 || exit 1
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us1 || exit 1
|
||||
mdconfig -a -t malloc -s `expr $nblocks1 + 1` -u $us2 || exit 1
|
||||
|
||||
graid3 label $name /dev/md${us0} /dev/md${us1} /dev/md${us2} || exit 1
|
||||
graid3 label $name /dev/${us0} /dev/${us1} /dev/${us2} || exit 1
|
||||
devwait
|
||||
|
||||
#
|
||||
# Writing without PARITY component and rebuild of PARITY component.
|
||||
#
|
||||
graid3 remove -n 2 $name
|
||||
dd if=/dev/zero of=/dev/md${us2} bs=512 count=`expr $nblocks1 + 1` >/dev/null 2>&1
|
||||
dd if=/dev/zero of=/dev/${us2} bs=512 count=`expr $nblocks1 + 1` >/dev/null 2>&1
|
||||
dd if=${src} of=/dev/raid3/${name} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
graid3 insert -n 2 $name md${us2}
|
||||
sleep 1
|
||||
# Remove DATA component, so PARITY component can be used while reading.
|
||||
graid3 remove -n 1 $name
|
||||
dd if=/dev/zero of=/dev/md${us1} bs=512 count=`expr $nblocks1 + 1` >/dev/null 2>&1
|
||||
dd if=/dev/zero of=/dev/${us1} bs=512 count=`expr $nblocks1 + 1` >/dev/null 2>&1
|
||||
|
||||
dd if=/dev/raid3/${name} of=${dst} bs=$ddbs count=$nblocks2 >/dev/null 2>&1
|
||||
if [ `md5 -q ${src}` != `md5 -q ${dst}` ]; then
|
||||
@ -42,8 +39,4 @@ else
|
||||
echo "ok 1"
|
||||
fi
|
||||
|
||||
graid3 stop $name
|
||||
mdconfig -d -u $us0
|
||||
mdconfig -d -u $us1
|
||||
mdconfig -d -u $us2
|
||||
rm -f ${src} ${dst}
|
||||
|
Loading…
x
Reference in New Issue
Block a user