diff options
author | NeilBrown <neilb@suse.de> | 2009-04-14 10:19:06 +1000 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2009-04-14 10:19:06 +1000 |
commit | 78e3d2a37620d4f936f853e652c14cd22cafd381 (patch) | |
tree | f722add1a65cc0b7c0e1b9124f29171f09758b19 /tests | |
parent | 8ab2924c65bddce2b110275350ac519f9b0b5964 (diff) | |
download | mdadm-78e3d2a37620d4f936f853e652c14cd22cafd381.tar.gz |
tests: basic ddf tests
Test script to create a ddf with three different member arrays,
and assemble it in a variety of ways.
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/10ddf-create | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/tests/10ddf-create b/tests/10ddf-create new file mode 100644 index 0000000..db22b64 --- /dev/null +++ b/tests/10ddf-create @@ -0,0 +1,76 @@ +# +# Test basic DDF functionality. +# +# Create a container with 5 drives +# create a small raid0 across them all, then a 2disk raid1 +# and a 3disk raid5 using the remaining space +# +# add some data, tear down the array, reassemble +# and make sure it is still there. + +mdadm -CR /dev/md/ddf0 -e ddf -n 5 $dev8 $dev9 $dev10 $dev11 $dev12 +mdadm -CR r0 -l0 -n5 /dev/md/ddf0 -z 5000 +mdadm -CR r1 -l1 -n2 /dev/md/ddf0 +mdadm -CR r5 -l5 -n3 /dev/md/ddf0 +testdev /dev/md/r0 5 5000 64 +# r0 will use 4992 due to chunk size, so that leave 27776 for the rest +testdev /dev/md/r1 1 27776 1 +testdev /dev/md/r5 2 27776 64 +dd if=/dev/sda of=/dev/md/r0 || true +dd if=/dev/sda of=/dev/md/r1 || true +dd if=/dev/sda of=/dev/md/r5 || true + +s0=`sha1sum /dev/md/r0` +s1=`sha1sum /dev/md/r1` +s5=`sha1sum /dev/md/r5` + + +mdadm -Ss +mdadm -A /dev/md/ddf0 $dev8 $dev9 $dev10 $dev11 $dev12 +mdadm -I /dev/md/ddf0 + +s0a=`sha1sum /dev/md/r0` +s1a=`sha1sum /dev/md/r1` +s5a=`sha1sum /dev/md/r5` + +if [ "$s0" != "$s0a" ]; then + echo r0 did not match ; exit 1; +fi +if [ "$s1" != "$s1a" ]; then + echo r1 did not match ; exit 1; +fi +if [ "$s5" != "$s5a" ]; then + echo r5 did not match ; exit 1; +fi + +# failure status just means it has completed already, so ignore it. +mdadm --wait /dev/md/r1 || true +mdadm --wait /dev/md/r5 || true + +mdadm -Dbs > /var/tmp/mdadm.conf + +mdadm -Ss + +# Now try to assemble using mdadm.conf +mdadm -Asc /var/tmp/mdadm.conf +check nosync # This failed once. The raid5 was resyncing. + +mdadm -Dbs > /tmp/mdadm.conf +diff /tmp/mdadm.conf /var/tmp/mdadm.conf +mdadm -Ss + +# and now assemble fully incrementally. +for i in $dev8 $dev9 $dev10 $dev11 $dev12 +do + #./mdadm -I $i -vv 2>&1 | wc -l > /tmp/cnt + ./mdadm -I $i 2> /tmp/thing + wc -l < /tmp/thing > /tmp/cnt + # should find container and 2 devices, so 3 lines. + [ `cat /tmp/cnt` -eq 3 ] +done +check nosync + +mdadm -Dbs > /tmp/mdadm.conf +diff /tmp/mdadm.conf /var/tmp/mdadm.conf +mdadm -Ss +rm /tmp/mdadm.conf /var/tmp/mdadm.conf |