]>
Commit | Line | Data |
---|---|---|
64c4757e | 1 | /* |
9a9dab36 | 2 | * mdadm - manage Linux "md" devices aka RAID arrays. |
64c4757e | 3 | * |
cd29a5c8 | 4 | * Copyright (C) 2001-2002 Neil Brown <neilb@cse.unsw.edu.au> |
64c4757e NB |
5 | * |
6 | * | |
7 | * This program is free software; you can redistribute it and/or modify | |
8 | * it under the terms of the GNU General Public License as published by | |
9 | * the Free Software Foundation; either version 2 of the License, or | |
10 | * (at your option) any later version. | |
11 | * | |
12 | * This program is distributed in the hope that it will be useful, | |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | * GNU General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public License | |
18 | * along with this program; if not, write to the Free Software | |
19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
20 | * | |
21 | * Author: Neil Brown | |
22 | * Email: <neilb@cse.unsw.edu.au> | |
23 | * Paper: Neil Brown | |
24 | * School of Computer Science and Engineering | |
25 | * The University of New South Wales | |
26 | * Sydney, 2052 | |
27 | * Australia | |
28 | */ | |
29 | ||
9a9dab36 | 30 | #include "mdadm.h" |
64c4757e | 31 | |
b5e64645 | 32 | char Version[] = Name " - v1.8.0 - 01 November 2004\n"; |
64c4757e NB |
33 | /* |
34 | * File: ReadMe.c | |
35 | * | |
36 | * This file contains general comments about the implementation | |
9a9dab36 | 37 | * and the various usage messages that can be displayed by mdadm |
64c4757e | 38 | * |
9a9dab36 | 39 | * mdadm is a single program that can be used to control Linux md devices. |
64c4757e NB |
40 | * It is intended to provide all the functionality of the mdtools and |
41 | * raidtools but with a very different interface. | |
9a9dab36 | 42 | * mdadm can perform all functions without a configuration file. |
64c4757e NB |
43 | * There is the option of using a configuration file, but not in the same |
44 | * way that raidtools uses one | |
45 | * raidtools uses a configuration file to describe how to create a RAID | |
46 | * array, and also uses this file partially to start a previously | |
47 | * created RAID array. Further, raidtools requires the configuration | |
48 | * file for such things as stopping a raid array which needs to know | |
49 | * nothing about the array. | |
50 | * | |
9a9dab36 | 51 | * The configuration file that can be used by mdadm lists two |
64c4757e NB |
52 | * different things: |
53 | * 1/ a mapping from uuid to md device to identify which arrays are | |
54 | * expect and what names (numbers) they should be given | |
55 | * 2/ a list of devices that should be scanned for md sub-devices | |
56 | * | |
57 | * | |
58 | */ | |
59 | ||
60 | /* | |
dd0781e5 | 61 | * mdadm has 7 major modes of operation: |
64c4757e | 62 | * 1/ Create |
5787fa49 | 63 | * This mode is used to create a new array with a superblock |
64c4757e NB |
64 | * It can progress in several step create-add-add-run |
65 | * or it can all happen with one command | |
66 | * 2/ Assemble | |
67 | * This mode is used to assemble the parts of a previously created | |
68 | * array into an active array. Components can be explicitly given | |
9a9dab36 | 69 | * or can be searched for. mdadm (optionally) check that the components |
5787fa49 | 70 | * do form a bona-fide array, and can, on request, fiddle superblock |
64c4757e NB |
71 | * version numbers so as to assemble a faulty array. |
72 | * 3/ Build | |
73 | * This is for building legacy arrays without superblocks | |
74 | * 4/ Manage | |
e0d19036 NB |
75 | * This is for doing something to one or more devices |
76 | * in an array, such as add,remove,fail. | |
77 | * run/stop/readonly/readwrite are also available | |
78 | * 5/ Misc | |
79 | * This is for doing things to individual devices. | |
80 | * They might be parts of an array so | |
81 | * zero-superblock, examine might be appropriate | |
82 | * They might be md arrays so | |
83 | * run,stop,rw,ro,detail might be appropriate | |
84 | * Also query will treat it as either | |
85 | * 6/ Monitor | |
86 | * This mode never exits but just monitors arrays and reports changes. | |
dd0781e5 NB |
87 | * 7/ Grow |
88 | * This mode allows for changing of key attributes of a raid array, such | |
89 | * as size, number of devices, and possibly even layout. | |
90 | * At the time if writing, there is only minimal support. | |
64c4757e NB |
91 | */ |
92 | ||
b5e64645 | 93 | char short_options[]="-ABCDEFGQhVvbc:i:l:p:m:n:x:u:c:d:z:U:sa::rfRSow1t"; |
64c4757e NB |
94 | struct option long_options[] = { |
95 | {"manage", 0, 0, '@'}, | |
e0d19036 | 96 | {"misc", 0, 0, '#'}, |
64c4757e NB |
97 | {"assemble", 0, 0, 'A'}, |
98 | {"build", 0, 0, 'B'}, | |
99 | {"create", 0, 0, 'C'}, | |
100 | {"detail", 0, 0, 'D'}, | |
101 | {"examine", 0, 0, 'E'}, | |
52826846 | 102 | {"follow", 0, 0, 'F'}, |
dd0781e5 | 103 | {"grow", 0, 0, 'G'}, |
e0d19036 NB |
104 | {"zero-superblock", 0, 0, 'K'}, /* deliberately no a short_option */ |
105 | {"query", 0, 0, 'Q'}, | |
52826846 NB |
106 | |
107 | /* synonyms */ | |
108 | {"monitor", 0, 0, 'F'}, | |
109 | ||
64c4757e NB |
110 | /* after those will normally come the name of the md device */ |
111 | {"help", 0, 0, 'h'}, | |
56eedc1a | 112 | {"help-options",0,0,'h'}, |
64c4757e NB |
113 | {"version", 0, 0, 'V'}, |
114 | {"verbose", 0, 0, 'v'}, | |
115 | ||
116 | /* For create or build: */ | |
117 | {"chunk", 1, 0, 'c'}, | |
118 | {"rounding", 1, 0, 'c'}, /* for linear, chunk is really a rounding number */ | |
98c6faba | 119 | {"level", 1, 0, 'l'}, /* 0,1,4,5,6,linear */ |
5787fa49 | 120 | {"parity", 1, 0, 'p'}, /* {left,right}-{a,}symmetric */ |
64c4757e NB |
121 | {"layout", 1, 0, 'p'}, |
122 | {"raid-disks",1, 0, 'n'}, | |
b83d95f3 | 123 | {"raid-devices",1, 0, 'n'}, |
64c4757e | 124 | {"spare-disks",1,0, 'x'}, |
b83d95f3 | 125 | {"spare-devices",1,0, 'x'}, |
dd0781e5 NB |
126 | {"size", 1, 0, 'z'}, |
127 | {"auto", 2, 0, 'a'}, /* also for --assemble */ | |
128 | {"assume-clean",0,0, 3 }, | |
64c4757e NB |
129 | |
130 | /* For assemble */ | |
131 | {"uuid", 1, 0, 'u'}, | |
52826846 | 132 | {"super-minor",1,0, 'm'}, |
64c4757e NB |
133 | {"config", 1, 0, 'c'}, |
134 | {"scan", 0, 0, 's'}, | |
135 | {"force", 0, 0, 'f'}, | |
5787fa49 | 136 | {"update", 1, 0, 'U'}, |
64c4757e NB |
137 | /* Management */ |
138 | {"add", 0, 0, 'a'}, | |
139 | {"remove", 0, 0, 'r'}, | |
140 | {"fail", 0, 0, 'f'}, | |
141 | {"set-faulty",0, 0, 'f'}, | |
142 | {"run", 0, 0, 'R'}, | |
143 | {"stop", 0, 0, 'S'}, | |
144 | {"readonly", 0, 0, 'o'}, | |
145 | {"readwrite", 0, 0, 'w'}, | |
52826846 | 146 | |
cd29a5c8 NB |
147 | /* For Detail/Examine */ |
148 | {"brief", 0, 0, 'b'}, | |
bd526cee | 149 | {"sparc2.2", 0, 0, 22}, |
feb716e9 | 150 | {"test", 0, 0, 't'}, |
cd29a5c8 | 151 | |
52826846 NB |
152 | /* For Follow/monitor */ |
153 | {"mail", 1, 0, 'm'}, | |
154 | {"program", 1, 0, 'p'}, | |
155 | {"alert", 1, 0, 'p'}, | |
156 | {"delay", 1, 0, 'd'}, | |
56eedc1a NB |
157 | {"daemonise", 0, 0, 'f'}, |
158 | {"daemonize", 0, 0, 'f'}, | |
aa88f531 | 159 | {"oneshot", 0, 0, '1'}, |
b5e64645 | 160 | {"pid-file", 1, 0, 'i'}, |
64c4757e NB |
161 | |
162 | {0, 0, 0, 0} | |
163 | }; | |
164 | ||
165 | char Usage[] = | |
9a9dab36 | 166 | "Usage: mdadm --help\n" |
64c4757e NB |
167 | " for help\n" |
168 | ; | |
169 | ||
170 | char Help[] = | |
9a9dab36 NB |
171 | "Usage: mdadm --create device options...\n" |
172 | " mdadm --assemble device options...\n" | |
173 | " mdadm --build device options...\n" | |
e0d19036 NB |
174 | " mdadm --manage device options...\n" |
175 | " mdadm --misc options... devices\n" | |
176 | " mdadm --monitor options...\n" | |
9a9dab36 | 177 | " mdadm device options...\n" |
5787fa49 | 178 | " mdadm is used for building, managing, and monitoring\n" |
56eedc1a NB |
179 | " Linux md devices (aka RAID arrays)\n" |
180 | " For detailed help on the above major modes use --help after the mode\n" | |
e0d19036 | 181 | " e.g.\n" |
9a9dab36 | 182 | " mdadm --assemble --help\n" |
56eedc1a NB |
183 | " For general help on options use\n" |
184 | " mdadm --help-options\n" | |
185 | ; | |
186 | ||
187 | char OptionHelp[] = | |
64c4757e | 188 | "Any parameter that does not start with '-' is treated as a device name\n" |
e0d19036 NB |
189 | "The first such name is often the name of an md device. Subsequent\n" |
190 | "names are often names of component devices." | |
52826846 | 191 | "\n" |
e0d19036 | 192 | "Some common options are:\n" |
56eedc1a | 193 | " --help -h : General help message or, after above option,\n" |
64c4757e | 194 | " mode specific help message\n" |
56eedc1a | 195 | " --help-options : This help message\n" |
9a9dab36 | 196 | " --version -V : Print version information for mdadm\n" |
64c4757e | 197 | " --verbose -v : Be more verbose about what is happening\n" |
e0d19036 NB |
198 | " --brief -b : Be less verbose, more brief\n" |
199 | " --force -f : Override normal checks and be more forceful\n" | |
200 | "\n" | |
201 | " --assemble -A : Assemble an array\n" | |
202 | " --build -B : Build a legacy array\n" | |
203 | " --create -C : Create a new array\n" | |
204 | " --detail -D : Display details of an array\n" | |
5787fa49 | 205 | " --examine -E : Examine superblock on an array component\n" |
e0d19036 NB |
206 | " --monitor -F : monitor (follow) some arrays\n" |
207 | " --query -Q : Display general information about how a\n" | |
208 | " device relates to the md driver\n" | |
209 | ; | |
210 | /* | |
64c4757e NB |
211 | "\n" |
212 | " For create or build:\n" | |
213 | " --chunk= -c : chunk size of kibibytes\n" | |
5787fa49 | 214 | " --rounding= : rounding factor for linear array (==chunk size)\n" |
98c6faba NB |
215 | " --level= -l : raid level: 0,1,4,5,6,linear,mp. 0 or linear for build\n" |
216 | " --parity= -p : raid5/6 parity algorithm: {left,right}-{,a}symmetric\n" | |
64c4757e | 217 | " --layout= : same as --parity\n" |
b83d95f3 NB |
218 | " --raid-devices= -n : number of active devices in array\n" |
219 | " --spare-devices= -x: number of spares (eXtras) devices in initial array\n" | |
e5329c37 | 220 | " --size= -z : Size (in K) of each drive in RAID1/4/5/6/10 - optional\n" |
52826846 NB |
221 | " --force -f : Honour devices as listed on command line. Don't\n" |
222 | " : insert a missing drive for RAID5.\n" | |
dd0781e5 NB |
223 | " --auto(=p) -a : Automatically allocate new (partitioned) md array if needed.\n" |
224 | " --assume-clean : Assume the array is already in-sync. This is dangerous.\n" | |
64c4757e NB |
225 | "\n" |
226 | " For assemble:\n" | |
227 | " --uuid= -u : uuid of array to assemble. Devices which don't\n" | |
228 | " have this uuid are excluded\n" | |
52826846 NB |
229 | " --super-minor= -m : minor number to look for in super-block when\n" |
230 | " choosing devices to use.\n" | |
64c4757e NB |
231 | " --config= -c : config file\n" |
232 | " --scan -s : scan config file for missing information\n" | |
233 | " --force -f : Assemble the array even if some superblocks appear out-of-date\n" | |
feb716e9 | 234 | " --update= -U : Update superblock: one of sparc2.2, super-minor or summaries\n" |
dd0781e5 | 235 | " --auto(=p) -a : Automatically allocate new (partitioned) md array if needed.\n" |
64c4757e | 236 | "\n" |
cd29a5c8 NB |
237 | " For detail or examine:\n" |
238 | " --brief -b : Just print device name and UUID\n" | |
239 | "\n" | |
52826846 NB |
240 | " For follow/monitor:\n" |
241 | " --mail= -m : Address to mail alerts of failure to\n" | |
242 | " --program= -p : Program to run when an event is detected\n" | |
243 | " --alert= : same as --program\n" | |
244 | " --delay= -d : seconds of delay between polling state. default=60\n" | |
245 | "\n" | |
64c4757e NB |
246 | " General management:\n" |
247 | " --add -a : add, or hotadd subsequent devices\n" | |
248 | " --remove -r : remove subsequent devices\n" | |
249 | " --fail -f : mark subsequent devices a faulty\n" | |
250 | " --set-faulty : same as --fail\n" | |
251 | " --run -R : start a partially built array\n" | |
5787fa49 | 252 | " --stop -S : deactivate array, releasing all resources\n" |
64c4757e NB |
253 | " --readonly -o : mark array as readonly\n" |
254 | " --readwrite -w : mark array as readwrite\n" | |
9a9dab36 | 255 | " --zero-superblock : erase the MD superblock from a device.\n" |
64c4757e | 256 | ; |
e0d19036 | 257 | */ |
64c4757e NB |
258 | |
259 | char Help_create[] = | |
b83d95f3 | 260 | "Usage: mdadm --create device -chunk=X --level=Y --raid-devices=Z devices\n" |
64c4757e | 261 | "\n" |
aa88f531 NB |
262 | " This usage will initialise a new md array, associate some\n" |
263 | " devices with it, and activate the array. In order to create an\n" | |
264 | " array with some devices missing, use the special word 'missing' in\n" | |
265 | " place of the relevant device name.\n" | |
64c4757e | 266 | "\n" |
aa88f531 | 267 | " Before devices are added, they are checked to see if they already contain\n" |
e0d19036 | 268 | " raid superblocks or filesystems. They are also checked to see if\n" |
64c4757e | 269 | " the variance in device size exceeds 1%.\n" |
aa88f531 NB |
270 | " If any discrepancy is found, the user will be prompted for confirmation\n" |
271 | " before the array is created. The presence of a '--run' can override this\n" | |
64c4757e NB |
272 | " caution.\n" |
273 | "\n" | |
e0d19036 NB |
274 | " If the --size option is given then only that many kilobytes of each\n" |
275 | " device is used, no matter how big each device is.\n" | |
682c7051 | 276 | " If no --size is given, the apparent size of the smallest drive given\n" |
e0d19036 NB |
277 | " is used for raid level 1 and greater, and the full device is used for\n" |
278 | " other levels.\n" | |
682c7051 | 279 | "\n" |
e0d19036 NB |
280 | " Options that are valid with --create (-C) are:\n" |
281 | " --chunk= -c : chunk size of kibibytes\n" | |
5787fa49 | 282 | " --rounding= : rounding factor for linear array (==chunk size)\n" |
98c6faba NB |
283 | " --level= -l : raid level: 0,1,4,5,6,linear,multipath and synonyms\n" |
284 | " --parity= -p : raid5/6 parity algorithm: {left,right}-{,a}symmetric\n" | |
e0d19036 | 285 | " --layout= : same as --parity\n" |
b83d95f3 NB |
286 | " --raid-devices= -n : number of active devices in array\n" |
287 | " --spare-devices= -x: number of spares (eXtras) devices in initial array\n" | |
e5329c37 | 288 | " --size= -z : Size (in K) of each drive in RAID1/4/5/6/10 - optional\n" |
e0d19036 NB |
289 | " --force -f : Honour devices as listed on command line. Don't\n" |
290 | " : insert a missing drive for RAID5.\n" | |
aa88f531 | 291 | " --run -R : insist of running the array even if not all\n" |
e0d19036 | 292 | " : devices are present or some look odd.\n" |
aa88f531 | 293 | " --readonly -o : start the array readonly - not supported yet.\n" |
64c4757e NB |
294 | "\n" |
295 | ; | |
296 | ||
297 | char Help_build[] = | |
b83d95f3 | 298 | "Usage: mdadm --build device -chunk=X --level=Y --raid-devices=Z devices\n" |
64c4757e NB |
299 | "\n" |
300 | " This usage is similar to --create. The difference is that it creates\n" | |
e0d19036 | 301 | " a legacy array without a superblock. With these arrays there is no\n" |
64c4757e NB |
302 | " different between initially creating the array and subsequently\n" |
303 | " assembling the array, except that hopefully there is useful data\n" | |
304 | " there in the second case.\n" | |
305 | "\n" | |
e0d19036 | 306 | " The level may only be 0, raid0, or linear.\n" |
64c4757e | 307 | " All devices must be listed and the array will be started once complete.\n" |
e0d19036 NB |
308 | " Options that are valid with --build (-B) are:\n" |
309 | " --chunk= -c : chunk size of kibibytes\n" | |
5787fa49 | 310 | " --rounding= : rounding factor for linear array (==chunk size)\n" |
e0d19036 | 311 | " --level= -l : 0, raid0, or linear\n" |
b83d95f3 | 312 | " --raid-devices= -n : number of active devices in array\n" |
64c4757e NB |
313 | ; |
314 | ||
315 | char Help_assemble[] = | |
9a9dab36 NB |
316 | "Usage: mdadm --assemble device options...\n" |
317 | " mdadm --assemble --scan options...\n" | |
64c4757e NB |
318 | "\n" |
319 | "This usage assembles one or more raid arrays from pre-existing\n" | |
320 | "components.\n" | |
e0d19036 | 321 | "For each array, mdadm needs to know the md device, the identity of\n" |
52826846 NB |
322 | "the array, and a number of sub devices. These can be found in a number\n" |
323 | "of ways.\n" | |
324 | "\n" | |
325 | "The md device is either given on the command line or is found listed\n" | |
326 | "in the config file. The array identity is determined either from the\n" | |
e0d19036 | 327 | "--uuid or --super-minor commandline arguments, from the config file,\n" |
52826846 | 328 | "or from the first component device on the command line.\n" |
64c4757e | 329 | "\n" |
52826846 NB |
330 | "The different combinations of these are as follows:\n" |
331 | " If the --scan option is not given, then only devices and identities\n" | |
332 | " listed on the command line are considered.\n" | |
e0d19036 | 333 | " The first device will be the array device, and the remainder will be\n" |
52826846 NB |
334 | " examined when looking for components.\n" |
335 | " If an explicit identity is given with --uuid or --super-minor, then\n" | |
e0d19036 | 336 | " only devices with a superblock which matches that identity is considered,\n" |
52826846 | 337 | " otherwise every device listed is considered.\n" |
64c4757e | 338 | "\n" |
52826846 NB |
339 | " If the --scan option is given, and no devices are listed, then\n" |
340 | " every array listed in the config file is considered for assembly.\n" | |
e0d19036 | 341 | " The identity of candidate devices are determined from the config file.\n" |
64c4757e | 342 | "\n" |
52826846 NB |
343 | " If the --scan option is given as well as one or more devices, then\n" |
344 | " Those devices are md devices that are to be assembled. Their identity\n" | |
345 | " and components are determined from the config file.\n" | |
64c4757e | 346 | "\n" |
e0d19036 NB |
347 | "Options that are valid with --assemble (-A) are:\n" |
348 | " --uuid= -u : uuid of array to assemble. Devices which don't\n" | |
349 | " have this uuid are excluded\n" | |
350 | " --super-minor= -m : minor number to look for in super-block when\n" | |
351 | " choosing devices to use.\n" | |
352 | " --config= -c : config file\n" | |
353 | " --scan -s : scan config file for missing information\n" | |
354 | " --run -R : Try to start the array even if not enough devices\n" | |
355 | " for a full array are present\n" | |
356 | " --force -f : Assemble the array even if some superblocks appear\n" | |
357 | " : out-of-date. This involves modifying the superblocks.\n" | |
feb716e9 | 358 | " --update= -U : Update superblock: one of sparc2.2, super-minor or summaries\n" |
e0d19036 NB |
359 | ; |
360 | ||
361 | char Help_manage[] = | |
362 | "Usage: mdadm arraydevice options component devices...\n" | |
363 | "\n" | |
364 | "This usage is for managing the component devices within an array.\n" | |
365 | "The --manage option is not needed and is assumed if the first argument\n" | |
366 | "is a device name or a management option.\n" | |
367 | "The first device listed will be taken to be an md array device, and\n" | |
368 | "subsequent devices are (potential) components of that array.\n" | |
369 | "\n" | |
370 | "Options that are valid with management mode are:\n" | |
371 | " --add -a : hotadd subsequent devices to the array\n" | |
372 | " --remove -r : remove subsequent devices, which must not be active\n" | |
373 | " --fail -f : mark subsequent devices a faulty\n" | |
374 | " --set-faulty : same as --fail\n" | |
375 | " --run -R : start a partially built array\n" | |
5787fa49 | 376 | " --stop -S : deactivate array, releasing all resources\n" |
e0d19036 NB |
377 | " --readonly -o : mark array as readonly\n" |
378 | " --readwrite -w : mark array as readwrite\n" | |
379 | ; | |
380 | ||
381 | char Help_misc[] = | |
382 | "Usage: mdadm misc_option devices...\n" | |
383 | "\n" | |
384 | "This usage is for performing some task on one or more devices, which\n" | |
385 | "may be arrays or components, depending on the task.\n" | |
386 | "The --misc option is not needed (though it is allowed) and is assumed\n" | |
387 | "if the first argument in a misc option.\n" | |
388 | "\n" | |
389 | "Options that are valid with the miscellaneous mode are:\n" | |
390 | " --query -Q : Display general information about how a\n" | |
391 | " device relates to the md driver\n" | |
392 | " --detail -D : Display details of an array\n" | |
5787fa49 | 393 | " --examine -E : Examine superblock on an array component\n" |
e0d19036 NB |
394 | " --zero-superblock : erase the MD superblock from a device.\n" |
395 | " --run -R : start a partially built array\n" | |
5787fa49 | 396 | " --stop -S : deactivate array, releasing all resources\n" |
e0d19036 NB |
397 | " --readonly -o : mark array as readonly\n" |
398 | " --readwrite -w : mark array as readwrite\n" | |
feb716e9 | 399 | " --test -t : exit status 0 if ok, 1 if degrade, 2 if dead, 4 if missing\n" |
e0d19036 NB |
400 | ; |
401 | ||
402 | char Help_monitor[] = | |
403 | "Usage: mdadm --monitor options devices\n" | |
404 | "\n" | |
405 | "This usage causes mdadm to monitor a number of md arrays by periodically\n" | |
406 | "polling their status and acting on any changes.\n" | |
407 | "If any devices are listed then those devices are monitored, otherwise\n" | |
408 | "all devices listed in the config file are monitored.\n" | |
409 | "The address for mailing advisories to, and the program to handle\n" | |
410 | "each change can be specified in the config file or on the command line.\n" | |
411 | "If no mail address or program are specified, then mdadm reports all\n" | |
412 | "state changes to stdout.\n" | |
413 | "\n" | |
dd0781e5 | 414 | "Options that are valid with the monitor (-F --follow) mode are:\n" |
e0d19036 NB |
415 | " --mail= -m : Address to mail alerts of failure to\n" |
416 | " --program= -p : Program to run when an event is detected\n" | |
417 | " --alert= : same as --program\n" | |
418 | " --delay= -d : seconds of delay between polling state. default=60\n" | |
419 | " --config= -c : specify a different config file\n" | |
420 | " --scan -s : find mail-address/program in config file\n" | |
d013a55e | 421 | " --daemonise -f : Fork and continue in child, parent exits\n" |
b5e64645 | 422 | " --pid-file= -i : In daemon mode write pid to specified file instead of stdout\n" |
aa88f531 | 423 | " --oneshot -1 : Check for degraded arrays, then exit\n" |
98c6faba | 424 | " --test -t : Generate a TestMessage event against each array at startup\n" |
e0d19036 NB |
425 | ; |
426 | ||
dd0781e5 NB |
427 | char Help_grow[] = |
428 | "Usage: mdadm --grow device options\n" | |
429 | "\n" | |
430 | "This usage causes mdadm to attempt to reconfigure a running array.\n" | |
431 | "This is only possibly if the kernel being used supports a particular\n" | |
432 | "reconfiguration. This version only supports changing the number of\n" | |
433 | "devices in a RAID1, and changing the active size of all devices in\n" | |
434 | "a RAID1/4/5/6.\n" | |
435 | "\n" | |
436 | "Options that are valid with the grow (-F --grow) mode are:\n" | |
437 | " --size= -z : Change the active size of devices in an array.\n" | |
438 | " : This is useful if all devices have been replaced\n" | |
439 | " : with larger devices.\n" | |
440 | " --raid-disks= -n : Change the number of active devices in a RAID1\n" | |
441 | " : array.\n" | |
442 | ; | |
e0d19036 NB |
443 | |
444 | ||
445 | ||
446 | char Help_config[] = | |
447 | "The /etc/mdadm.conf config file:\n\n" | |
448 | " The config file contains, apart from blank lines and comment lines that\n" | |
449 | " start with a hash(#), four sorts of configuration lines: array lines, \n" | |
450 | " device lines, mailaddr lines and program lines.\n" | |
451 | " Each configuration line is constructed of a number of space separated\n" | |
452 | " words, and can be continued on subsequent physical lines by indenting\n" | |
453 | " those lines.\n" | |
454 | "\n" | |
455 | " A device line starts with the word 'device' and then has a number of words\n" | |
456 | " which identify devices. These words should be names of devices in the\n" | |
457 | " filesystem, and can contain wildcards. There can be multiple words or each\n" | |
458 | " device line, and multiple device lines. All devices so listed are checked\n" | |
459 | " for relevant super blocks when assembling arrays.\n" | |
460 | "\n" | |
461 | " An array line start with the word 'array'. This is followed by the name of\n" | |
462 | " the array device in the filesystem, e.g. '/dev/md2'. Subsequent words\n" | |
463 | " describe the identity of the array, used to recognise devices to include in the\n" | |
464 | " array. The identity can be given as a UUID with a word starting 'uuid=', or\n" | |
465 | " as a minor-number stored in the superblock using 'super-minor=', or as a list\n" | |
466 | " of devices. This is given as a comma separated list of names, possibly\n" | |
5787fa49 | 467 | " containing wildcards, preceded by 'devices='. If multiple critea are given,\n" |
e0d19036 NB |
468 | " than a device must match all of them to be considered.\n" |
469 | "\n" | |
470 | " A mailaddr line starts with the word 'mailaddr' and should contain exactly\n" | |
471 | " one Email address. 'mdadm --monitor --scan' will send alerts of failed drives\n" | |
472 | " to this Email address." | |
473 | "\n" | |
474 | " A program line starts with the word 'program' and should contain exactly\n" | |
475 | " one program name. 'mdadm --monitor --scan' will run this program when any\n" | |
476 | " event is detected.\n" | |
64c4757e NB |
477 | "\n" |
478 | ; | |
682c7051 NB |
479 | |
480 | ||
481 | /* name/number mappings */ | |
482 | ||
483 | mapping_t r5layout[] = { | |
cd29a5c8 NB |
484 | { "left-asymmetric", 0}, |
485 | { "right-asymmetric", 1}, | |
486 | { "left-symmetric", 2}, | |
487 | { "right-symmetric", 3}, | |
682c7051 NB |
488 | |
489 | { "default", 2}, | |
490 | { "la", 0}, | |
491 | { "ra", 1}, | |
492 | { "ls", 2}, | |
493 | { "rs", 3}, | |
494 | { NULL, 0} | |
495 | }; | |
496 | ||
497 | mapping_t pers[] = { | |
498 | { "linear", -1}, | |
499 | { "raid0", 0}, | |
500 | { "0", 0}, | |
501 | { "stripe", 0}, | |
502 | { "raid1", 1}, | |
503 | { "1", 1}, | |
504 | { "mirror", 1}, | |
505 | { "raid4", 4}, | |
506 | { "4", 4}, | |
507 | { "raid5", 5}, | |
508 | { "5", 5}, | |
e0d19036 NB |
509 | { "multipath", -4}, |
510 | { "mp", -4}, | |
98c6faba NB |
511 | { "raid6", 6}, |
512 | { "6", 6}, | |
e5329c37 NB |
513 | { "raid10", 10}, |
514 | { "10", 10}, | |
b5e64645 | 515 | { "faulty", -5}, |
682c7051 NB |
516 | { NULL, 0} |
517 | }; | |
e0d19036 NB |
518 | |
519 | ||
520 | mapping_t modes[] = { | |
521 | { "assemble", ASSEMBLE}, | |
522 | { "build", BUILD}, | |
523 | { "create", CREATE}, | |
524 | { "manage", MANAGE}, | |
525 | { "misc", MISC}, | |
526 | { "monitor", MONITOR}, | |
dd0781e5 | 527 | { "grow", GROW}, |
e0d19036 | 528 | }; |
b5e64645 NB |
529 | |
530 | mapping_t faultylayout[] = { | |
531 | { "write-transient", WriteTransient }, | |
532 | { "wt", WriteTransient }, | |
533 | { "read-transient", ReadTransient }, | |
534 | { "rt", ReadTransient }, | |
535 | { "write-persistent", WritePersistent }, | |
536 | { "wp", WritePersistent }, | |
537 | { "read-persistent", ReadPersistent }, | |
538 | { "rp", ReadPersistent }, | |
539 | { "write-all", WriteAll }, | |
540 | { "wa", WriteAll }, | |
541 | { "read-fixable", ReadFixable }, | |
542 | { "rf", ReadFixable }, | |
543 | ||
544 | { "clear", ClearErrors}, | |
545 | { "flush", ClearFaults}, | |
546 | { "none", ClearErrors}, | |
547 | { "default", ClearErrors}, | |
548 | { NULL, 0} | |
549 | }; |