]> git.ipfire.org Git - thirdparty/mdadm.git/blame - mdadm.8
mdadm-0.8.2
[thirdparty/mdadm.git] / mdadm.8
CommitLineData
52826846 1.\" -*- nroff -*-
e0d19036 2.TH MDADM 8
52826846 3.SH NAME
9a9dab36 4mdadm \- manage MD devices
cd29a5c8
NB
5.I aka
6Linux Software Raid.
7
52826846
NB
8.SH SYNOPSIS
9
e0d19036 10.BI mdadm " [mode] <raiddevice> [options] <component-devices>"
52826846
NB
11
12.SH DESCRIPTION
13RAID devices are virtual devices created from two or more
cd29a5c8
NB
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 .
9a9dab36 35.B mdadm
e0d19036 36only provides limited support for MULTIPATH as yet.
52826846 37
9a9dab36 38.B mdadm
11a3e71d
NB
39is a program that can be used to create, manage, and monitor
40MD devices. As
cd29a5c8
NB
41such it provides a similar set of functionality to the
42.B raidtools
43packages.
44The key differences between
9a9dab36 45.B mdadm
cd29a5c8
NB
46and
47.B raidtools
48are:
49.IP \(bu 4
9a9dab36 50.B mdadm
cd29a5c8
NB
51is a single program and not a collection of programs.
52.IP \(bu 4
9a9dab36 53.B mdadm
cd29a5c8 54can perform (almost) all of its functions without having a
9a9dab36 55configuration file. Also mdadm helps with management of the configuration
cd29a5c8
NB
56file.
57.IP \(bu 4
9a9dab36 58.B mdadm
e0d19036 59can provide information about your arrays (through Query, Detail, and Examine)
cd29a5c8
NB
60that
61.B raidtools
62cannot.
52826846
NB
63
64.SH MODES
e0d19036 65mdadm has 6 major modes of operation:
cd29a5c8
NB
66.TP
67.B Assemble
68Assemble the parts of a previously created
52826846
NB
69array into an active array. Components can be explicitly given
70or can be searched for.
9a9dab36 71.B mdadm
cd29a5c8
NB
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
e0d19036
NB
87.B Manage
88This is for doing things to specific components of an array such as
89adding new spares and removing faulty devices.
cd29a5c8
NB
90
91.TP
e0d19036
NB
92.B Misc
93This mode allows operations on independent devices such as examine MD
94superblocks, erasing old superblocks and stopping active arrays.
cd29a5c8
NB
95
96.TP
97.B "Follow or Monitor"
98Monitor one or more md devices and act on any state changes.
99
52826846
NB
100.SH OPTIONS
101
102Available options are:
103
cd29a5c8
NB
104.TP
105.BR -A ", " --assemble
106Assemble an existing array.
52826846 107
cd29a5c8
NB
108.TP
109.BR -B ", " --build
110Build a legacy array without superblocks.
52826846 111
cd29a5c8
NB
112.TP
113.BR -C ", " --create
114Create a new array.
52826846 115
e0d19036
NB
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
cd29a5c8
NB
123.TP
124.BR -D ", " --detail
125Print detail of one or more md devices.
52826846 126
cd29a5c8
NB
127.TP
128.BR -E ", " --examine
129Print content of md superblock on device(s).
52826846 130
cd29a5c8
NB
131.TP
132.BR -F ", " --follow ", " --monitor
133Select
134.B Monitor
135mode.
52826846 136
cd29a5c8
NB
137.TP
138.BR -h ", " --help
139Display help message or, after above option, mode specific help message.
52826846 140
cd29a5c8
NB
141.TP
142.BR -V ", " --version
9a9dab36 143Print version information for mdadm.
52826846 144
cd29a5c8
NB
145.TP
146.BR -v ", " --verbose
147Be more verbose about what is happening.
52826846 148
cd29a5c8
NB
149.TP
150.BR -b ", " --brief
151Be less verbose. This is used with
152.B --detail
153and
154.BR --examine .
52826846 155
e0d19036
NB
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
cd29a5c8 186.SH For create or build:
52826846 187
cd29a5c8
NB
188.TP
189.BR -c ", " --chunk=
190Specify chunk size of kibibytes. The default is 64.
52826846 191
cd29a5c8
NB
192.TP
193.BR --rounding=
194Specify rounding factor for linear array (==chunk size)
52826846 195
cd29a5c8
NB
196.TP
197.BR -l ", " --level=
198Set raid level. Options are: linear, raid0, 0, stripe, raid1, 1, mirror, raid5, 4,
c913b90e 199raid5, 5, multipath, mp. Obviously some of these are synonymous.
cd29a5c8 200Only the first 4 are valid when Building.
52826846 201
cd29a5c8
NB
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.
52826846 206
cd29a5c8
NB
207.TP
208.BR --layout=
209same as --parity
52826846 210
cd29a5c8 211.TP
b83d95f3 212.BR -n ", " --raid-devices=
cd29a5c8
NB
213number of active devices in array.
214
215.TP
b83d95f3
NB
216.BR -x ", " --spare-devices=
217number of spare (eXtra) devices in initial array. Spares can be added
cd29a5c8
NB
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.
52826846
NB
229
230.SH For assemble:
231
cd29a5c8
NB
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
cd29a5c8
NB
244.TP
245.BR -f ", " --force
52826846
NB
246Assemble the array even if some superblocks appear out-of-date
247
cd29a5c8
NB
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.
52826846 257
e0d19036 258.SH For Manage mode:
52826846 259
cd29a5c8
NB
260.TP
261.BR -a ", " --add
262'''add, or
263hotadd listed devices.
52826846 264
cd29a5c8
NB
265.TP
266.BR -r ", " --remove
267remove listed devices. The must not be active. i.e. they should
268be failed or spare devices.
52826846 269
cd29a5c8
NB
270.TP
271.BR -f ", " --fail
272mark listed devices as faulty.
52826846 273
cd29a5c8
NB
274.TP
275.BR --set-faulty
276same as --fail.
52826846 277
e0d19036
NB
278.SH For Misc mode:
279
cd29a5c8
NB
280.TP
281.BR -R ", " --run
282start a partially built array.
52826846 283
cd29a5c8
NB
284.TP
285.BR -S ", " --stop
286deactivate array, releasing all resources.
52826846 287
cd29a5c8
NB
288.TP
289.BR -o ", " --readonly
290mark array as readonly.
52826846 291
cd29a5c8
NB
292.TP
293.BR -w ", " --readwrite
294mark array as readwrite.
52826846 295
e0d19036
NB
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.
52826846 303
e0d19036
NB
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
52826846 321
cd29a5c8
NB
322.HP 12
323Usage:
9a9dab36 324.B mdadm --assemble
cd29a5c8
NB
325.I device options...
326.HP 12
327Usage:
9a9dab36 328.B mdadm --assemble --scan
cd29a5c8 329.I options...
52826846 330
cd29a5c8 331.PP
52826846 332This usage assembles one or more raid arrays from pre-existing components.
9a9dab36 333For each array, mdadm needs to know the md device, the identity of the
e0d19036 334array, and a number of component-devices. These can be found in a number of ways.
52826846
NB
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
9a9dab36 339can be started with a single mdadm command.
52826846 340
cd29a5c8 341The identity can be given with the
52826846 342.B --uuid
cd29a5c8
NB
343option, with the
344.B --super-minor
345option, can be found in in the config file, or will be taken from the
e0d19036 346super block on the first component-device listed on the command line.
52826846
NB
347
348Devices can be given on the
349.B --assemble
cd29a5c8
NB
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.
52826846
NB
352
353The config file is only used if explicitly named with
354.B --config
355or requested with
356.B --scan.
357In the later case,
9a9dab36 358.B /etc/mdadm.conf
52826846
NB
359is used.
360
361If
362.B --scan
cd29a5c8
NB
363is not given, then the config file will only be used to find the
364identity of md arrays.
52826846 365
cd29a5c8
NB
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.
52826846 374
52826846 375
cd29a5c8 376.SH BUILD MODE
52826846 377
cd29a5c8
NB
378.HP 12
379Usage:
9a9dab36 380.B mdadm --build
cd29a5c8
NB
381.I device
382.BI --chunk= X
383.BI --level= Y
b83d95f3 384.BI --raid-devices= Z
cd29a5c8
NB
385.I devices
386
387.PP
52826846 388This usage is similar to
cd29a5c8 389.BR --create .
52826846 390The difference is that it creates a legacy array without a superblock. With
cd29a5c8 391these arrays there is no difference between initially creating the array and
52826846
NB
392subsequently assembling the array, except that hopefully there is useful
393data there in the second case.
394
cd29a5c8
NB
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:
9a9dab36 402.B mdadm --create
cd29a5c8
NB
403.I device
404.BI --chunk= X
405.BI --level= Y
406.br
b83d95f3 407.BI --raid-devices= Z
cd29a5c8
NB
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
e0d19036 425'''option is given, it is not necessary to list any component-devices in this command.
cd29a5c8
NB
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.
52826846 441
e0d19036 442.SH MANAGE MODE
cd29a5c8
NB
443.HP 12
444Usage:
e0d19036
NB
445.B mdadm
446.I device
447.I options... devices...
cd29a5c8
NB
448.PP
449
e0d19036
NB
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:
9a9dab36 467.B mdadm
e0d19036
NB
468.I options ...
469.I devices ...
470.PP
cd29a5c8 471
e0d19036
NB
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.
cd29a5c8 485.B --brief
e0d19036
NB
486will cause the output to be less detailed and format to be
487suitable for inclusion in
9a9dab36 488.BR /etc/mdadm.conf .
cd29a5c8 489
e0d19036
NB
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
cd29a5c8
NB
530.HP 12
531Usage:
e0d19036
NB
532.B mdadm --monitor
533.I options... devices...
534
cd29a5c8 535.PP
e0d19036
NB
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
cd29a5c8
NB
557
558If
559.B --scan
e0d19036
NB
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
cd29a5c8 565.B --scan
e0d19036
NB
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 .
cd29a5c8 570
e0d19036
NB
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
9a9dab36 649.B mdadm
e0d19036
NB
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
cd29a5c8
NB
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
9a9dab36 673.BR mdadm .
cd29a5c8 674
9a9dab36 675.SS /etc/mdadm.conf
cd29a5c8 676
11a3e71d
NB
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.
cd29a5c8 682
52826846
NB
683
684.SH TODO
685
cd29a5c8 686Finish and document Follow mode.
52826846
NB
687
688.SH SEE ALSO
cd29a5c8
NB
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
56eb10c0
NB
710.BR mdadm.conf (5),
711.BR md (4).
712.PP
52826846
NB
713.IR raidtab (5),
714.IR raid0run (8),
715.IR raidstop (8),
716.IR mkraid (8)