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