]> git.ipfire.org Git - thirdparty/mdadm.git/blame - tests/10ddf-create
Create: report failure if array cannot be started.
[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.
e42eb355 10set -e
78e3d2a3
N
11
12mdadm -CR /dev/md/ddf0 -e ddf -n 5 $dev8 $dev9 $dev10 $dev11 $dev12
13mdadm -CR r0 -l0 -n5 /dev/md/ddf0 -z 5000
14mdadm -CR r1 -l1 -n2 /dev/md/ddf0
15mdadm -CR r5 -l5 -n3 /dev/md/ddf0
5f175898
N
16testdev /dev/md/r0 5 5000 512
17# r0 will use 4608 due to chunk size, so that leaves 28160 for the rest
18testdev /dev/md/r1 1 28160 1
19testdev /dev/md/r5 2 28160 512
78e3d2a3
N
20dd if=/dev/sda of=/dev/md/r0 || true
21dd if=/dev/sda of=/dev/md/r1 || true
22dd if=/dev/sda of=/dev/md/r5 || true
23
24s0=`sha1sum /dev/md/r0`
25s1=`sha1sum /dev/md/r1`
26s5=`sha1sum /dev/md/r5`
27
28
29mdadm -Ss
30mdadm -A /dev/md/ddf0 $dev8 $dev9 $dev10 $dev11 $dev12
31mdadm -I /dev/md/ddf0
32
33s0a=`sha1sum /dev/md/r0`
34s1a=`sha1sum /dev/md/r1`
35s5a=`sha1sum /dev/md/r5`
36
37if [ "$s0" != "$s0a" ]; then
38 echo r0 did not match ; exit 1;
39fi
40if [ "$s1" != "$s1a" ]; then
41 echo r1 did not match ; exit 1;
42fi
43if [ "$s5" != "$s5a" ]; then
44 echo r5 did not match ; exit 1;
45fi
46
47# failure status just means it has completed already, so ignore it.
48mdadm --wait /dev/md/r1 || true
49mdadm --wait /dev/md/r5 || true
50
51mdadm -Dbs > /var/tmp/mdadm.conf
52
53mdadm -Ss
54
55# Now try to assemble using mdadm.conf
56mdadm -Asc /var/tmp/mdadm.conf
57check nosync # This failed once. The raid5 was resyncing.
58
00eb5716
N
59mdadm -Dbs | sort > /tmp/mdadm.conf
60sort /var/tmp/mdadm.conf | diff /tmp/mdadm.conf -
78e3d2a3
N
61mdadm -Ss
62
63# and now assemble fully incrementally.
64for i in $dev8 $dev9 $dev10 $dev11 $dev12
65do
66 #./mdadm -I $i -vv 2>&1 | wc -l > /tmp/cnt
67 ./mdadm -I $i 2> /tmp/thing
68 wc -l < /tmp/thing > /tmp/cnt
69 # should find container and 2 devices, so 3 lines.
70 [ `cat /tmp/cnt` -eq 3 ]
71done
72check nosync
73
00eb5716
N
74mdadm -Dbs | sort > /tmp/mdadm.conf
75sort /var/tmp/mdadm.conf | diff /tmp/mdadm.conf -
78e3d2a3
N
76mdadm -Ss
77rm /tmp/mdadm.conf /var/tmp/mdadm.conf