]> git.ipfire.org Git - thirdparty/mdadm.git/blame - tests/10ddf-create
imsm: fix family number handling
[thirdparty/mdadm.git] / tests / 10ddf-create
CommitLineData
78e3d2a3
N
1#
2# Test basic DDF functionality.
3#
4# Create a container with 5 drives
5# create a small raid0 across them all, then a 2disk raid1
6# and a 3disk raid5 using the remaining space
7#
8# add some data, tear down the array, reassemble
9# and make sure it is still there.
10
11mdadm -CR /dev/md/ddf0 -e ddf -n 5 $dev8 $dev9 $dev10 $dev11 $dev12
12mdadm -CR r0 -l0 -n5 /dev/md/ddf0 -z 5000
13mdadm -CR r1 -l1 -n2 /dev/md/ddf0
14mdadm -CR r5 -l5 -n3 /dev/md/ddf0
15testdev /dev/md/r0 5 5000 64
16# r0 will use 4992 due to chunk size, so that leave 27776 for the rest
17testdev /dev/md/r1 1 27776 1
18testdev /dev/md/r5 2 27776 64
19dd if=/dev/sda of=/dev/md/r0 || true
20dd if=/dev/sda of=/dev/md/r1 || true
21dd if=/dev/sda of=/dev/md/r5 || true
22
23s0=`sha1sum /dev/md/r0`
24s1=`sha1sum /dev/md/r1`
25s5=`sha1sum /dev/md/r5`
26
27
28mdadm -Ss
29mdadm -A /dev/md/ddf0 $dev8 $dev9 $dev10 $dev11 $dev12
30mdadm -I /dev/md/ddf0
31
32s0a=`sha1sum /dev/md/r0`
33s1a=`sha1sum /dev/md/r1`
34s5a=`sha1sum /dev/md/r5`
35
36if [ "$s0" != "$s0a" ]; then
37 echo r0 did not match ; exit 1;
38fi
39if [ "$s1" != "$s1a" ]; then
40 echo r1 did not match ; exit 1;
41fi
42if [ "$s5" != "$s5a" ]; then
43 echo r5 did not match ; exit 1;
44fi
45
46# failure status just means it has completed already, so ignore it.
47mdadm --wait /dev/md/r1 || true
48mdadm --wait /dev/md/r5 || true
49
50mdadm -Dbs > /var/tmp/mdadm.conf
51
52mdadm -Ss
53
54# Now try to assemble using mdadm.conf
55mdadm -Asc /var/tmp/mdadm.conf
56check nosync # This failed once. The raid5 was resyncing.
57
58mdadm -Dbs > /tmp/mdadm.conf
59diff /tmp/mdadm.conf /var/tmp/mdadm.conf
60mdadm -Ss
61
62# and now assemble fully incrementally.
63for i in $dev8 $dev9 $dev10 $dev11 $dev12
64do
65 #./mdadm -I $i -vv 2>&1 | wc -l > /tmp/cnt
66 ./mdadm -I $i 2> /tmp/thing
67 wc -l < /tmp/thing > /tmp/cnt
68 # should find container and 2 devices, so 3 lines.
69 [ `cat /tmp/cnt` -eq 3 ]
70done
71check nosync
72
73mdadm -Dbs > /tmp/mdadm.conf
74diff /tmp/mdadm.conf /var/tmp/mdadm.conf
75mdadm -Ss
76rm /tmp/mdadm.conf /var/tmp/mdadm.conf