]> git.ipfire.org Git - thirdparty/mdadm.git/blob - tests/06update-uuid
Fix and test --update=uuid
[thirdparty/mdadm.git] / tests / 06update-uuid
1 set -x
2
3 # create an array, then change the uuid.
4
5 mdadm -CR --assume-clean $md0 -l5 -n3 $dev0 $dev1 $dev2
6 mdadm -S /dev/md0
7 mdadm -A /dev/md0 --update=uuid --uuid=0123456789abcdef:fedcba9876543210 $dev0 $dev1 $dev2
8 no_errors
9 mdadm -D /dev/md0 | grep -s > /dev/null 01234567:89abcdef:fedcba98:76543210 || {
10 echo Wrong uuid; mdadm -D /dev/md0 ; exit 2;
11 }
12 mdadm -S /dev/md0
13
14 # try v1 superblock
15
16 mdadm -CR --assume-clean -e1 $md0 -l5 -n3 $dev0 $dev1 $dev2
17 mdadm -S /dev/md0
18 mdadm -A /dev/md0 --update=uuid --uuid=0123456789abcdef:fedcba9876543210 $dev0 $dev1 $dev2
19 no_errors
20 mdadm -D /dev/md0 | grep -s > /dev/null 01234567:89abcdef:fedcba98:76543210 || {
21 echo Wrong uuid; mdadm -D /dev/md0 ; exit 2;
22 }
23 mdadm -S /dev/md0
24
25
26 # now if we have a bitmap, that needs updating too.
27 rm -f $targetdir/bitmap
28 mdadm -CR --assume-clean -b $targetdir/bitmap $md0 -l5 -n3 $dev0 $dev1 $dev2
29 mdadm -S /dev/md0
30 mdadm -A /dev/md0 -b $targetdir/bitmap --update=uuid --uuid=0123456789abcdef:fedcba9876543210 $dev0 $dev1 $dev2
31 no_errors
32 mdadm -D /dev/md0 | grep -s > /dev/null 01234567:89abcdef:fedcba98:76543210 || {
33 echo Wrong uuid; mdadm -D /dev/md0 ; exit 2;
34 }
35 if mdadm -X $targetdir/bitmap | grep -s > /dev/null 01234567:89abcdef:fedcba98:76543210 ||
36 mdadm -X $targetdir/bitmap | grep -s > /dev/null 67452301:efcdab89:98badcfe:10325476
37 then : ; else
38 echo Wrong uuid; mdadm -X $targetdir/bitmap ; exit 2;
39 fi
40 mdadm -S /dev/md0
41
42 # and bitmap for version1
43 rm -f $targetdir/bitmap
44 mdadm -CR --assume-clean -e1.1 -b $targetdir/bitmap $md0 -l5 -n3 $dev0 $dev1 $dev2
45 mdadm -S /dev/md0
46 mdadm -A /dev/md0 -b $targetdir/bitmap --update=uuid --uuid=0123456789abcdef:fedcba9876543210 $dev0 $dev1 $dev2
47 no_errors
48 mdadm -D /dev/md0 | grep -s > /dev/null 01234567:89abcdef:fedcba98:76543210 || {
49 echo Wrong uuid; mdadm -D /dev/md0 ; exit 2;
50 }
51 # -X cannot tell which byteorder to use for the UUID, so allow both.
52 if mdadm -X $targetdir/bitmap | grep -s > /dev/null 01234567:89abcdef:fedcba98:76543210 ||
53 mdadm -X $targetdir/bitmap | grep -s > /dev/null 67452301:efcdab89:98badcfe:10325476
54 then : ; else
55 echo Wrong uuid; mdadm -X $targetdir/bitmap ; exit 2;
56 fi
57 mdadm -S /dev/md0
58
59 # Internal bitmaps too.
60 mdadm -CR --assume-clean -b internal $md0 -l5 -n3 $dev0 $dev1 $dev2
61 mdadm -S /dev/md0
62 mdadm -A /dev/md0 --update=uuid --uuid=0123456789abcdef:fedcba9876543210 $dev0 $dev1 $dev2
63 no_errors
64 mdadm -D /dev/md0 | grep -s > /dev/null 01234567:89abcdef:fedcba98:76543210 || {
65 echo Wrong uuid; mdadm -D /dev/md0 ; exit 2;
66 }
67 mdadm -X $dev0 | grep -s > /dev/null 01234567:89abcdef:fedcba98:76543210 || {
68 echo Wrong uuid; mdadm -X $dev0; exit 2;
69 }
70 mdadm -S /dev/md0
71
72 mdadm -CR --assume-clean -e1.2 -b internal $md0 -l5 -n3 $dev0 $dev1 $dev2
73 mdadm -S /dev/md0
74 mdadm -A /dev/md0 --update=uuid --uuid=0123456789abcdef:fedcba9876543210 $dev0 $dev1 $dev2
75 no_errors
76 mdadm -D /dev/md0 | grep -s > /dev/null 01234567:89abcdef:fedcba98:76543210 || {
77 echo Wrong uuid; mdadm -D /dev/md0 ; exit 2;
78 }
79 mdadm -X $dev0 | grep -s > /dev/null 01234567:89abcdef:fedcba98:76543210 || {
80 echo Wrong uuid; mdadm -X $dev0; exit 2;
81 }
82 mdadm -S /dev/md0