Debian Codegraph @

tests/07autoassemble

raw
1
2 # create two raid1s, build a raid0 on top, then
3 # tear it down and get auto-assemble to rebuild it.
4
5 #the length of md0/md1/md2 is same. So use md0 here.
6 is_raid_foreign $md0
7
8 mdadm -CR $md1 -l1 -n2 $dev0 $dev1 --homehost=testing
9 mdadm -CR $md2 -l1 -n2 $dev2 $dev3 --homehost=testing
10 mdadm -CR $md0 -l0 -n2 $md1 $md2 --homehost=testing
11
12 mdadm -Ss
13 mdadm -As -c /dev/null --homehost=testing -vvv
14 testdev $md1 1 $mdsize1a 64
15 testdev $md2 1 $mdsize1a 64
16 # md1 and md2 will be incremental assemble by udev rule. And
17 # the testing machines' hostname is not testing. The md0 will
18 # be considered as a foreign array. It can use 0 as metadata
19 # name. md127 will be used
20 testdev $md127 2 $mdsize11a 512
21 mdadm --stop $md127
22 mdadm --zero-superblock $md1
23 mdadm --zero-superblock $md2
24 mdadm -Ss
25
26 mdadm --zero-superblock $dev0 $dev1 $dev2 $dev3
27 ## Now the raid0 uses one stacked and one not
28 mdadm -CR $md1 -l1 -n2 $dev0 $dev1 --homehost=testing
29 mdadm -CR $md0 -l0 -n2 $md1 $dev2 --homehost=testing
30 mdadm -Ss
31 mdadm -As -c /dev/null --homehost=testing -vvv
32 testdev $md1 1 $mdsize1a 64
33 testdev $md127 1 $[mdsize1a+mdsize11a] 512
34 mdadm --stop $md127
35 mdadm --zero-superblock $md1
36 mdadm -Ss
37
38 # Don't specify homehost when creating raid and use the test
39 # machine's homehost. For super1.2, if homehost name's length
40 # is > 32, it doesn't use homehost name in metadata name and
41 # the array will be treated as foreign array
42 mdadm --zero-superblock $dev0 $dev1 $dev2 $dev3
43 mdadm -CR $md1 -l1 -n2 $dev0 $dev1
44 mdadm -CR $md2 -l1 -n2 $dev2 $dev3
45 mdadm -CR $md0 -l0 -n2 $md1 $md2
46 mdadm -Ss
47 mdadm -As -c /dev/null
48 cat /proc/mdstat # For logs
49 if [ $is_foreign == "yes" ]; then
50 # md127 is md1
51 testdev $md127 1 $mdsize1a 64
52 # md126 is md0, udev rule incremental assemble it
53 testdev $md126 2 $mdsize11a 512
54 # md125 is md2
55 testdev $md125 1 $mdsize1a 64
56 else
57 testdev $md1 1 $mdsize1a 64
58 testdev $md2 1 $mdsize1a 64
59 testdev $md127 2 $mdsize11a 512
60 fi
61 mdadm -Ss