]> git.ipfire.org Git - thirdparty/mdadm.git/blame - tests/10ddf-create
Merge https://github.com/makelinux/mdadm
[thirdparty/mdadm.git] / tests / 10ddf-create
CommitLineData
78e3d2a3
N
1#
2# Test basic DDF functionality.
3#
4# Create a container with 5 drives
d2424935 5# create a small raid0 across them all,
6# then a small raid10 using 4 drives, then a 2disk raid1
78e3d2a3
N
7# and a 3disk raid5 using the remaining space
8#
9# add some data, tear down the array, reassemble
10# and make sure it is still there.
4c821454 11set -e
1a2872fe 12. tests/env-ddf-template
13sda=$(get_rootdev) || exit 1
78e3d2a3
N
14
15mdadm -CR /dev/md/ddf0 -e ddf -n 5 $dev8 $dev9 $dev10 $dev11 $dev12
abbc450f 16mdadm -CR r5 -l5 -n5 /dev/md/ddf0 -z 5000
17if mdadm -CR r5 -l1 -n2 /dev/md/ddf0 -z 5000
97c9c100
N
18then echo >&2 create with same name should fail ; exit 1
19fi
cf43d473 20mdadm -CR r10 -l10 -n4 -pn2 /dev/md/ddf0 -z 5000
78e3d2a3 21mdadm -CR r1 -l1 -n2 /dev/md/ddf0
abbc450f 22mdadm -CR r0 -l0 -n3 /dev/md/ddf0
23testdev /dev/md/r5 4 5000 512
cf43d473 24testdev /dev/md/r10 2 5000 512
25# r0/r10 will use 4608 due to chunk size, so that leaves 23552 for the rest
26testdev /dev/md/r1 1 23552 64
abbc450f 27testdev /dev/md/r0 3 23552 512
1a2872fe 28dd if=$sda of=/dev/md/r0 || true
29dd if=$sda of=/dev/md/r10 || true
30dd if=$sda of=/dev/md/r1 || true
31dd if=$sda of=/dev/md/r5 || true
78e3d2a3
N
32
33s0=`sha1sum /dev/md/r0`
cf43d473 34s10=`sha1sum /dev/md/r10`
78e3d2a3
N
35s1=`sha1sum /dev/md/r1`
36s5=`sha1sum /dev/md/r5`
37
38
39mdadm -Ss
40mdadm -A /dev/md/ddf0 $dev8 $dev9 $dev10 $dev11 $dev12
41mdadm -I /dev/md/ddf0
42
af538d59 43udevadm settle
78e3d2a3 44s0a=`sha1sum /dev/md/r0`
cf43d473 45s10a=`sha1sum /dev/md/r10`
78e3d2a3
N
46s1a=`sha1sum /dev/md/r1`
47s5a=`sha1sum /dev/md/r5`
48
49if [ "$s0" != "$s0a" ]; then
50 echo r0 did not match ; exit 1;
51fi
cf43d473 52if [ "$s10" != "$s10a" ]; then
53 echo r10 did not match ; exit 1;
54fi
78e3d2a3
N
55if [ "$s1" != "$s1a" ]; then
56 echo r1 did not match ; exit 1;
57fi
58if [ "$s5" != "$s5a" ]; then
59 echo r5 did not match ; exit 1;
60fi
61
62# failure status just means it has completed already, so ignore it.
63mdadm --wait /dev/md/r1 || true
cf43d473 64mdadm --wait /dev/md/r10 || true
78e3d2a3
N
65mdadm --wait /dev/md/r5 || true
66
67mdadm -Dbs > /var/tmp/mdadm.conf
68
69mdadm -Ss
70
71# Now try to assemble using mdadm.conf
72mdadm -Asc /var/tmp/mdadm.conf
73check nosync # This failed once. The raid5 was resyncing.
4ccc2562 74udevadm settle
00eb5716
N
75mdadm -Dbs | sort > /tmp/mdadm.conf
76sort /var/tmp/mdadm.conf | diff /tmp/mdadm.conf -
78e3d2a3
N
77mdadm -Ss
78
79# and now assemble fully incrementally.
80for i in $dev8 $dev9 $dev10 $dev11 $dev12
bcbb92d4 81do
a6592497 82 mdadm -I $i -c /var/tmp/mdadm.conf
78e3d2a3
N
83done
84check nosync
4ccc2562 85udevadm settle
00eb5716
N
86mdadm -Dbs | sort > /tmp/mdadm.conf
87sort /var/tmp/mdadm.conf | diff /tmp/mdadm.conf -
78e3d2a3
N
88mdadm -Ss
89rm /tmp/mdadm.conf /var/tmp/mdadm.conf