2 # check that kernel an restripe interpret all the different layouts
4 # This involves changing the layout to each different possibility
5 # while MDADM_GROW_VERIFY is set.
8 dd if=/dev/urandom of=/tmp/RandFile bs=1024 count=$testK
9 export MDADM_GROW_VERITY=1
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
25 # check the geometry of an array
26 # level raid_disks chunk_size layout
31 for attr in level raid_disks chunk_size layout
33 if [ $# -gt 0 ] ; then
36 if [ " `sed 's/ .*//' /sys/block/$dev/md/$attr`" != " $val" ]
37 then echo "$attr doesn't match for $dev"
45 bu=/tmp/md-test-backup
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
59 for layout in 0 1 2 3 4 5 0
61 mdadm -G $md0 --layout=${l5[$layout]} --backup-file $bu
62 checkgeo md0 raid5 5 $[512*1024] $layout
67 # now a doubly degraded raid6
68 mdadm -CR $md0 -l6 -n5 $dev0 missing $dev2 missing $dev4
69 dd if=/tmp/RandFile of=$md0
78 l6[8]=ddf-zero-restart
81 l6[16]=left-asymmetric-6
82 l6[17]=right-asymmetric-6
83 l6[18]=left-symmetric-6
84 l6[19]=right-symmetric-6
86 for layout in 0 1 2 3 4 5 8 9 10 16 17 18 19 20 0
88 mdadm -G $md0 --layout=${l6[$layout]} --backup-file $bu
89 checkgeo md0 raid6 5 $[512*1024] $layout