]> git.ipfire.org Git - thirdparty/mdadm.git/blob - mdadm.8
mdadm-0.8.1
[thirdparty/mdadm.git] / mdadm.8
1 .\" -*- nroff -*-
2 .TH MDADM 8
3 .SH NAME
4 mdadm \- manage MD devices
5 .I aka
6 Linux Software Raid.
7
8 .SH SYNOPSIS
9
10 .BI mdadm " [mode] <raiddevice> [options] <component-devices>"
11
12 .SH DESCRIPTION
13 RAID devices are virtual devices created from two or more
14 real block devices. This allows multiple devices (typically disk
15 drives or partitions there-of) to be combined into a single device to
16 hold (for example) a single filesystem.
17 Some RAID levels included redundancy and so can survive some degree of
18 device failure.
19
20 Linux Software RAID devices are implemented through the md (Multiple Devices) device driver.
21
22 Currently, Linux supports
23 .B LINEAR
24 md devices,
25 .B RAID0
26 (striping),
27 .B RAID1
28 (mirroring),
29 .B RAID4
30 and
31 .B RAID5.
32
33 Recent kernels (2002) also support a mode known as
34 .BR MULTIPATH .
35 .B mdadm
36 only provides limited support for MULTIPATH as yet.
37
38 .B mdadm
39 is a program that can be used to create, manage, and monitor
40 MD devices. As
41 such it provides a similar set of functionality to the
42 .B raidtools
43 packages.
44 The key differences between
45 .B mdadm
46 and
47 .B raidtools
48 are:
49 .IP \(bu 4
50 .B mdadm
51 is a single program and not a collection of programs.
52 .IP \(bu 4
53 .B mdadm
54 can perform (almost) all of its functions without having a
55 configuration file. Also mdadm helps with management of the configuration
56 file.
57 .IP \(bu 4
58 .B mdadm
59 can provide information about your arrays (through Query, Detail, and Examine)
60 that
61 .B raidtools
62 cannot.
63
64 .SH MODES
65 mdadm has 6 major modes of operation:
66 .TP
67 .B Assemble
68 Assemble the parts of a previously created
69 array into an active array. Components can be explicitly given
70 or can be searched for.
71 .B mdadm
72 checks that the components
73 do form a bona fide array, and can, on request, fiddle superblock
74 information so as to assemble a faulty array.
75
76 .TP
77 .B Build
78 Build a legacy array without per-device superblocks.
79
80 .TP
81 .B Create
82 Create a new array with per-device superblocks.
83 '''It can progress
84 '''in several step create-add-add-run or it can all happen with one command.
85
86 .TP
87 .B Manage
88 This is for doing things to specific components of an array such as
89 adding new spares and removing faulty devices.
90
91 .TP
92 .B Misc
93 This mode allows operations on independent devices such as examine MD
94 superblocks, erasing old superblocks and stopping active arrays.
95
96 .TP
97 .B "Follow or Monitor"
98 Monitor one or more md devices and act on any state changes.
99
100 .SH OPTIONS
101
102 Available options are:
103
104 .TP
105 .BR -A ", " --assemble
106 Assemble an existing array.
107
108 .TP
109 .BR -B ", " --build
110 Build a legacy array without superblocks.
111
112 .TP
113 .BR -C ", " --create
114 Create a new array.
115
116 .TP
117 .BR -Q ", " --query
118 Examine a device to see
119 (1) if it is an md device and (2) if it is a component of an md
120 array.
121 Information about what is discovered is presented.
122
123 .TP
124 .BR -D ", " --detail
125 Print detail of one or more md devices.
126
127 .TP
128 .BR -E ", " --examine
129 Print content of md superblock on device(s).
130
131 .TP
132 .BR -F ", " --follow ", " --monitor
133 Select
134 .B Monitor
135 mode.
136
137 .TP
138 .BR -h ", " --help
139 Display help message or, after above option, mode specific help message.
140
141 .TP
142 .BR -V ", " --version
143 Print version information for mdadm.
144
145 .TP
146 .BR -v ", " --verbose
147 Be more verbose about what is happening.
148
149 .TP
150 .BR -b ", " --brief
151 Be less verbose. This is used with
152 .B --detail
153 and
154 .BR --examine .
155
156 .TP
157 .BR -f ", " --force
158 Be more forceful about certain operations. See the various modes of
159 the exact meaning of this option in different contexts.
160
161 .TP
162 .BR -c ", " --config=
163 Specify the config file. Default is
164 .BR /etc/mdadm.conf .
165
166 .TP
167 .BR -s ", " --scan
168 scan config file or
169 .B /proc/mdstat
170 for missing information.
171 In general, this option gives
172 .B mdadm
173 permission to get any missing information, like component devices,
174 array devices, array identities, and alert destination from the
175 configuration file:
176 .BR /etc/mdadm.conf .
177 One exception is MISC mode when using
178 .B --detail
179 or
180 .B --stop
181 in which case
182 .B --scan
183 says to get a list of array devices from
184 .BR /proc/mdstat .
185
186 .SH For create or build:
187
188 .TP
189 .BR -c ", " --chunk=
190 Specify chunk size of kibibytes. The default is 64.
191
192 .TP
193 .BR --rounding=
194 Specify rounding factor for linear array (==chunk size)
195
196 .TP
197 .BR -l ", " --level=
198 Set raid level. Options are: linear, raid0, 0, stripe, raid1, 1, mirror, raid5, 4,
199 raid5, 5, multipath, mp. Obviously some of these are synonymous.
200 Only the first 4 are valid when Building.
201
202 .TP
203 .BR -p ", " --parity=
204 Set raid5 parity algorithm. Options are:
205 {left,right}-{,a}symmetric, la, ra, ls, rs. The default is left-symmetric.
206
207 .TP
208 .BR --layout=
209 same as --parity
210
211 .TP
212 .BR -n ", " --raid-disks=
213 number of active devices in array.
214
215 .TP
216 .BR -x ", " --spare-disks=
217 number of spare (eXtra) disks in initial array. Spares can be added
218 and removed later.
219
220 .TP
221 .BR -z ", " --size=
222 Amount (in Kibibytes) of space to use from each drive in RAID1/4/5.
223 This must be a multiple of the chunk size, and must leave about 128Kb
224 of space at the end of the drive for the RAID superblock.
225 If this is not specified
226 (as it normally is not) the smallest drive (or partition) sets the
227 size, though if there is a variance among the drives of greater than 1%, a warning is
228 issued.
229
230 .SH For assemble:
231
232 .TP
233 .BR -u ", " --uuid=
234 uuid of array to assemble. Devices which don't have this uuid are
235 excluded
236
237 .TP
238 .BR -m ", " --super-minor=
239 Minor number of device that array was created for. Devices which
240 don't have this minor number are excluded. If you create an array as
241 /dev/md1, then all superblock will contain the minor number 1, even if
242 the array is later assembled as /dev/md2.
243
244 .TP
245 .BR -f ", " --force
246 Assemble the array even if some superblocks appear out-of-date
247
248 .TP
249 .BR -R ", " --run
250 Attempt to start the array even if fewer drives were given than are
251 needed for a full array. Normally if not all drives are found and
252 .B --scan
253 is not used, then the array will be assembled but not started.
254 With
255 .B --run
256 an attempt will be made to start it anyway.
257
258 .SH For Manage mode:
259
260 .TP
261 .BR -a ", " --add
262 '''add, or
263 hotadd listed devices.
264
265 .TP
266 .BR -r ", " --remove
267 remove listed devices. The must not be active. i.e. they should
268 be failed or spare devices.
269
270 .TP
271 .BR -f ", " --fail
272 mark listed devices as faulty.
273
274 .TP
275 .BR --set-faulty
276 same as --fail.
277
278 .SH For Misc mode:
279
280 .TP
281 .BR -R ", " --run
282 start a partially built array.
283
284 .TP
285 .BR -S ", " --stop
286 deactivate array, releasing all resources.
287
288 .TP
289 .BR -o ", " --readonly
290 mark array as readonly.
291
292 .TP
293 .BR -w ", " --readwrite
294 mark array as readwrite.
295
296 .TP
297 .B --zero-superblock
298 If the device contains a valid md superblock, the block is
299 over-written with zeros. With
300 --force
301 the block where the superblock would be is over-written even if it
302 doesn't appear to be valid.
303
304 .SH For Monitor mode:
305 .TP
306 .BR -m ", " --mail
307 Give a mail address to send alerts to.
308
309 .TP
310 .BR -p ", " --program ", " --alert
311 Give a program to be run whenever an event is detected.
312
313 .TP
314 .BR -d ", " --delay
315 Give a delay in seconds.
316 .B mdadm
317 polls the md arrays and then waits this many seconds before polling
318 again. The default is 60 seconds.
319
320 .SH ASSEMBLE MODE
321
322 .HP 12
323 Usage:
324 .B mdadm --assemble
325 .I device options...
326 .HP 12
327 Usage:
328 .B mdadm --assemble --scan
329 .I options...
330
331 .PP
332 This usage assembles one or more raid arrays from pre-existing components.
333 For each array, mdadm needs to know the md device, the identity of the
334 array, and a number of component-devices. These can be found in a number of ways.
335
336 The md device is either given before
337 .B --scan
338 or is found from the config file. In the latter case, multiple md devices
339 can be started with a single mdadm command.
340
341 The identity can be given with the
342 .B --uuid
343 option, with the
344 .B --super-minor
345 option, can be found in in the config file, or will be taken from the
346 super block on the first component-device listed on the command line.
347
348 Devices can be given on the
349 .B --assemble
350 command line or from the config file. Only devices which have an md
351 superblock which contains the right identity will be considered for any device.
352
353 The config file is only used if explicitly named with
354 .B --config
355 or requested with
356 .B --scan.
357 In the later case,
358 .B /etc/mdadm.conf
359 is used.
360
361 If
362 .B --scan
363 is not given, then the config file will only be used to find the
364 identity of md arrays.
365
366 Normally the array will be started after it is assembled. However is
367 .B --scan
368 is not given and insufficient drives were lists to start a complete
369 (non-degraded) array, then the array is not started (to guard against
370 usage errors). To insist that the array be started in this case (as
371 may work for RAID1 or RAID5), give the
372 .B --run
373 flag.
374
375
376 .SH BUILD MODE
377
378 .HP 12
379 Usage:
380 .B mdadm --build
381 .I device
382 .BI --chunk= X
383 .BI --level= Y
384 .BI --raid-disks= Z
385 .I devices
386
387 .PP
388 This usage is similar to
389 .BR --create .
390 The difference is that it creates a legacy array without a superblock. With
391 these arrays there is no difference between initially creating the array and
392 subsequently assembling the array, except that hopefully there is useful
393 data there in the second case.
394
395 The level may only be 0, raid0, or linear. All devices must be listed
396 and the array will be started once complete.
397
398 .SH CREATE MODE
399
400 .HP 12
401 Usage:
402 .B mdadm --create
403 .I device
404 .BI --chunk= X
405 .BI --level= Y
406 .br
407 .BI --raid-disks= Z
408 .I devices
409
410 .PP
411 This usage will initialise a new md array, associate some devices with
412 it, and activate the array.
413
414 As devices are added, they are checked to see if they contain raid
415 superblocks or filesystems. They are also check to see if the variance in
416 device size exceeds 1%.
417
418 If any discrepancy is found, the array will not automatically be run, though
419 the presence of a
420 .B --run
421 can override this caution.
422
423 '''If the
424 '''.B --size
425 '''option is given, it is not necessary to list any component-devices in this command.
426 '''They can be added later, before a
427 '''.B --run.
428 '''If no
429 '''.B --size
430 '''is given, the apparent size of the smallest drive given is used.
431
432 The General Management options that are valid with --create are:
433 .TP
434 .B --run
435 insist of running the array even if some devices look like they might
436 be in use.
437
438 .TP
439 .B --readonly
440 start the array readonly - not supported yet.
441
442 .SH MANAGE MODE
443 .HP 12
444 Usage:
445 .B mdadm
446 .I device
447 .I options... devices...
448 .PP
449
450 This usage will allow individual devices in an array to be failed,
451 removed or added. It is possible to perform multiple operations with
452 on command. For example:
453 .br
454 mdadm /dev/md0 -f /dev/hda1 -r /dev/hda1 /a /dev/hda1
455 .br
456 will firstly mark
457 .B /dev/hda1
458 as faulty in
459 .B /dev/md0
460 and will then remove it from the array and finally add it back
461 in as a spare. However only one md array can be affect by a single
462 command.
463
464 .SH MISC MODE
465 .HP 12
466 Usage:
467 .B mdadm
468 .I options ...
469 .I devices ...
470 .PP
471
472 MISC mode includes a number if distinct operations that
473 operate on distinct devices. The operations are:
474 .TP
475 --query
476 The device is examined to see if it is
477 (1) an active md array, or
478 (2) a component of an md array.
479 The information discovered is reported.
480
481 .TP
482 --detail
483 The device should be an active md device. mdadm will display
484 a detailed description of the array.
485 .B --brief
486 will cause the output to be less detailed and format to be
487 suitable for inclusion in
488 .BR /etc/mdadm.conf .
489
490 .TP
491 --examine
492 The device should be a component of an md array. mdadm will
493 read the md superblock of the device and display the contents.
494 If
495 .B --brief
496 is given, or
497 .B --scan
498 then multiple devices that are components of the one array
499 are grouped together and reported in a single entry suitable
500 for inclusion in
501 .BR /etc/mdadm.conf .
502
503 Have
504 .B --scan
505 without listing any devices will cause all devices listed in the
506 config file to be examined.
507
508 .TP
509 --stop
510 This devices should active md arrays which will be deactivated, if
511 they are not currently in use.
512
513 .TP
514 --run
515 This will fully activate a partially assembled md array.
516
517 .TP
518 --readonly
519 This will mark an active array as read-only, providing that it is
520 not currently being used.
521
522 .TP
523 --readwrite
524 This will change a
525 .B readonly
526 array back to being read/write.
527
528 .SH MONITOR MODE
529
530 .HP 12
531 Usage:
532 .B mdadm --monitor
533 .I options... devices...
534
535 .PP
536 This usage causes
537 .B mdadm
538 to periodically poll a number of md arrays and to report on any events
539 noticed.
540 .B mdadm
541 will never exit once it decides that there are arrays to be checked,
542 so it should normally be run in the background.
543
544 If any devices are listed on the command line,
545 .B mdadm
546 will only monitor those devices. Otherwise all arrays listed in the
547 configuration file will be monitored. Further, if
548 .B --scan
549 is given, then any other md devices that appear in
550 .B /proc/mdstat
551 will also be monitored.
552
553 The result of monitoring the arrays is the generation of events.
554 These events are passed to a separate program (is specified) and may
555 be mail to a given E-mail address.
556
557
558 If
559 .B --scan
560 is given, then a program or an E-mail address must be specified on the
561 command line or in the config file. If neither are available, then
562 .B mdadm
563 will not monitor anything.
564 Without
565 .B --scan
566 .B mdadm
567 will continue monitoring along as something was found to monitor. If
568 no program or email is given, then each event is reported to
569 .BR stdout .
570
571 The different events are:
572
573 .RS 4
574 .TP
575 .B DeviceDisappeared
576 An md array which previously was configured appear to no longer be
577 configured.
578
579 .TP
580 .B RebuildStarted
581 An md array started reconstruction.
582
583 .TP
584 .BI Rebuild NN
585 Where
586 .I NN
587 is 20, 40, 60, or 80, this indicates that rebuild has passed that many
588 percentage of the total.
589
590 .TP
591 .B Fail
592 An active component device of an array has been marked as faulty.
593
594 .TP
595 .B FailSpare
596 A spare component device which was being rebuilt to replace a faulty
597 device has failed.
598
599 .TP
600 .B SpareActive
601 A spare component device which was being rebuilt to replace a faulty
602 device as been successfully rebuild and has been made active.
603
604 .TP
605 .B NewArray
606 A new md array has been detected in the
607 .B /proc/mdstat
608 file.
609
610 .TP
611 .B MoveSpare
612 A spare drive has been moved from one array in a
613 .B spare-group
614 to another to allow a failed drive to be replaced.
615
616 .RE
617
618 Only
619 .B Fail
620 and
621 .B FailSpare
622 cause Email to be sent. All events cause the program to be run.
623 The program is run with two or three arguments, they being the event
624 name, the array device and possibly a second device.
625
626 Each event has an associated array device (e.g.
627 .BR /dev/md1 )
628 and possibly a second device. For
629 .BR Fail ,
630 .BR FailSpare ,
631 and
632 .B SpareActive
633 the second device is the relevant component device.
634 For
635 .B MoveSpare
636 the second device is the array that the spare was moved from.
637
638 For
639 .B mdadm
640 to move spares from one array to another, the different arrays need to
641 be labelled with the same
642 .B spare-group
643 in the configuration file. The
644 .B spare-group
645 name can be any string. It is only necessary that different spare
646 groups use different name.
647
648 When
649 .B mdadm
650 detects that an array which is in a spare group has fewer active
651 devices than necessary for the complete array, and has no spare
652 devices, it will look for another array in the same spare group that
653 has a full complement of working drive and a spare. It will then
654 attempt to remove the spare from the second drive and add it to the
655 first.
656 If the removal succeeds but the adding fails, then it is added back to
657 the original array.
658
659
660 '''.SH BUGS
661 '''no known bugs.
662
663 .SH FILES
664
665 .SS /proc/mdstat
666
667 If you're using the
668 .B /proc
669 filesystem,
670 .B /proc/mdstat
671 gives you informations about md devices status.
672 This file is not currently used by
673 .BR mdadm .
674
675 .SS /etc/mdadm.conf
676
677 The config file lists which devices may be scanned to see if
678 they contain MD super block, and gives identifying information
679 (e.g. UUID) about known MD arrays. See
680 .BR mdadm.conf (5)
681 for more details.
682
683
684 .SH TODO
685
686 Finish and document Follow mode.
687
688 .SH SEE ALSO
689 For information on the various levels of
690 RAID, check out:
691
692 .IP
693 .UR http://ostenfeld.dk/~jakob/Software-RAID.HOWTO/
694 http://ostenfeld.dk/~jakob/Software-RAID.HOWTO/
695 .UE
696 .PP
697 for new releases of the RAID driver check out:
698
699 .IP
700 .UR ftp://ftp.kernel.org/pub/linux/kernel/people/mingo/raid-patches
701 ftp://ftp.kernel.org/pub/linux/kernel/people/mingo/raid-patches
702 .UE
703 .PP
704 or
705 .IP
706 .UR http://www.cse.unsw.edu.au/~neilb/patches/linux-stable/
707 http://www.cse.unsw.edu.au/~neilb/patches/linux-stable/
708 .URk
709 .PP
710 .BR mdadm.conf (5),
711 .BR md (4).
712 .PP
713 .IR raidtab (5),
714 .IR raid0run (8),
715 .IR raidstop (8),
716 .IR mkraid (8)