]>
Commit | Line | Data |
---|---|---|
1 | ||
2 | # check that kernel an restripe interpret all the different layouts | |
3 | # the same | |
4 | # This involves changing the layout to each different possibility | |
5 | # while MDADM_GROW_VERIFY is set. | |
6 | ||
7 | testK=$[64*3*6] | |
8 | dd if=/dev/urandom of=/tmp/RandFile bs=1024 count=$testK | |
9 | export MDADM_GROW_VERITY=1 | |
10 | ||
11 | ||
12 | dotest() { | |
13 | sleep 0.5 | |
14 | check wait | |
15 | testdev $md0 $1 $mdsize1 512 nd | |
16 | blockdev --flushbufs $md0 | |
17 | cmp -s -n $[textK*1024] $md0 /tmp/RandFile || { echo cmp failed; exit 2; } | |
18 | # write something new - shift chars 4 space | |
19 | tr ' -~' '$-~ -#' < /tmp/RandFile > /tmp/RandFile2 | |
20 | mv /tmp/RandFile2 /tmp/RandFile | |
21 | dd if=/tmp/RandFile of=$md0 | |
22 | } | |
23 | ||
24 | checkgeo() { | |
25 | # check the geometry of an array | |
26 | # level raid_disks chunk_size layout | |
27 | dev=$1 | |
28 | shift | |
29 | sleep 0.5 | |
30 | check wait | |
31 | for attr in level raid_disks chunk_size layout | |
32 | do | |
33 | if [ $# -gt 0 ] ; then | |
34 | val=$1 | |
35 | shift | |
36 | if [ " `sed 's/ .*//' /sys/block/$dev/md/$attr`" != " $val" ] | |
37 | then echo "$attr doesn't match for $dev" | |
38 | exit 1 | |
39 | fi | |
40 | fi | |
41 | done | |
42 | } | |
43 | ||
44 | ||
45 | bu=/tmp/md-test-backup | |
46 | rm -f $bu | |
47 | ||
48 | # first a degraded 5 device raid5 | |
49 | mdadm -CR $md0 -l5 -n5 $dev0 $dev1 missing $dev2 $dev3 | |
50 | dd if=/tmp/RandFile of=$md0 | |
51 | dotest 4 | |
52 | ||
53 | l5[0]=la | |
54 | l5[1]=ra | |
55 | l5[2]=ls | |
56 | l5[3]=rs | |
57 | l5[4]=parity-first | |
58 | l5[5]=parity-last | |
59 | for layout in 0 1 2 3 4 5 0 | |
60 | do | |
61 | mdadm -G $md0 --layout=${l5[$layout]} --backup-file $bu | |
62 | checkgeo md0 raid5 5 $[512*1024] $layout | |
63 | dotest 4 | |
64 | done | |
65 | ||
66 | mdadm -S $md0 | |
67 | # now a doubly degraded raid6 | |
68 | mdadm -CR $md0 -l6 -n5 $dev0 missing $dev2 missing $dev4 | |
69 | dd if=/tmp/RandFile of=$md0 | |
70 | dotest 3 | |
71 | ||
72 | l6[0]=la | |
73 | l6[1]=ra | |
74 | l6[2]=ls | |
75 | l6[3]=rs | |
76 | l6[4]=parity-first | |
77 | l6[5]=parity-last | |
78 | l6[8]=ddf-zero-restart | |
79 | l6[9]=ddf-N-restart | |
80 | l6[10]=ddf-N-continue | |
81 | l6[16]=left-asymmetric-6 | |
82 | l6[17]=right-asymmetric-6 | |
83 | l6[18]=left-symmetric-6 | |
84 | l6[19]=right-symmetric-6 | |
85 | l6[20]=parity-first-6 | |
86 | for layout in 0 1 2 3 4 5 8 9 10 16 17 18 19 20 0 | |
87 | do | |
88 | mdadm -G $md0 --layout=${l6[$layout]} --backup-file $bu | |
89 | checkgeo md0 raid6 5 $[512*1024] $layout | |
90 | dotest 3 | |
91 | done |