| 1 | [[PageOutline]] |
| 2 | |
| 3 | = failure test = |
| 4 | |
| 5 | == 初期状態 == |
| 6 | * cat /proc/mdstat |
| 7 | {{{ |
| 8 | Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] |
| 9 | md1 : active raid1 sda2[0] sdc1[2](S) sdb2[1] |
| 10 | 1461760 blocks [2/2] [UU] |
| 11 | |
| 12 | md0 : active raid0 sda1[0] sdb1[1] |
| 13 | 192512 blocks 64k chunks |
| 14 | |
| 15 | unused devices: <none> |
| 16 | }}} |
| 17 | * sudo mdadm -D /dev/md1 |
| 18 | {{{ |
| 19 | /dev/md1: |
| 20 | Version : 00.90.03 |
| 21 | Creation Time : Thu Jun 11 22:27:07 2009 |
| 22 | Raid Level : raid1 |
| 23 | Array Size : 1461760 (1427.74 MiB 1496.84 MB) |
| 24 | Used Dev Size : 1461760 (1427.74 MiB 1496.84 MB) |
| 25 | Raid Devices : 2 |
| 26 | Total Devices : 3 |
| 27 | Preferred Minor : 1 |
| 28 | Persistence : Superblock is persistent |
| 29 | |
| 30 | Update Time : Fri Jun 12 02:21:57 2009 |
| 31 | State : clean |
| 32 | Active Devices : 2 |
| 33 | Working Devices : 3 |
| 34 | Failed Devices : 0 |
| 35 | Spare Devices : 1 |
| 36 | |
| 37 | UUID : 79c3f25a:e47a02f3:9bb41f43:b191cd1a |
| 38 | Events : 0.5 |
| 39 | |
| 40 | Number Major Minor RaidDevice State |
| 41 | 0 8 2 0 active sync /dev/sda2 |
| 42 | 1 8 18 1 active sync /dev/sdb2 |
| 43 | |
| 44 | 2 8 33 - spare /dev/sdc1 |
| 45 | }}} |
| 46 | |
| 47 | == hot-remove spare disk == |
| 48 | * sudo mdadm /dev/md1 -r /dev/sdc1 |
| 49 | {{{ |
| 50 | mdadm: hot removed /dev/sdc1 |
| 51 | }}} |
| 52 | * sudo mdadm -D /dev/md1 |
| 53 | {{{ |
| 54 | Number Major Minor RaidDevice State |
| 55 | 0 8 2 0 active sync /dev/sda2 |
| 56 | 1 8 18 1 active sync /dev/sdb2 |
| 57 | }}} |
| 58 | * sudo mdadm /dev/md1 -a /dev/sdc1 |
| 59 | {{{ |
| 60 | mdadm: re-added /dev/sdc1 |
| 61 | }}} |
| 62 | * sudo mdadm -D /dev/md1 |
| 63 | {{{ |
| 64 | Number Major Minor RaidDevice State |
| 65 | 0 8 2 0 active sync /dev/sda2 |
| 66 | 1 8 18 1 active sync /dev/sdb2 |
| 67 | |
| 68 | 2 8 33 - spare /dev/sdc1 |
| 69 | }}} |
| 70 | |
| 71 | == fail, remove and re-add == |
| 72 | * man mdadm |
| 73 | {{{ |
| 74 | MANAGE MODE |
| 75 | Usage: mdadm device options... devices... |
| 76 | |
| 77 | This usage will allow individual devices in an array to be failed, |
| 78 | removed or added. It is possible to perform multiple operations with |
| 79 | on command. For example: |
| 80 | mdadm /dev/md0 -f /dev/hda1 -r /dev/hda1 -a /dev/hda1 |
| 81 | will firstly mark /dev/hda1 as faulty in /dev/md0 and will then remove |
| 82 | it from the array and finally add it back in as a spare. However only |
| 83 | one md array can be affected by a single command. |
| 84 | }}} |
| 85 | |
| 86 | * sudo mdadm /dev/md1 -f /dev/sda2 -r /dev/sda2 -a /dev/sda2 |
| 87 | {{{ |
| 88 | mdadm: set /dev/sda2 faulty in /dev/md1 |
| 89 | mdadm: hot removed /dev/sda2 |
| 90 | mdadm: re-added /dev/sda2 |
| 91 | }}} |
| 92 | * cat /proc/mdstat |
| 93 | {{{ |
| 94 | Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] |
| 95 | md1 : active raid1 sda2[2](S) sdc1[3] sdb2[1] |
| 96 | 1461760 blocks [2/1] [_U] |
| 97 | [>....................] recovery = 0.5% (8448/1461760) finish=2.8min speed=8448K/sec |
| 98 | |
| 99 | md0 : active raid0 sda1[0] sdb1[1] |
| 100 | 192512 blocks 64k chunks |
| 101 | |
| 102 | unused devices: <none> |
| 103 | }}} |
| 104 | * sudo mdadm -D /dev/md1 |
| 105 | {{{ |
| 106 | /dev/md1: |
| 107 | Version : 00.90.03 |
| 108 | Creation Time : Thu Jun 11 22:27:07 2009 |
| 109 | Raid Level : raid1 |
| 110 | Array Size : 1461760 (1427.74 MiB 1496.84 MB) |
| 111 | Used Dev Size : 1461760 (1427.74 MiB 1496.84 MB) |
| 112 | Raid Devices : 2 |
| 113 | Total Devices : 3 |
| 114 | Preferred Minor : 1 |
| 115 | Persistence : Superblock is persistent |
| 116 | |
| 117 | Update Time : Fri Jun 12 02:28:20 2009 |
| 118 | State : clean, degraded, recovering |
| 119 | Active Devices : 1 |
| 120 | Working Devices : 3 |
| 121 | Failed Devices : 0 |
| 122 | Spare Devices : 2 |
| 123 | |
| 124 | Rebuild Status : 8% complete |
| 125 | |
| 126 | UUID : 79c3f25a:e47a02f3:9bb41f43:b191cd1a |
| 127 | Events : 0.17 |
| 128 | |
| 129 | Number Major Minor RaidDevice State |
| 130 | 3 8 33 0 spare rebuilding /dev/sdc1 |
| 131 | 1 8 18 1 active sync /dev/sdb2 |
| 132 | |
| 133 | 2 8 2 - spare /dev/sda2 |
| 134 | }}} |
| 135 | |
| 136 | === recovering === |
| 137 | * dmesg |
| 138 | {{{ |
| 139 | [ 6932.978126] raid1: Disk failure on sda2, disabling device. |
| 140 | [ 6932.978134] Operation continuing on 1 devices |
| 141 | [ 6932.994568] RAID1 conf printout: |
| 142 | [ 6932.994603] --- wd:1 rd:2 |
| 143 | [ 6932.995107] disk 0, wo:1, o:0, dev:sda2 |
| 144 | [ 6932.995127] disk 1, wo:0, o:1, dev:sdb2 |
| 145 | [ 6933.022454] RAID1 conf printout: |
| 146 | [ 6933.022462] --- wd:1 rd:2 |
| 147 | [ 6933.022476] disk 1, wo:0, o:1, dev:sdb2 |
| 148 | [ 6933.056753] RAID1 conf printout: |
| 149 | [ 6933.056758] --- wd:1 rd:2 |
| 150 | [ 6933.056762] disk 0, wo:1, o:1, dev:sdc1 |
| 151 | [ 6933.056764] disk 1, wo:0, o:1, dev:sdb2 |
| 152 | [ 6933.061349] md: recovery of RAID array md1 |
| 153 | [ 6933.061379] md: minimum _guaranteed_ speed: 1000 KB/sec/disk. |
| 154 | [ 6933.061403] md: using maximum available idle IO bandwidth (but not more than 200000 KB/sec) for recovery. |
| 155 | [ 6933.062332] md: using 128k window, over a total of 1461760 blocks. |
| 156 | [ 6933.173690] md: unbind<sda2> |
| 157 | [ 6933.173708] md: export_rdev(sda2) |
| 158 | [ 6933.945635] md: bind<sda2> |
| 159 | [ 7066.932827] md: md1: recovery done. |
| 160 | [ 7067.055469] RAID1 conf printout: |
| 161 | [ 7067.055475] --- wd:2 rd:2 |
| 162 | [ 7067.055479] disk 0, wo:0, o:1, dev:sdc1 |
| 163 | [ 7067.055481] disk 1, wo:0, o:1, dev:sdb2 |
| 164 | }}} |
| 165 | * cat /proc/mdstat |
| 166 | {{{ |
| 167 | Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] |
| 168 | md1 : active raid1 sda2[2](S) sdc1[0] sdb2[1] |
| 169 | 1461760 blocks [2/2] [UU] |
| 170 | |
| 171 | md0 : active raid0 sda1[0] sdb1[1] |
| 172 | 192512 blocks 64k chunks |
| 173 | |
| 174 | unused devices: <none> |
| 175 | }}} |
| 176 | * sudo mdadm -D /dev/md1 |
| 177 | {{{ |
| 178 | /dev/md1: |
| 179 | Version : 00.90.03 |
| 180 | Creation Time : Thu Jun 11 22:27:07 2009 |
| 181 | Raid Level : raid1 |
| 182 | Array Size : 1461760 (1427.74 MiB 1496.84 MB) |
| 183 | Used Dev Size : 1461760 (1427.74 MiB 1496.84 MB) |
| 184 | Raid Devices : 2 |
| 185 | Total Devices : 3 |
| 186 | Preferred Minor : 1 |
| 187 | Persistence : Superblock is persistent |
| 188 | |
| 189 | Update Time : Fri Jun 12 02:31:09 2009 |
| 190 | State : active |
| 191 | Active Devices : 2 |
| 192 | Working Devices : 3 |
| 193 | Failed Devices : 0 |
| 194 | Spare Devices : 1 |
| 195 | |
| 196 | UUID : 79c3f25a:e47a02f3:9bb41f43:b191cd1a |
| 197 | Events : 0.45 |
| 198 | |
| 199 | Number Major Minor RaidDevice State |
| 200 | 0 8 33 0 active sync /dev/sdc1 |
| 201 | 1 8 18 1 active sync /dev/sdb2 |
| 202 | |
| 203 | 2 8 2 - spare /dev/sda2 |
| 204 | }}} |
| 205 | |
| 206 | == reboot with degraded 1 disk == |
| 207 | * sudo mdadm /dev/md1 -f /dev/sdc1 /dev/sda2 |
| 208 | {{{ |
| 209 | mdadm: set /dev/sdc1 faulty in /dev/md1 |
| 210 | mdadm: set /dev/sda2 faulty in /dev/md1 |
| 211 | }}} |
| 212 | * sudo mdadm /dev/md1 -r /dev/sdc1 /dev/sda2 |
| 213 | {{{ |
| 214 | mdadm: hot removed /dev/sdc1 |
| 215 | mdadm: hot removed /dev/sda2 |
| 216 | }}} |
| 217 | * sudo mdadm -D /dev/md1 |
| 218 | {{{ |
| 219 | Number Major Minor RaidDevice State |
| 220 | 0 0 0 0 removed |
| 221 | 1 8 18 1 active sync /dev/sdb2 |
| 222 | }}} |
| 223 | * sudo reboot |
| 224 | * /dev/sdb2 のみで正常に起動する |