]> git.ipfire.org Git - thirdparty/mdadm.git/blame - md.4
Create: add support for RAID0 layouts.
[thirdparty/mdadm.git] / md.4
CommitLineData
519561f7
NB
1.\" Copyright Neil Brown and others.
2.\" This program is free software; you can redistribute it and/or modify
3.\" it under the terms of the GNU General Public License as published by
4.\" the Free Software Foundation; either version 2 of the License, or
5.\" (at your option) any later version.
6.\" See file COPYING in distribution for details.
17645275 7.if n .pl 1000v
56eb10c0
NB
8.TH MD 4
9.SH NAME
93e790af 10md \- Multiple Device driver aka Linux Software RAID
56eb10c0
NB
11.SH SYNOPSIS
12.BI /dev/md n
13.br
14.BI /dev/md/ n
e0fe762a
N
15.br
16.BR /dev/md/ name
56eb10c0
NB
17.SH DESCRIPTION
18The
19.B md
20driver provides virtual devices that are created from one or more
e0d19036 21independent underlying devices. This array of devices often contains
02b76eea
NB
22redundancy and the devices are often disk drives, hence the acronym RAID
23which stands for a Redundant Array of Independent Disks.
56eb10c0
NB
24.PP
25.B md
599e5a36
NB
26supports RAID levels
271 (mirroring),
284 (striped array with parity device),
295 (striped array with distributed parity information),
306 (striped array with distributed dual redundancy information), and
3110 (striped and mirrored).
32If some number of underlying devices fails while using one of these
98c6faba
NB
33levels, the array will continue to function; this number is one for
34RAID levels 4 and 5, two for RAID level 6, and all but one (N-1) for
93e790af 35RAID level 1, and dependent on configuration for level 10.
56eb10c0
NB
36.PP
37.B md
e0d19036 38also supports a number of pseudo RAID (non-redundant) configurations
570c0542
NB
39including RAID0 (striped array), LINEAR (catenated array),
40MULTIPATH (a set of different interfaces to the same device),
41and FAULTY (a layer over a single device into which errors can be injected).
56eb10c0 42
e0fe762a 43.SS MD METADATA
bcbb92d4 44Each device in an array may have some
e0fe762a
N
45.I metadata
46stored in the device. This metadata is sometimes called a
47.BR superblock .
48The metadata records information about the structure and state of the array.
570c0542 49This allows the array to be reliably re-assembled after a shutdown.
56eb10c0 50
570c0542
NB
51From Linux kernel version 2.6.10,
52.B md
e0fe762a 53provides support for two different formats of metadata, and
570c0542
NB
54other formats can be added. Prior to this release, only one format is
55supported.
56
b3f1c093 57The common format \(em known as version 0.90 \(em has
570c0542 58a superblock that is 4K long and is written into a 64K aligned block that
11a3e71d 59starts at least 64K and less than 128K from the end of the device
56eb10c0
NB
60(i.e. to get the address of the superblock round the size of the
61device down to a multiple of 64K and then subtract 64K).
11a3e71d 62The available size of each device is the amount of space before the
56eb10c0
NB
63super block, so between 64K and 128K is lost when a device in
64incorporated into an MD array.
93e790af 65This superblock stores multi-byte fields in a processor-dependent
570c0542
NB
66manner, so arrays cannot easily be moved between computers with
67different processors.
68
b3f1c093 69The new format \(em known as version 1 \(em has a superblock that is
570c0542
NB
70normally 1K long, but can be longer. It is normally stored between 8K
71and 12K from the end of the device, on a 4K boundary, though
72variations can be stored at the start of the device (version 1.1) or 4K from
73the start of the device (version 1.2).
e0fe762a 74This metadata format stores multibyte data in a
93e790af 75processor-independent format and supports up to hundreds of
570c0542 76component devices (version 0.90 only supports 28).
56eb10c0 77
e0fe762a 78The metadata contains, among other things:
56eb10c0
NB
79.TP
80LEVEL
11a3e71d 81The manner in which the devices are arranged into the array
956a13fb 82(LINEAR, RAID0, RAID1, RAID4, RAID5, RAID10, MULTIPATH).
56eb10c0
NB
83.TP
84UUID
85a 128 bit Universally Unique Identifier that identifies the array that
93e790af 86contains this device.
56eb10c0 87
e0fe762a 88.PP
2a940e36
NB
89When a version 0.90 array is being reshaped (e.g. adding extra devices
90to a RAID5), the version number is temporarily set to 0.91. This
91ensures that if the reshape process is stopped in the middle (e.g. by
92a system crash) and the machine boots into an older kernel that does
93not support reshaping, then the array will not be assembled (which
94would cause data corruption) but will be left untouched until a kernel
95that can complete the reshape processes is used.
96
e0fe762a 97.SS ARRAYS WITHOUT METADATA
570c0542 98While it is usually best to create arrays with superblocks so that
93e790af
SW
99they can be assembled reliably, there are some circumstances when an
100array without superblocks is preferred. These include:
570c0542
NB
101.TP
102LEGACY ARRAYS
11a3e71d
NB
103Early versions of the
104.B md
956a13fb 105driver only supported LINEAR and RAID0 configurations and did not use
570c0542
NB
106a superblock (which is less critical with these configurations).
107While such arrays should be rebuilt with superblocks if possible,
11a3e71d 108.B md
570c0542
NB
109continues to support them.
110.TP
111FAULTY
112Being a largely transparent layer over a different device, the FAULTY
113personality doesn't gain anything from having a superblock.
114.TP
115MULTIPATH
116It is often possible to detect devices which are different paths to
117the same storage directly rather than having a distinctive superblock
118written to the device and searched for on all paths. In this case,
119a MULTIPATH array with no superblock makes sense.
120.TP
121RAID1
956a13fb 122In some configurations it might be desired to create a RAID1
93e790af 123configuration that does not use a superblock, and to maintain the state of
095407fa 124the array elsewhere. While not encouraged for general use, it does
addc80c4 125have special-purpose uses and is supported.
11a3e71d 126
e0fe762a
N
127.SS ARRAYS WITH EXTERNAL METADATA
128
129From release 2.6.28, the
130.I md
131driver supports arrays with externally managed metadata. That is,
1e49aaa0 132the metadata is not managed by the kernel but rather by a user-space
e0fe762a
N
133program which is external to the kernel. This allows support for a
134variety of metadata formats without cluttering the kernel with lots of
135details.
136.PP
137.I md
138is able to communicate with the user-space program through various
139sysfs attributes so that it can make appropriate changes to the
1b17b4e4 140metadata \- for example to mark a device as faulty. When necessary,
e0fe762a
N
141.I md
142will wait for the program to acknowledge the event by writing to a
143sysfs attribute.
144The manual page for
145.IR mdmon (8)
146contains more detail about this interaction.
147
148.SS CONTAINERS
149Many metadata formats use a single block of metadata to describe a
150number of different arrays which all use the same set of devices.
151In this case it is helpful for the kernel to know about the full set
152of devices as a whole. This set is known to md as a
153.IR container .
154A container is an
155.I md
156array with externally managed metadata and with device offset and size
157so that it just covers the metadata part of the devices. The
158remainder of each device is available to be incorporated into various
159arrays.
160
56eb10c0 161.SS LINEAR
11a3e71d 162
956a13fb 163A LINEAR array simply catenates the available space on each
93e790af 164drive to form one large virtual drive.
11a3e71d
NB
165
166One advantage of this arrangement over the more common RAID0
167arrangement is that the array may be reconfigured at a later time with
93e790af
SW
168an extra drive, so the array is made bigger without disturbing the
169data that is on the array. This can even be done on a live
11a3e71d
NB
170array.
171
599e5a36
NB
172If a chunksize is given with a LINEAR array, the usable space on each
173device is rounded down to a multiple of this chunksize.
11a3e71d 174
56eb10c0 175.SS RAID0
11a3e71d
NB
176
177A RAID0 array (which has zero redundancy) is also known as a
178striped array.
e0d19036 179A RAID0 array is configured at creation with a
bcbb92d4 180.B "Chunk Size"
e0fe762a
N
181which must be a power of two (prior to Linux 2.6.31), and at least 4
182kibibytes.
e0d19036 183
2d465520 184The RAID0 driver assigns the first chunk of the array to the first
e0d19036 185device, the second chunk to the second device, and so on until all
e0fe762a 186drives have been assigned one chunk. This collection of chunks forms a
e0d19036 187.BR stripe .
93e790af 188Further chunks are gathered into stripes in the same way, and are
e0d19036
NB
189assigned to the remaining space in the drives.
190
2d465520
NB
191If devices in the array are not all the same size, then once the
192smallest device has been exhausted, the RAID0 driver starts
e0d19036
NB
193collecting chunks into smaller stripes that only span the drives which
194still have remaining space.
195
329dfc28
N
196A bug was introduced in linux 3.14 which changed the layout of blocks in
197a RAID0 beyond the region that is striped over all devices. This bug
198does not affect an array with all devices the same size, but can affect
199other RAID0 arrays.
200
201Linux 5.4 (and some stable kernels to which the change was backported)
202will not normally assemble such an array as it cannot know which layout
203to use. There is a module parameter "raid0.default_layout" which can be
204set to "1" to force the kernel to use the pre-3.14 layout or to "2" to
205force it to use the 3.14-and-later layout. when creating a new RAID0
206array,
207.I mdadm
208will record the chosen layout in the metadata in a way that allows newer
209kernels to assemble the array without needing a module parameter.
e0d19036 210
56eb10c0 211.SS RAID1
e0d19036
NB
212
213A RAID1 array is also known as a mirrored set (though mirrors tend to
5787fa49 214provide reflected images, which RAID1 does not) or a plex.
e0d19036
NB
215
216Once initialised, each device in a RAID1 array contains exactly the
217same data. Changes are written to all devices in parallel. Data is
218read from any one device. The driver attempts to distribute read
219requests across all devices to maximise performance.
220
221All devices in a RAID1 array should be the same size. If they are
222not, then only the amount of space available on the smallest device is
93e790af 223used (any extra space on other devices is wasted).
e0d19036 224
3dacb890
IP
225Note that the read balancing done by the driver does not make the RAID1
226performance profile be the same as for RAID0; a single stream of
227sequential input will not be accelerated (e.g. a single dd), but
228multiple sequential streams or a random workload will use more than one
229spindle. In theory, having an N-disk RAID1 will allow N sequential
230threads to read from all disks.
231
e0fe762a 232Individual devices in a RAID1 can be marked as "write-mostly".
1b17b4e4 233These drives are excluded from the normal read balancing and will only
e0fe762a
N
234be read from when there is no other option. This can be useful for
235devices connected over a slow link.
236
56eb10c0 237.SS RAID4
e0d19036
NB
238
239A RAID4 array is like a RAID0 array with an extra device for storing
aa88f531
NB
240parity. This device is the last of the active devices in the
241array. Unlike RAID0, RAID4 also requires that all stripes span all
e0d19036
NB
242drives, so extra space on devices that are larger than the smallest is
243wasted.
244
93e790af 245When any block in a RAID4 array is modified, the parity block for that
e0d19036
NB
246stripe (i.e. the block in the parity device at the same device offset
247as the stripe) is also modified so that the parity block always
93e790af 248contains the "parity" for the whole stripe. I.e. its content is
e0d19036
NB
249equivalent to the result of performing an exclusive-or operation
250between all the data blocks in the stripe.
251
252This allows the array to continue to function if one device fails.
253The data that was on that device can be calculated as needed from the
254parity block and the other data blocks.
255
56eb10c0 256.SS RAID5
e0d19036
NB
257
258RAID5 is very similar to RAID4. The difference is that the parity
259blocks for each stripe, instead of being on a single device, are
260distributed across all devices. This allows more parallelism when
93e790af 261writing, as two different block updates will quite possibly affect
e0d19036
NB
262parity blocks on different devices so there is less contention.
263
93e790af 264This also allows more parallelism when reading, as read requests are
e0d19036
NB
265distributed over all the devices in the array instead of all but one.
266
98c6faba
NB
267.SS RAID6
268
269RAID6 is similar to RAID5, but can handle the loss of any \fItwo\fP
270devices without data loss. Accordingly, it requires N+2 drives to
271store N drives worth of data.
272
273The performance for RAID6 is slightly lower but comparable to RAID5 in
274normal mode and single disk failure mode. It is very slow in dual
275disk failure mode, however.
276
599e5a36
NB
277.SS RAID10
278
93e790af 279RAID10 provides a combination of RAID1 and RAID0, and is sometimes known
599e5a36
NB
280as RAID1+0. Every datablock is duplicated some number of times, and
281the resulting collection of datablocks are distributed over multiple
282drives.
283
93e790af 284When configuring a RAID10 array, it is necessary to specify the number
8dc92b41
CAM
285of replicas of each data block that are required (this will usually
286be\ 2) and whether their layout should be "near", "far" or "offset"
287(with "offset" being available since Linux\ 2.6.18).
288
289.B About the RAID10 Layout Examples:
290.br
291The examples below visualise the chunk distribution on the underlying
292devices for the respective layout.
293
294For simplicity it is assumed that the size of the chunks equals the
295size of the blocks of the underlying devices as well as those of the
296RAID10 device exported by the kernel (for example \fB/dev/md/\fPname).
297.br
298Therefore the chunks\ /\ chunk numbers map directly to the blocks\ /\
299block addresses of the exported RAID10 device.
300
301Decimal numbers (0,\ 1, 2,\ ...) are the chunks of the RAID10 and due
302to the above assumption also the blocks and block addresses of the
303exported RAID10 device.
304.br
305Repeated numbers mean copies of a chunk\ /\ block (obviously on
306different underlying devices).
307.br
308Hexadecimal numbers (0x00,\ 0x01, 0x02,\ ...) are the block addresses
309of the underlying devices.
310
311.TP
312\fB "near" Layout\fP
313When "near" replicas are chosen, the multiple copies of a given chunk are laid
314out consecutively ("as close to each other as possible") across the stripes of
315the array.
316
317With an even number of devices, they will likely (unless some misalignment is
318present) lay at the very same offset on the different devices.
319.br
320This is as the "classic" RAID1+0; that is two groups of mirrored devices (in the
321example below the groups Device\ #1\ /\ #2 and Device\ #3\ /\ #4 are each a
322RAID1) both in turn forming a striped RAID0.
323
324.ne 10
325.B Example with 2\ copies per chunk and an even number\ (4) of devices:
326.TS
327tab(;);
328 C - - - -
329 C | C | C | C | C |
330| - | - | - | - | - |
331| C | C | C | C | C |
332| C | C | C | C | C |
333| C | C | C | C | C |
334| C | C | C | C | C |
335| C | C | C | C | C |
336| C | C | C | C | C |
337| - | - | - | - | - |
338 C C S C S
339 C C S C S
340 C C S S S
341 C C S S S.
342;
343;Device #1;Device #2;Device #3;Device #4
3440x00;0;0;1;1
3450x01;2;2;3;3
346\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.
347:;:;:;:;:
348\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.
3490x80;254;254;255;255
350;\\---------v---------/;\\---------v---------/
351;RAID1;RAID1
352;\\---------------------v---------------------/
353;RAID0
354.TE
355
356.ne 10
357.B Example with 2\ copies per chunk and an odd number\ (5) of devices:
358.TS
359tab(;);
360 C - - - - -
361 C | C | C | C | C | C |
362| - | - | - | - | - | - |
363| C | C | C | C | C | C |
364| C | C | C | C | C | C |
365| C | C | C | C | C | C |
366| C | C | C | C | C | C |
367| C | C | C | C | C | C |
368| C | C | C | C | C | C |
369| - | - | - | - | - | - |
370C.
371;
f99a9e15 372;Dev #1;Dev #2;Dev #3;Dev #4;Dev #5
8dc92b41
CAM
3730x00;0;0;1;1;2
3740x01;2;3;3;4;4
375\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.
376:;:;:;:;:;:
377\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.
3780x80;317;318;318;319;319
379;
380.TE
381
382.TP
383\fB "far" Layout\fP
384When "far" replicas are chosen, the multiple copies of a given chunk
385are laid out quite distant ("as far as reasonably possible") from each
386other.
387
388First a complete sequence of all data blocks (that is all the data one
389sees on the exported RAID10 block device) is striped over the
390devices. Then another (though "shifted") complete sequence of all data
391blocks; and so on (in the case of more than 2\ copies per chunk).
392
393The "shift" needed to prevent placing copies of the same chunks on the
394same devices is actually a cyclic permutation with offset\ 1 of each
395of the stripes within a complete sequence of chunks.
396.br
397The offset\ 1 is relative to the previous complete sequence of chunks,
398so in case of more than 2\ copies per chunk one gets the following
399offsets:
400.br
4011.\ complete sequence of chunks: offset\ =\ \ 0
402.br
4032.\ complete sequence of chunks: offset\ =\ \ 1
404.br
4053.\ complete sequence of chunks: offset\ =\ \ 2
406.br
407 :
408.br
409n.\ complete sequence of chunks: offset\ =\ n-1
410
411.ne 10
412.B Example with 2\ copies per chunk and an even number\ (4) of devices:
413.TS
414tab(;);
415 C - - - -
416 C | C | C | C | C |
417| - | - | - | - | - |
418| C | C | C | C | C | L
419| C | C | C | C | C | L
420| C | C | C | C | C | L
421| C | C | C | C | C | L
422| C | C | C | C | C | L
423| C | C | C | C | C | L
424| C | C | C | C | C | L
425| C | C | C | C | C | L
426| C | C | C | C | C | L
427| C | C | C | C | C | L
428| C | C | C | C | C | L
429| C | C | C | C | C | L
430| - | - | - | - | - |
431C.
432;
433;Device #1;Device #2;Device #3;Device #4
434;
4350x00;0;1;2;3;\\
4360x01;4;5;6;7;> [#]
437\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;:
438:;:;:;:;:;:
439\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;:
4400x40;252;253;254;255;/
4410x41;3;0;1;2;\\
4420x42;7;4;5;6;> [#]~
443\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;:
444:;:;:;:;:;:
445\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;:
4460x80;255;252;253;254;/
447;
448.TE
449
450.ne 10
451.B Example with 2\ copies per chunk and an odd number\ (5) of devices:
452.TS
453tab(;);
454 C - - - - -
455 C | C | C | C | C | C |
456| - | - | - | - | - | - |
457| C | C | C | C | C | C | L
458| C | C | C | C | C | C | L
459| C | C | C | C | C | C | L
460| C | C | C | C | C | C | L
461| C | C | C | C | C | C | L
462| C | C | C | C | C | C | L
463| C | C | C | C | C | C | L
464| C | C | C | C | C | C | L
465| C | C | C | C | C | C | L
466| C | C | C | C | C | C | L
467| C | C | C | C | C | C | L
468| C | C | C | C | C | C | L
469| - | - | - | - | - | - |
470C.
471;
f99a9e15 472;Dev #1;Dev #2;Dev #3;Dev #4;Dev #5
8dc92b41
CAM
473;
4740x00;0;1;2;3;4;\\
4750x01;5;6;7;8;9;> [#]
476\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;:
477:;:;:;:;:;:;:
478\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;:
4790x40;315;316;317;318;319;/
4800x41;4;0;1;2;3;\\
4810x42;9;5;6;7;8;> [#]~
482\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;:
483:;:;:;:;:;:;:
484\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;:
4850x80;319;315;316;317;318;/
486;
487.TE
488
489With [#]\ being the complete sequence of chunks and [#]~\ the cyclic permutation
490with offset\ 1 thereof (in the case of more than 2 copies per chunk there would
491be ([#]~)~,\ (([#]~)~)~,\ ...).
492
493The advantage of this layout is that MD can easily spread sequential reads over
494the devices, making them similar to RAID0 in terms of speed.
495.br
496The cost is more seeking for writes, making them substantially slower.
497
498.TP
499\fB"offset" Layout\fP
500When "offset" replicas are chosen, all the copies of a given chunk are
501striped consecutively ("offset by the stripe length after each other")
502over the devices.
503
504Explained in detail, <number of devices> consecutive chunks are
505striped over the devices, immediately followed by a "shifted" copy of
506these chunks (and by further such "shifted" copies in the case of more
507than 2\ copies per chunk).
508.br
509This pattern repeats for all further consecutive chunks of the
510exported RAID10 device (in other words: all further data blocks).
511
512The "shift" needed to prevent placing copies of the same chunks on the
513same devices is actually a cyclic permutation with offset\ 1 of each
514of the striped copies of <number of devices> consecutive chunks.
515.br
516The offset\ 1 is relative to the previous striped copy of <number of
517devices> consecutive chunks, so in case of more than 2\ copies per
518chunk one gets the following offsets:
519.br
5201.\ <number of devices> consecutive chunks: offset\ =\ \ 0
521.br
5222.\ <number of devices> consecutive chunks: offset\ =\ \ 1
523.br
5243.\ <number of devices> consecutive chunks: offset\ =\ \ 2
525.br
526 :
527.br
528n.\ <number of devices> consecutive chunks: offset\ =\ n-1
529
530.ne 10
531.B Example with 2\ copies per chunk and an even number\ (4) of devices:
532.TS
533tab(;);
534 C - - - -
535 C | C | C | C | C |
536| - | - | - | - | - |
537| C | C | C | C | C | L
538| C | C | C | C | C | L
539| C | C | C | C | C | L
540| C | C | C | C | C | L
541| C | C | C | C | C | L
542| C | C | C | C | C | L
543| C | C | C | C | C | L
544| C | C | C | C | C | L
545| C | C | C | C | C | L
546| - | - | - | - | - |
547C.
548;
549;Device #1;Device #2;Device #3;Device #4
550;
5510x00;0;1;2;3;) AA
5520x01;3;0;1;2;) AA~
5530x02;4;5;6;7;) AB
5540x03;7;4;5;6;) AB~
555\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;) \.\.\.
556:;:;:;:;:; :
557\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;) \.\.\.
5580x79;251;252;253;254;) EX
5590x80;254;251;252;253;) EX~
560;
561.TE
562
563.ne 10
564.B Example with 2\ copies per chunk and an odd number\ (5) of devices:
565.TS
566tab(;);
567 C - - - - -
568 C | C | C | C | C | C |
569| - | - | - | - | - | - |
570| C | C | C | C | C | C | L
571| C | C | C | C | C | C | L
572| C | C | C | C | C | C | L
573| C | C | C | C | C | C | L
574| C | C | C | C | C | C | L
575| C | C | C | C | C | C | L
576| C | C | C | C | C | C | L
577| C | C | C | C | C | C | L
578| C | C | C | C | C | C | L
579| - | - | - | - | - | - |
580C.
581;
f99a9e15 582;Dev #1;Dev #2;Dev #3;Dev #4;Dev #5
8dc92b41
CAM
583;
5840x00;0;1;2;3;4;) AA
5850x01;4;0;1;2;3;) AA~
5860x02;5;6;7;8;9;) AB
5870x03;9;5;6;7;8;) AB~
588\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;) \.\.\.
589:;:;:;:;:;:; :
590\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;\.\.\.;) \.\.\.
5910x79;314;315;316;317;318;) EX
5920x80;318;314;315;316;317;) EX~
593;
594.TE
595
596With AA,\ AB,\ ..., AZ,\ BA,\ ... being the sets of <number of devices> consecutive
597chunks and AA~,\ AB~,\ ..., AZ~,\ BA~,\ ... the cyclic permutations with offset\ 1
598thereof (in the case of more than 2 copies per chunk there would be (AA~)~,\ ...
599as well as ((AA~)~)~,\ ... and so on).
600
601This should give similar read characteristics to "far" if a suitably large chunk
602size is used, but without as much seeking for writes.
603.PP
604
b578481c 605
599e5a36 606It should be noted that the number of devices in a RAID10 array need
93e790af 607not be a multiple of the number of replica of each data block; however,
599e5a36
NB
608there must be at least as many devices as replicas.
609
610If, for example, an array is created with 5 devices and 2 replicas,
611then space equivalent to 2.5 of the devices will be available, and
612every block will be stored on two different devices.
613
8dc92b41 614Finally, it is possible to have an array with both "near" and "far"
93e790af 615copies. If an array is configured with 2 near copies and 2 far
599e5a36
NB
616copies, then there will be a total of 4 copies of each block, each on
617a different drive. This is an artifact of the implementation and is
618unlikely to be of real value.
619
bf40ab85 620.SS MULTIPATH
e0d19036
NB
621
622MULTIPATH is not really a RAID at all as there is only one real device
623in a MULTIPATH md array. However there are multiple access points
624(paths) to this device, and one of these paths might fail, so there
625are some similarities.
626
a9d69660 627A MULTIPATH array is composed of a number of logically different
2d465520
NB
628devices, often fibre channel interfaces, that all refer the the same
629real device. If one of these interfaces fails (e.g. due to cable
956a13fb 630problems), the MULTIPATH driver will attempt to redirect requests to
e0fe762a
N
631another interface.
632
633The MULTIPATH drive is not receiving any ongoing development and
634should be considered a legacy driver. The device-mapper based
635multipath drivers should be preferred for new installations.
e0d19036 636
b5e64645 637.SS FAULTY
956a13fb 638The FAULTY md module is provided for testing purposes. A FAULTY array
b5e64645
NB
639has exactly one component device and is normally assembled without a
640superblock, so the md array created provides direct access to all of
641the data in the component device.
642
643The FAULTY module may be requested to simulate faults to allow testing
a9d69660 644of other md levels or of filesystems. Faults can be chosen to trigger
b5e64645 645on read requests or write requests, and can be transient (a subsequent
addc80c4 646read/write at the address will probably succeed) or persistent
b5e64645
NB
647(subsequent read/write of the same address will fail). Further, read
648faults can be "fixable" meaning that they persist until a write
649request at the same address.
650
93e790af 651Fault types can be requested with a period. In this case, the fault
a9d69660
NB
652will recur repeatedly after the given number of requests of the
653relevant type. For example if persistent read faults have a period of
654100, then every 100th read request would generate a fault, and the
b5e64645
NB
655faulty sector would be recorded so that subsequent reads on that
656sector would also fail.
657
658There is a limit to the number of faulty sectors that are remembered.
659Faults generated after this limit is exhausted are treated as
660transient.
661
a9d69660 662The list of faulty sectors can be flushed, and the active list of
b5e64645 663failure modes can be cleared.
e0d19036
NB
664
665.SS UNCLEAN SHUTDOWN
666
599e5a36
NB
667When changes are made to a RAID1, RAID4, RAID5, RAID6, or RAID10 array
668there is a possibility of inconsistency for short periods of time as
93e790af
SW
669each update requires at least two block to be written to different
670devices, and these writes probably won't happen at exactly the same
599e5a36
NB
671time. Thus if a system with one of these arrays is shutdown in the
672middle of a write operation (e.g. due to power failure), the array may
673not be consistent.
e0d19036 674
2d465520 675To handle this situation, the md driver marks an array as "dirty"
e0d19036 676before writing any data to it, and marks it as "clean" when the array
98c6faba
NB
677is being disabled, e.g. at shutdown. If the md driver finds an array
678to be dirty at startup, it proceeds to correct any possibly
679inconsistency. For RAID1, this involves copying the contents of the
680first drive onto all other drives. For RAID4, RAID5 and RAID6 this
681involves recalculating the parity for each stripe and making sure that
599e5a36
NB
682the parity block has the correct data. For RAID10 it involves copying
683one of the replicas of each block onto all the others. This process,
684known as "resynchronising" or "resync" is performed in the background.
685The array can still be used, though possibly with reduced performance.
98c6faba
NB
686
687If a RAID4, RAID5 or RAID6 array is degraded (missing at least one
93e790af 688drive, two for RAID6) when it is restarted after an unclean shutdown, it cannot
98c6faba
NB
689recalculate parity, and so it is possible that data might be
690undetectably corrupted. The 2.4 md driver
e0d19036 691.B does not
addc80c4
NB
692alert the operator to this condition. The 2.6 md driver will fail to
693start an array in this condition without manual intervention, though
35cc5be4 694this behaviour can be overridden by a kernel parameter.
e0d19036
NB
695
696.SS RECOVERY
697
addc80c4 698If the md driver detects a write error on a device in a RAID1, RAID4,
599e5a36
NB
699RAID5, RAID6, or RAID10 array, it immediately disables that device
700(marking it as faulty) and continues operation on the remaining
93e790af
SW
701devices. If there are spare drives, the driver will start recreating
702on one of the spare drives the data which was on that failed drive,
599e5a36
NB
703either by copying a working drive in a RAID1 configuration, or by
704doing calculations with the parity block on RAID4, RAID5 or RAID6, or
93e790af 705by finding and copying originals for RAID10.
e0d19036 706
addc80c4
NB
707In kernels prior to about 2.6.15, a read error would cause the same
708effect as a write error. In later kernels, a read-error will instead
709cause md to attempt a recovery by overwriting the bad block. i.e. it
710will find the correct data from elsewhere, write it over the block
711that failed, and then try to read it back again. If either the write
712or the re-read fail, md will treat the error the same way that a write
93e790af 713error is treated, and will fail the whole device.
addc80c4 714
2d465520 715While this recovery process is happening, the md driver will monitor
e0d19036
NB
716accesses to the array and will slow down the rate of recovery if other
717activity is happening, so that normal access to the array will not be
718unduly affected. When no other activity is happening, the recovery
719process proceeds at full speed. The actual speed targets for the two
720different situations can be controlled by the
721.B speed_limit_min
722and
723.B speed_limit_max
724control files mentioned below.
725
1cc44574
N
726.SS SCRUBBING AND MISMATCHES
727
728As storage devices can develop bad blocks at any time it is valuable
729to regularly read all blocks on all devices in an array so as to catch
730such bad blocks early. This process is called
731.IR scrubbing .
732
733md arrays can be scrubbed by writing either
734.I check
735or
736.I repair
737to the file
738.I md/sync_action
739in the
740.I sysfs
741directory for the device.
742
c93e9d68 743Requesting a scrub will cause
1cc44574
N
744.I md
745to read every block on every device in the array, and check that the
c93e9d68
N
746data is consistent. For RAID1 and RAID10, this means checking that the copies
747are identical. For RAID4, RAID5, RAID6 this means checking that the
748parity block is (or blocks are) correct.
1cc44574
N
749
750If a read error is detected during this process, the normal read-error
751handling causes correct data to be found from other devices and to be
752written back to the faulty device. In many case this will
753effectively
754.I fix
755the bad block.
756
757If all blocks read successfully but are found to not be consistent,
758then this is regarded as a
759.IR mismatch .
760
761If
762.I check
763was used, then no action is taken to handle the mismatch, it is simply
764recorded.
765If
766.I repair
767was used, then a mismatch will be repaired in the same way that
768.I resync
c93e9d68 769repairs arrays. For RAID5/RAID6 new parity blocks are written. For RAID1/RAID10,
1cc44574
N
770all but one block are overwritten with the content of that one block.
771
772A count of mismatches is recorded in the
773.I sysfs
774file
775.IR md/mismatch_cnt .
776This is set to zero when a
c93e9d68 777scrub starts and is incremented whenever a sector is
1cc44574
N
778found that is a mismatch.
779.I md
780normally works in units much larger than a single sector and when it
1e49aaa0 781finds a mismatch, it does not determine exactly how many actual sectors were
c93e9d68
N
782affected but simply adds the number of sectors in the IO unit that was
783used. So a value of 128 could simply mean that a single 64KB check
784found an error (128 x 512bytes = 64KB).
785
786If an array is created by
787.I mdadm
788with
1cc44574
N
789.I \-\-assume\-clean
790then a subsequent check could be expected to find some mismatches.
791
792On a truly clean RAID5 or RAID6 array, any mismatches should indicate
793a hardware problem at some level - software issues should never cause
794such a mismatch.
795
796However on RAID1 and RAID10 it is possible for software issues to
797cause a mismatch to be reported. This does not necessarily mean that
798the data on the array is corrupted. It could simply be that the
799system does not care what is stored on that part of the array - it is
800unused space.
801
802The most likely cause for an unexpected mismatch on RAID1 or RAID10
803occurs if a swap partition or swap file is stored on the array.
804
805When the swap subsystem wants to write a page of memory out, it flags
806the page as 'clean' in the memory manager and requests the swap device
807to write it out. It is quite possible that the memory will be
808changed while the write-out is happening. In that case the 'clean'
809flag will be found to be clear when the write completes and so the
810swap subsystem will simply forget that the swapout had been attempted,
c93e9d68 811and will possibly choose a different page to write out.
1cc44574 812
c93e9d68 813If the swap device was on RAID1 (or RAID10), then the data is sent
1cc44574 814from memory to a device twice (or more depending on the number of
c93e9d68
N
815devices in the array). Thus it is possible that the memory gets changed
816between the times it is sent, so different data can be written to
817the different devices in the array. This will be detected by
1cc44574
N
818.I check
819as a mismatch. However it does not reflect any corruption as the
820block where this mismatch occurs is being treated by the swap system as
821being empty, and the data will never be read from that block.
822
823It is conceivable for a similar situation to occur on non-swap files,
824though it is less likely.
825
826Thus the
827.I mismatch_cnt
828value can not be interpreted very reliably on RAID1 or RAID10,
829especially when the device is used for swap.
830
831
599e5a36
NB
832.SS BITMAP WRITE-INTENT LOGGING
833
834From Linux 2.6.13,
835.I md
836supports a bitmap based write-intent log. If configured, the bitmap
837is used to record which blocks of the array may be out of sync.
838Before any write request is honoured, md will make sure that the
839corresponding bit in the log is set. After a period of time with no
840writes to an area of the array, the corresponding bit will be cleared.
841
842This bitmap is used for two optimisations.
843
1afe1167 844Firstly, after an unclean shutdown, the resync process will consult
599e5a36 845the bitmap and only resync those blocks that correspond to bits in the
1afe1167 846bitmap that are set. This can dramatically reduce resync time.
599e5a36
NB
847
848Secondly, when a drive fails and is removed from the array, md stops
849clearing bits in the intent log. If that same drive is re-added to
850the array, md will notice and will only recover the sections of the
851drive that are covered by bits in the intent log that are set. This
852can allow a device to be temporarily removed and reinserted without
853causing an enormous recovery cost.
854
855The intent log can be stored in a file on a separate device, or it can
856be stored near the superblocks of an array which has superblocks.
857
93e790af 858It is possible to add an intent log to an active array, or remove an
addc80c4 859intent log if one is present.
599e5a36
NB
860
861In 2.6.13, intent bitmaps are only supported with RAID1. Other levels
addc80c4 862with redundancy are supported from 2.6.15.
599e5a36 863
968d2a33 864.SS BAD BLOCK LIST
bf95d0f3
N
865
866From Linux 3.5 each device in an
867.I md
868array can store a list of known-bad-blocks. This list is 4K in size
869and usually positioned at the end of the space between the superblock
870and the data.
871
872When a block cannot be read and cannot be repaired by writing data
873recovered from other devices, the address of the block is stored in
968d2a33 874the bad block list. Similarly if an attempt to write a block fails,
bf95d0f3
N
875the address will be recorded as a bad block. If attempting to record
876the bad block fails, the whole device will be marked faulty.
877
878Attempting to read from a known bad block will cause a read error.
879Attempting to write to a known bad block will be ignored if any write
880errors have been reported by the device. If there have been no write
881errors then the data will be written to the known bad block and if
882that succeeds, the address will be removed from the list.
883
884This allows an array to fail more gracefully - a few blocks on
885different devices can be faulty without taking the whole array out of
886action.
887
968d2a33 888The list is particularly useful when recovering to a spare. If a few blocks
bf95d0f3 889cannot be read from the other devices, the bulk of the recovery can
968d2a33 890complete and those few bad blocks will be recorded in the bad block list.
bf95d0f3 891
28f83f6d
SL
892.SS RAID456 WRITE JOURNAL
893
894Due to non-atomicity nature of RAID write operations, interruption of
895write operations (system crash, etc.) to RAID456 array can lead to
896inconsistent parity and data loss (so called RAID-5 write hole).
897
898To plug the write hole, from Linux 4.4 (to be confirmed),
899.I md
900supports write ahead journal for RAID456. When the array is created,
901an additional journal device can be added to the array through
902.IR write-journal
903option. The RAID write journal works similar to file system journals.
904Before writing to the data disks, md persists data AND parity of the
905stripe to the journal device. After crashes, md searches the journal
906device for incomplete write operations, and replay them to the data
907disks.
908
909When the journal device fails, the RAID array is forced to run in
910read-only mode.
911
599e5a36
NB
912.SS WRITE-BEHIND
913
914From Linux 2.6.14,
915.I md
addc80c4 916supports WRITE-BEHIND on RAID1 arrays.
599e5a36
NB
917
918This allows certain devices in the array to be flagged as
919.IR write-mostly .
920MD will only read from such devices if there is no
921other option.
922
923If a write-intent bitmap is also provided, write requests to
924write-mostly devices will be treated as write-behind requests and md
925will not wait for writes to those requests to complete before
926reporting the write as complete to the filesystem.
927
928This allows for a RAID1 with WRITE-BEHIND to be used to mirror data
8f21823f 929over a slow link to a remote computer (providing the link isn't too
599e5a36
NB
930slow). The extra latency of the remote link will not slow down normal
931operations, but the remote system will still have a reasonably
932up-to-date copy of all data.
933
71574efb
N
934.SS FAILFAST
935
936From Linux 4.10,
937.I
938md
939supports FAILFAST for RAID1 and RAID10 arrays. This is a flag that
940can be set on individual drives, though it is usually set on all
941drives, or no drives.
942
943When
944.I md
945sends an I/O request to a drive that is marked as FAILFAST, and when
946the array could survive the loss of that drive without losing data,
947.I md
948will request that the underlying device does not perform any retries.
949This means that a failure will be reported to
950.I md
951promptly, and it can mark the device as faulty and continue using the
952other device(s).
953.I md
954cannot control the timeout that the underlying devices use to
955determine failure. Any changes desired to that timeout must be set
956explictly on the underlying device, separately from using
957.IR mdadm .
958
959If a FAILFAST request does fail, and if it is still safe to mark the
960device as faulty without data loss, that will be done and the array
961will continue functioning on a reduced number of devices. If it is not
962possible to safely mark the device as faulty,
963.I md
964will retry the request without disabling retries in the underlying
965device. In any case,
966.I md
967will not attempt to repair read errors on a device marked as FAILFAST
968by writing out the correct. It will just mark the device as faulty.
969
970FAILFAST is appropriate for storage arrays that have a low probability
971of true failure, but will sometimes introduce unacceptable delays to
972I/O requests while performing internal maintenance. The value of
973setting FAILFAST involves a trade-off. The gain is that the chance of
974unacceptable delays is substantially reduced. The cost is that the
975unlikely event of data-loss on one device is slightly more likely to
976result in data-loss for the array.
977
978When a device in an array using FAILFAST is marked as faulty, it will
979usually become usable again in a short while.
980.I mdadm
981makes no attempt to detect that possibility. Some separate
982mechanism, tuned to the specific details of the expected failure modes,
983needs to be created to monitor devices to see when they return to full
984functionality, and to then re-add them to the array. In order of
985this "re-add" functionality to be effective, an array using FAILFAST
986should always have a write-intent bitmap.
987
addc80c4
NB
988.SS RESTRIPING
989
990.IR Restriping ,
991also known as
992.IR Reshaping ,
993is the processes of re-arranging the data stored in each stripe into a
994new layout. This might involve changing the number of devices in the
93e790af 995array (so the stripes are wider), changing the chunk size (so stripes
addc80c4 996are deeper or shallower), or changing the arrangement of data and
956a13fb 997parity (possibly changing the RAID level, e.g. 1 to 5 or 5 to 6).
addc80c4 998
c64881d7
N
999As of Linux 2.6.35, md can reshape a RAID4, RAID5, or RAID6 array to
1000have a different number of devices (more or fewer) and to have a
1001different layout or chunk size. It can also convert between these
1002different RAID levels. It can also convert between RAID0 and RAID10,
1003and between RAID0 and RAID4 or RAID5.
1004Other possibilities may follow in future kernels.
addc80c4
NB
1005
1006During any stripe process there is a 'critical section' during which
35cc5be4 1007live data is being overwritten on disk. For the operation of
956a13fb 1008increasing the number of drives in a RAID5, this critical section
addc80c4
NB
1009covers the first few stripes (the number being the product of the old
1010and new number of devices). After this critical section is passed,
1011data is only written to areas of the array which no longer hold live
b3f1c093 1012data \(em the live data has already been located away.
addc80c4 1013
c64881d7
N
1014For a reshape which reduces the number of devices, the 'critical
1015section' is at the end of the reshape process.
1016
addc80c4
NB
1017md is not able to ensure data preservation if there is a crash
1018(e.g. power failure) during the critical section. If md is asked to
1019start an array which failed during a critical section of restriping,
1020it will fail to start the array.
1021
1022To deal with this possibility, a user-space program must
1023.IP \(bu 4
1024Disable writes to that section of the array (using the
1025.B sysfs
1026interface),
1027.IP \(bu 4
93e790af 1028take a copy of the data somewhere (i.e. make a backup),
addc80c4 1029.IP \(bu 4
93e790af 1030allow the process to continue and invalidate the backup and restore
addc80c4
NB
1031write access once the critical section is passed, and
1032.IP \(bu 4
93e790af 1033provide for restoring the critical data before restarting the array
addc80c4
NB
1034after a system crash.
1035.PP
1036
1037.B mdadm
93e790af 1038versions from 2.4 do this for growing a RAID5 array.
addc80c4
NB
1039
1040For operations that do not change the size of the array, like simply
1041increasing chunk size, or converting RAID5 to RAID6 with one extra
93e790af
SW
1042device, the entire process is the critical section. In this case, the
1043restripe will need to progress in stages, as a section is suspended,
c64881d7 1044backed up, restriped, and released.
addc80c4
NB
1045
1046.SS SYSFS INTERFACE
93e790af 1047Each block device appears as a directory in
addc80c4 1048.I sysfs
93e790af 1049(which is usually mounted at
addc80c4
NB
1050.BR /sys ).
1051For MD devices, this directory will contain a subdirectory called
1052.B md
1053which contains various files for providing access to information about
1054the array.
1055
1056This interface is documented more fully in the file
1057.B Documentation/md.txt
1058which is distributed with the kernel sources. That file should be
1059consulted for full documentation. The following are just a selection
1060of attribute files that are available.
1061
1062.TP
1063.B md/sync_speed_min
1064This value, if set, overrides the system-wide setting in
1065.B /proc/sys/dev/raid/speed_limit_min
1066for this array only.
1067Writing the value
93e790af
SW
1068.B "system"
1069to this file will cause the system-wide setting to have effect.
addc80c4
NB
1070
1071.TP
1072.B md/sync_speed_max
1073This is the partner of
1074.B md/sync_speed_min
1075and overrides
1e49aaa0 1076.B /proc/sys/dev/raid/speed_limit_max
addc80c4
NB
1077described below.
1078
1079.TP
1080.B md/sync_action
1081This can be used to monitor and control the resync/recovery process of
1082MD.
1083In particular, writing "check" here will cause the array to read all
1084data block and check that they are consistent (e.g. parity is correct,
1085or all mirror replicas are the same). Any discrepancies found are
1086.B NOT
1087corrected.
1088
1089A count of problems found will be stored in
1090.BR md/mismatch_count .
1091
1092Alternately, "repair" can be written which will cause the same check
1093to be performed, but any errors will be corrected.
1094
1095Finally, "idle" can be written to stop the check/repair process.
1096
1097.TP
1098.B md/stripe_cache_size
1099This is only available on RAID5 and RAID6. It records the size (in
1100pages per device) of the stripe cache which is used for synchronising
800053d6
DW
1101all write operations to the array and all read operations if the array
1102is degraded. The default is 256. Valid values are 17 to 32768.
addc80c4 1103Increasing this number can increase performance in some situations, at
800053d6
DW
1104some cost in system memory. Note, setting this value too high can
1105result in an "out of memory" condition for the system.
1106
1107memory_consumed = system_page_size * nr_disks * stripe_cache_size
addc80c4 1108
a5ee6dfb
DW
1109.TP
1110.B md/preread_bypass_threshold
1111This is only available on RAID5 and RAID6. This variable sets the
1112number of times MD will service a full-stripe-write before servicing a
1113stripe that requires some "prereading". For fairness this defaults to
800053d6
DW
11141. Valid values are 0 to stripe_cache_size. Setting this to 0
1115maximizes sequential-write throughput at the cost of fairness to threads
bcbb92d4 1116doing small or random writes.
addc80c4 1117
e53cb968
GJ
1118.TP
1119.B md/bitmap/backlog
1120The value stored in the file only has any effect on RAID1 when write-mostly
1121devices are active, and write requests to those devices are proceed in the
1122background.
1123
1124This variable sets a limit on the number of concurrent background writes,
1125the valid values are 0 to 16383, 0 means that write-behind is not allowed,
1126while any other number means it can happen. If there are more write requests
1127than the number, new writes will by synchronous.
1128
1129.TP
1130.B md/bitmap/can_clear
1131This is for externally managed bitmaps, where the kernel writes the bitmap
1132itself, but metadata describing the bitmap is managed by mdmon or similar.
1133
1134When the array is degraded, bits mustn't be cleared. When the array becomes
1135optimal again, bit can be cleared, but first the metadata needs to record
1136the current event count. So md sets this to 'false' and notifies mdmon,
1137then mdmon updates the metadata and writes 'true'.
1138
1139There is no code in mdmon to actually do this, so maybe it doesn't even
1140work.
1141
1142.TP
1143.B md/bitmap/chunksize
1144The bitmap chunksize can only be changed when no bitmap is active, and
1145the value should be power of 2 and at least 512.
1146
1147.TP
1148.B md/bitmap/location
1149This indicates where the write-intent bitmap for the array is stored.
1150It can be "none" or "file" or a signed offset from the array metadata
1151- measured in sectors. You cannot set a file by writing here - that can
1152only be done with the SET_BITMAP_FILE ioctl.
1153
1154Write 'none' to 'bitmap/location' will clear bitmap, and the previous
1155location value must be write to it to restore bitmap.
1156
1157.TP
1158.B md/bitmap/max_backlog_used
1159This keeps track of the maximum number of concurrent write-behind requests
1160for an md array, writing any value to this file will clear it.
1161
1162.TP
1163.B md/bitmap/metadata
1164This can be 'internal' or 'clustered' or 'external'. 'internal' is set
1165by default, which means the metadata for bitmap is stored in the first 256
1166bytes of the bitmap space. 'clustered' means separate bitmap metadata are
1167used for each cluster node. 'external' means that bitmap metadata is managed
1168externally to the kernel.
1169
1170.TP
1171.B md/bitmap/space
1172This shows the space (in sectors) which is available at md/bitmap/location,
1173and allows the kernel to know when it is safe to resize the bitmap to match
1174a resized array. It should big enough to contain the total bytes in the bitmap.
1175
1176For 1.0 metadata, assume we can use up to the superblock if before, else
1177to 4K beyond superblock. For other metadata versions, assume no change is
1178possible.
1179
1180.TP
1181.B md/bitmap/time_base
1182This shows the time (in seconds) between disk flushes, and is used to looking
1183for bits in the bitmap to be cleared.
1184
1185The default value is 5 seconds, and it should be an unsigned long value.
1186
5787fa49
NB
1187.SS KERNEL PARAMETERS
1188
addc80c4 1189The md driver recognised several different kernel parameters.
5787fa49
NB
1190.TP
1191.B raid=noautodetect
1192This will disable the normal detection of md arrays that happens at
1193boot time. If a drive is partitioned with MS-DOS style partitions,
1194then if any of the 4 main partitions has a partition type of 0xFD,
1195then that partition will normally be inspected to see if it is part of
1196an MD array, and if any full arrays are found, they are started. This
addc80c4 1197kernel parameter disables this behaviour.
5787fa49 1198
a9d69660
NB
1199.TP
1200.B raid=partitionable
1201.TP
1202.B raid=part
1203These are available in 2.6 and later kernels only. They indicate that
1204autodetected MD arrays should be created as partitionable arrays, with
1205a different major device number to the original non-partitionable md
1206arrays. The device number is listed as
1207.I mdp
1208in
1209.IR /proc/devices .
1210
addc80c4
NB
1211.TP
1212.B md_mod.start_ro=1
e0fe762a
N
1213.TP
1214.B /sys/module/md_mod/parameters/start_ro
addc80c4
NB
1215This tells md to start all arrays in read-only mode. This is a soft
1216read-only that will automatically switch to read-write on the first
1217write request. However until that write request, nothing is written
1218to any device by md, and in particular, no resync or recovery
1219operation is started.
1220
1221.TP
1222.B md_mod.start_dirty_degraded=1
e0fe762a
N
1223.TP
1224.B /sys/module/md_mod/parameters/start_dirty_degraded
addc80c4
NB
1225As mentioned above, md will not normally start a RAID4, RAID5, or
1226RAID6 that is both dirty and degraded as this situation can imply
1227hidden data loss. This can be awkward if the root filesystem is
93e790af 1228affected. Using this module parameter allows such arrays to be started
addc80c4
NB
1229at boot time. It should be understood that there is a real (though
1230small) risk of data corruption in this situation.
a9d69660 1231
5787fa49
NB
1232.TP
1233.BI md= n , dev , dev ,...
a9d69660
NB
1234.TP
1235.BI md=d n , dev , dev ,...
5787fa49
NB
1236This tells the md driver to assemble
1237.B /dev/md n
1238from the listed devices. It is only necessary to start the device
1239holding the root filesystem this way. Other arrays are best started
1240once the system is booted.
1241
a9d69660
NB
1242In 2.6 kernels, the
1243.B d
1244immediately after the
1245.B =
1246indicates that a partitionable device (e.g.
1247.BR /dev/md/d0 )
1248should be created rather than the original non-partitionable device.
1249
5787fa49
NB
1250.TP
1251.BI md= n , l , c , i , dev...
1252This tells the md driver to assemble a legacy RAID0 or LINEAR array
1253without a superblock.
1254.I n
1255gives the md device number,
1256.I l
dae45415 1257gives the level, 0 for RAID0 or \-1 for LINEAR,
5787fa49
NB
1258.I c
1259gives the chunk size as a base-2 logarithm offset by twelve, so 0
1260means 4K, 1 means 8K.
1261.I i
1262is ignored (legacy support).
e0d19036 1263
56eb10c0
NB
1264.SH FILES
1265.TP
1266.B /proc/mdstat
1267Contains information about the status of currently running array.
1268.TP
1269.B /proc/sys/dev/raid/speed_limit_min
93e790af 1270A readable and writable file that reflects the current "goal" rebuild
56eb10c0
NB
1271speed for times when non-rebuild activity is current on an array.
1272The speed is in Kibibytes per second, and is a per-device rate, not a
93e790af 1273per-array rate (which means that an array with more disks will shuffle
e0fe762a 1274more data for a given speed). The default is 1000.
56eb10c0
NB
1275
1276.TP
1277.B /proc/sys/dev/raid/speed_limit_max
93e790af 1278A readable and writable file that reflects the current "goal" rebuild
56eb10c0 1279speed for times when no non-rebuild activity is current on an array.
e0fe762a 1280The default is 200,000.
56eb10c0
NB
1281
1282.SH SEE ALSO
1283.BR mdadm (8),