~xnox/ubuntu/quantal/mdadm/merge

« back to all changes in this revision

Viewing changes to tests/07changelevels

  • Committer: Dmitrijs Ledkovs
  • Author(s): Surbhi Palande
  • Date: 2010-09-30 17:46:19 UTC
  • mfrom: (1.1.25 sid)
  • Revision ID: dmitrijs.ledkovs@canonical.com-20100930174619-cqsokylnluraiyr8
Tags: 3.1.4-1+8efb9d1ubuntu1
* Merge from debian unstable. (LP: #603582) 
* Remaining changes
  - Assemble.c, config.c: upgraded to the mdadm-3.1.4 version of these files
    from Debian.
  - debian/control: we need udev and util-linux in the right version. We
    also remove the build dependency from quilt and docbook-to-man as both
    are not used in Ubuntus mdadm.
  - debian/initramfs/hook: kept the Ubuntus version for handling the absence
    of active raid arrays in <initramfs>/etc/mdadm/mdadm.conf
  - debian/initramfs/script.local-top.DEBIAN, debian/mdadm-startall,
    debian/mdadm.raid.DEBIAN: removed. udev does its job now instead.
  - debian/mdadm-startall.sgml, debian/mdadm-startall.8: documentation of
    unused startall script
  - debian/mdadm.config, debian/mdadm.postinst - let udev do the handling
    instead. Resolved merge conflict by keeping Ubuntu's version.
  - debian/rules: kept debian's switch to using dh_lintian
  - debian/mdadm.links, debian/mdadm.manpages: dropped owing to the fact
    that these are not used in Ubuntu. Also dropped the build-dep on docbook
    to man)
  - debian/mdadm.postinst, debian/mdadm.config, initramfs/init-premount:
    boot-degraded enablement; maintain udev starting of RAID devices;
    init-premount hook script for the initramfs, to provide information at
    boot
  - debian/mkconf.in is the older mkconf. Kept the Ubuntus version.
  - debian/rules: Kept Ubuntus version for installing apport hooks, not
    installing un-used startall script and for adding a udev rule
    corresponding to mdadm.
  - debian/install-rc, check.d/_numbers, check.d/root_on_raid: Ubuntu partman
    installer changes
  - debian/presubj: Dropped this unused bug reporting file. Instead use
    source_mdadm.py act as an apport hook for bug handling.
  - rename debian/mdadm.vol_id.udev to debian/mdadm.mdadm-blkid.udev so that
    the rules file ends up with a more reasonable name

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
# Test changing of level, chunksize etc.
 
3
# Create a RAID1, convert to RAID5, add a disk, add another disk
 
4
# convert to RAID6, back to RAID5 and ultimately to RAID1
 
5
 
 
6
testK=$[64*3*6]
 
7
dd if=/dev/urandom of=/tmp/RandFile bs=1024 count=$testK
 
8
export MDADM_GROW_VERIFY=1
 
9
 
 
10
dotest() {
 
11
 sleep 0.5
 
12
 check wait
 
13
 testdev $md0 $1 19968 64 nd
 
14
 blockdev --flushbufs $md0
 
15
 cmp -s -n $[textK*1024] $md0 /tmp/RandFile || { echo cmp failed; exit 2; }
 
16
 # write something new - shift chars 4 space
 
17
 tr ' -~' '$-~ -#' < /tmp/RandFile > /tmp/RandFile2
 
18
 mv /tmp/RandFile2 /tmp/RandFile
 
19
 dd if=/tmp/RandFile of=$md0
 
20
}
 
21
 
 
22
checkgeo() {
 
23
 # check the geometry of an array
 
24
 # level raid_disks chunk_size layout
 
25
 dev=$1
 
26
 shift
 
27
 sleep 0.5
 
28
 check wait
 
29
 for attr in level raid_disks chunk_size layout 
 
30
 do
 
31
   if [ $# -gt 0 ] ; then
 
32
      val=$1
 
33
      shift
 
34
      if [ " `cat /sys/block/$dev/md/$attr`" != " $val" ]
 
35
      then echo "$attr doesn't match for $dev"
 
36
           exit 1
 
37
      fi
 
38
   fi
 
39
 done
 
40
}
 
41
   
 
42
 
 
43
bu=/tmp/md-test-backup
 
44
rm -f $bu
 
45
mdadm -CR $md0 -l1 -n2 -x1 $dev0 $dev1 $dev2 -z 19968
 
46
testdev $md0 1 $mdsize1a 64
 
47
dd if=/tmp/RandFile of=$md0
 
48
dotest 1
 
49
 
 
50
mdadm --grow $md0 -l5 -n3 --chunk 64
 
51
dotest 2
 
52
 
 
53
mdadm $md0 --add $dev3 $dev4
 
54
mdadm --grow $md0 -n4 --chunk 32
 
55
dotest 3
 
56
 
 
57
mdadm -G $md0 -l6 --backup-file $bu
 
58
dotest 3
 
59
 
 
60
mdadm -G /dev/md0 --array-size 39936
 
61
mdadm -G $md0 -n4 --backup-file $bu
 
62
dotest 2
 
63
 
 
64
mdadm -G $md0 -l5 --backup-file $bu
 
65
dotest 2
 
66
 
 
67
mdadm -G /dev/md0 --array-size 19968
 
68
mdadm -G $md0 -n2 --backup-file $bu
 
69
dotest 1
 
70
 
 
71
mdadm -G --level=1 $md0
 
72
dotest 1
 
73
 
 
74
# now repeat that last few steps only with a degraded array.
 
75
mdadm -S $md0
 
76
mdadm -CR $md0 -l6 -n5 $dev0 $dev1 $dev2 $dev3 $dev4
 
77
dd if=/tmp/RandFile of=$md0
 
78
dotest 3
 
79
 
 
80
mdadm $md0 --fail $dev0
 
81
 
 
82
mdadm -G /dev/md0 --array-size 39936
 
83
mdadm -G $md0 -n4 --backup-file $bu
 
84
dotest 2
 
85
mdadm $md0 --fail $dev4
 
86
 
 
87
mdadm $md0 --fail $dev3
 
88
# now double-degraded.
 
89
# switch layout to a DDF layout and back to make sure that works.
 
90
 
 
91
mdadm -G /dev/md0 --layout=ddf-N-continue --backup-file $bu
 
92
checkgeo md0 raid6 4 $[512*1024] 10
 
93
dotest 2
 
94
mdadm -G /dev/md0 --layout=ra --backup-file $bu
 
95
checkgeo md0 raid6 4 $[512*1024] 1
 
96
dotest 2
 
97
 
 
98
mdadm -G $md0 -l5 --backup-file $bu
 
99
dotest 2
 
100
 
 
101
mdadm -G /dev/md0 --array-size 19968
 
102
mdadm -G $md0 -n2 --backup-file $bu
 
103
dotest 1
 
104
mdadm $md0 --fail $dev2
 
105
 
 
106
mdadm -G --level=1 $md0
 
107
dotest 1