]> git.ipfire.org Git - thirdparty/mdadm.git/blame - md.4
Remove stray debugging printfs
[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.
56eb10c0
NB
7.TH MD 4
8.SH NAME
93e790af 9md \- Multiple Device driver aka Linux Software RAID
56eb10c0
NB
10.SH SYNOPSIS
11.BI /dev/md n
12.br
13.BI /dev/md/ n
e0fe762a
N
14.br
15.BR /dev/md/ name
56eb10c0
NB
16.SH DESCRIPTION
17The
18.B md
19driver provides virtual devices that are created from one or more
e0d19036 20independent underlying devices. This array of devices often contains
02b76eea
NB
21redundancy and the devices are often disk drives, hence the acronym RAID
22which stands for a Redundant Array of Independent Disks.
56eb10c0
NB
23.PP
24.B md
599e5a36
NB
25supports RAID levels
261 (mirroring),
274 (striped array with parity device),
285 (striped array with distributed parity information),
296 (striped array with distributed dual redundancy information), and
3010 (striped and mirrored).
31If some number of underlying devices fails while using one of these
98c6faba
NB
32levels, the array will continue to function; this number is one for
33RAID levels 4 and 5, two for RAID level 6, and all but one (N-1) for
93e790af 34RAID level 1, and dependent on configuration for level 10.
56eb10c0
NB
35.PP
36.B md
e0d19036 37also supports a number of pseudo RAID (non-redundant) configurations
570c0542
NB
38including RAID0 (striped array), LINEAR (catenated array),
39MULTIPATH (a set of different interfaces to the same device),
40and FAULTY (a layer over a single device into which errors can be injected).
56eb10c0 41
e0fe762a
N
42.SS MD METADATA
43Each device in an array may have some
44.I metadata
45stored in the device. This metadata is sometimes called a
46.BR superblock .
47The metadata records information about the structure and state of the array.
570c0542 48This allows the array to be reliably re-assembled after a shutdown.
56eb10c0 49
570c0542
NB
50From Linux kernel version 2.6.10,
51.B md
e0fe762a 52provides support for two different formats of metadata, and
570c0542
NB
53other formats can be added. Prior to this release, only one format is
54supported.
55
b3f1c093 56The common format \(em known as version 0.90 \(em has
570c0542 57a superblock that is 4K long and is written into a 64K aligned block that
11a3e71d 58starts at least 64K and less than 128K from the end of the device
56eb10c0
NB
59(i.e. to get the address of the superblock round the size of the
60device down to a multiple of 64K and then subtract 64K).
11a3e71d 61The available size of each device is the amount of space before the
56eb10c0
NB
62super block, so between 64K and 128K is lost when a device in
63incorporated into an MD array.
93e790af 64This superblock stores multi-byte fields in a processor-dependent
570c0542
NB
65manner, so arrays cannot easily be moved between computers with
66different processors.
67
b3f1c093 68The new format \(em known as version 1 \(em has a superblock that is
570c0542
NB
69normally 1K long, but can be longer. It is normally stored between 8K
70and 12K from the end of the device, on a 4K boundary, though
71variations can be stored at the start of the device (version 1.1) or 4K from
72the start of the device (version 1.2).
e0fe762a 73This metadata format stores multibyte data in a
93e790af 74processor-independent format and supports up to hundreds of
570c0542 75component devices (version 0.90 only supports 28).
56eb10c0 76
e0fe762a 77The metadata contains, among other things:
56eb10c0
NB
78.TP
79LEVEL
11a3e71d 80The manner in which the devices are arranged into the array
599e5a36 81(linear, raid0, raid1, raid4, raid5, raid10, multipath).
56eb10c0
NB
82.TP
83UUID
84a 128 bit Universally Unique Identifier that identifies the array that
93e790af 85contains this device.
56eb10c0 86
e0fe762a 87.PP
2a940e36
NB
88When a version 0.90 array is being reshaped (e.g. adding extra devices
89to a RAID5), the version number is temporarily set to 0.91. This
90ensures that if the reshape process is stopped in the middle (e.g. by
91a system crash) and the machine boots into an older kernel that does
92not support reshaping, then the array will not be assembled (which
93would cause data corruption) but will be left untouched until a kernel
94that can complete the reshape processes is used.
95
e0fe762a 96.SS ARRAYS WITHOUT METADATA
570c0542 97While it is usually best to create arrays with superblocks so that
93e790af
SW
98they can be assembled reliably, there are some circumstances when an
99array without superblocks is preferred. These include:
570c0542
NB
100.TP
101LEGACY ARRAYS
11a3e71d
NB
102Early versions of the
103.B md
570c0542
NB
104driver only supported Linear and Raid0 configurations and did not use
105a superblock (which is less critical with these configurations).
106While such arrays should be rebuilt with superblocks if possible,
11a3e71d 107.B md
570c0542
NB
108continues to support them.
109.TP
110FAULTY
111Being a largely transparent layer over a different device, the FAULTY
112personality doesn't gain anything from having a superblock.
113.TP
114MULTIPATH
115It is often possible to detect devices which are different paths to
116the same storage directly rather than having a distinctive superblock
117written to the device and searched for on all paths. In this case,
118a MULTIPATH array with no superblock makes sense.
119.TP
120RAID1
121In some configurations it might be desired to create a raid1
93e790af 122configuration that does not use a superblock, and to maintain the state of
addc80c4
NB
123the array elsewhere. While not encouraged for general us, it does
124have special-purpose uses and is supported.
11a3e71d 125
e0fe762a
N
126.SS ARRAYS WITH EXTERNAL METADATA
127
128From release 2.6.28, the
129.I md
130driver supports arrays with externally managed metadata. That is,
131the metadata is not managed by the kernel by rather by a user-space
132program which is external to the kernel. This allows support for a
133variety of metadata formats without cluttering the kernel with lots of
134details.
135.PP
136.I md
137is able to communicate with the user-space program through various
138sysfs attributes so that it can make appropriate changes to the
139metadata \- for example to make a device as faulty. When necessary,
140.I md
141will wait for the program to acknowledge the event by writing to a
142sysfs attribute.
143The manual page for
144.IR mdmon (8)
145contains more detail about this interaction.
146
147.SS CONTAINERS
148Many metadata formats use a single block of metadata to describe a
149number of different arrays which all use the same set of devices.
150In this case it is helpful for the kernel to know about the full set
151of devices as a whole. This set is known to md as a
152.IR container .
153A container is an
154.I md
155array with externally managed metadata and with device offset and size
156so that it just covers the metadata part of the devices. The
157remainder of each device is available to be incorporated into various
158arrays.
159
56eb10c0 160.SS LINEAR
11a3e71d
NB
161
162A linear array simply catenates the available space on each
93e790af 163drive to form one large virtual drive.
11a3e71d
NB
164
165One advantage of this arrangement over the more common RAID0
166arrangement is that the array may be reconfigured at a later time with
93e790af
SW
167an extra drive, so the array is made bigger without disturbing the
168data that is on the array. This can even be done on a live
11a3e71d
NB
169array.
170
599e5a36
NB
171If a chunksize is given with a LINEAR array, the usable space on each
172device is rounded down to a multiple of this chunksize.
11a3e71d 173
56eb10c0 174.SS RAID0
11a3e71d
NB
175
176A RAID0 array (which has zero redundancy) is also known as a
177striped array.
e0d19036
NB
178A RAID0 array is configured at creation with a
179.B "Chunk Size"
e0fe762a
N
180which must be a power of two (prior to Linux 2.6.31), and at least 4
181kibibytes.
e0d19036 182
2d465520 183The RAID0 driver assigns the first chunk of the array to the first
e0d19036 184device, the second chunk to the second device, and so on until all
e0fe762a 185drives have been assigned one chunk. This collection of chunks forms a
e0d19036 186.BR stripe .
93e790af 187Further chunks are gathered into stripes in the same way, and are
e0d19036
NB
188assigned to the remaining space in the drives.
189
2d465520
NB
190If devices in the array are not all the same size, then once the
191smallest device has been exhausted, the RAID0 driver starts
e0d19036
NB
192collecting chunks into smaller stripes that only span the drives which
193still have remaining space.
194
195
56eb10c0 196.SS RAID1
e0d19036
NB
197
198A RAID1 array is also known as a mirrored set (though mirrors tend to
5787fa49 199provide reflected images, which RAID1 does not) or a plex.
e0d19036
NB
200
201Once initialised, each device in a RAID1 array contains exactly the
202same data. Changes are written to all devices in parallel. Data is
203read from any one device. The driver attempts to distribute read
204requests across all devices to maximise performance.
205
206All devices in a RAID1 array should be the same size. If they are
207not, then only the amount of space available on the smallest device is
93e790af 208used (any extra space on other devices is wasted).
e0d19036 209
3dacb890
IP
210Note that the read balancing done by the driver does not make the RAID1
211performance profile be the same as for RAID0; a single stream of
212sequential input will not be accelerated (e.g. a single dd), but
213multiple sequential streams or a random workload will use more than one
214spindle. In theory, having an N-disk RAID1 will allow N sequential
215threads to read from all disks.
216
e0fe762a
N
217Individual devices in a RAID1 can be marked as "write-mostly".
218This drives are excluded from the normal read balancing and will only
219be read from when there is no other option. This can be useful for
220devices connected over a slow link.
221
56eb10c0 222.SS RAID4
e0d19036
NB
223
224A RAID4 array is like a RAID0 array with an extra device for storing
aa88f531
NB
225parity. This device is the last of the active devices in the
226array. Unlike RAID0, RAID4 also requires that all stripes span all
e0d19036
NB
227drives, so extra space on devices that are larger than the smallest is
228wasted.
229
93e790af 230When any block in a RAID4 array is modified, the parity block for that
e0d19036
NB
231stripe (i.e. the block in the parity device at the same device offset
232as the stripe) is also modified so that the parity block always
93e790af 233contains the "parity" for the whole stripe. I.e. its content is
e0d19036
NB
234equivalent to the result of performing an exclusive-or operation
235between all the data blocks in the stripe.
236
237This allows the array to continue to function if one device fails.
238The data that was on that device can be calculated as needed from the
239parity block and the other data blocks.
240
56eb10c0 241.SS RAID5
e0d19036
NB
242
243RAID5 is very similar to RAID4. The difference is that the parity
244blocks for each stripe, instead of being on a single device, are
245distributed across all devices. This allows more parallelism when
93e790af 246writing, as two different block updates will quite possibly affect
e0d19036
NB
247parity blocks on different devices so there is less contention.
248
93e790af 249This also allows more parallelism when reading, as read requests are
e0d19036
NB
250distributed over all the devices in the array instead of all but one.
251
98c6faba
NB
252.SS RAID6
253
254RAID6 is similar to RAID5, but can handle the loss of any \fItwo\fP
255devices without data loss. Accordingly, it requires N+2 drives to
256store N drives worth of data.
257
258The performance for RAID6 is slightly lower but comparable to RAID5 in
259normal mode and single disk failure mode. It is very slow in dual
260disk failure mode, however.
261
599e5a36
NB
262.SS RAID10
263
93e790af 264RAID10 provides a combination of RAID1 and RAID0, and is sometimes known
599e5a36
NB
265as RAID1+0. Every datablock is duplicated some number of times, and
266the resulting collection of datablocks are distributed over multiple
267drives.
268
93e790af 269When configuring a RAID10 array, it is necessary to specify the number
599e5a36 270of replicas of each data block that are required (this will normally
b578481c
NB
271be 2) and whether the replicas should be 'near', 'offset' or 'far'.
272(Note that the 'offset' layout is only available from 2.6.18).
599e5a36
NB
273
274When 'near' replicas are chosen, the multiple copies of a given chunk
275are laid out consecutively across the stripes of the array, so the two
276copies of a datablock will likely be at the same offset on two
277adjacent devices.
278
279When 'far' replicas are chosen, the multiple copies of a given chunk
280are laid out quite distant from each other. The first copy of all
281data blocks will be striped across the early part of all drives in
282RAID0 fashion, and then the next copy of all blocks will be striped
283across a later section of all drives, always ensuring that all copies
284of any given block are on different drives.
285
286The 'far' arrangement can give sequential read performance equal to
91c00388 287that of a RAID0 array, but at the cost of reduced write performance.
599e5a36 288
b578481c
NB
289When 'offset' replicas are chosen, the multiple copies of a given
290chunk are laid out on consecutive drives and at consecutive offsets.
291Effectively each stripe is duplicated and the copies are offset by one
292device. This should give similar read characteristics to 'far' if a
293suitably large chunk size is used, but without as much seeking for
294writes.
295
599e5a36 296It should be noted that the number of devices in a RAID10 array need
93e790af 297not be a multiple of the number of replica of each data block; however,
599e5a36
NB
298there must be at least as many devices as replicas.
299
300If, for example, an array is created with 5 devices and 2 replicas,
301then space equivalent to 2.5 of the devices will be available, and
302every block will be stored on two different devices.
303
304Finally, it is possible to have an array with both 'near' and 'far'
93e790af 305copies. If an array is configured with 2 near copies and 2 far
599e5a36
NB
306copies, then there will be a total of 4 copies of each block, each on
307a different drive. This is an artifact of the implementation and is
308unlikely to be of real value.
309
bf40ab85 310.SS MULTIPATH
e0d19036
NB
311
312MULTIPATH is not really a RAID at all as there is only one real device
313in a MULTIPATH md array. However there are multiple access points
314(paths) to this device, and one of these paths might fail, so there
315are some similarities.
316
a9d69660 317A MULTIPATH array is composed of a number of logically different
2d465520
NB
318devices, often fibre channel interfaces, that all refer the the same
319real device. If one of these interfaces fails (e.g. due to cable
a9d69660 320problems), the multipath driver will attempt to redirect requests to
e0fe762a
N
321another interface.
322
323The MULTIPATH drive is not receiving any ongoing development and
324should be considered a legacy driver. The device-mapper based
325multipath drivers should be preferred for new installations.
e0d19036 326
b5e64645
NB
327.SS FAULTY
328The FAULTY md module is provided for testing purposes. A faulty array
329has exactly one component device and is normally assembled without a
330superblock, so the md array created provides direct access to all of
331the data in the component device.
332
333The FAULTY module may be requested to simulate faults to allow testing
a9d69660 334of other md levels or of filesystems. Faults can be chosen to trigger
b5e64645 335on read requests or write requests, and can be transient (a subsequent
addc80c4 336read/write at the address will probably succeed) or persistent
b5e64645
NB
337(subsequent read/write of the same address will fail). Further, read
338faults can be "fixable" meaning that they persist until a write
339request at the same address.
340
93e790af 341Fault types can be requested with a period. In this case, the fault
a9d69660
NB
342will recur repeatedly after the given number of requests of the
343relevant type. For example if persistent read faults have a period of
344100, then every 100th read request would generate a fault, and the
b5e64645
NB
345faulty sector would be recorded so that subsequent reads on that
346sector would also fail.
347
348There is a limit to the number of faulty sectors that are remembered.
349Faults generated after this limit is exhausted are treated as
350transient.
351
a9d69660 352The list of faulty sectors can be flushed, and the active list of
b5e64645 353failure modes can be cleared.
e0d19036
NB
354
355.SS UNCLEAN SHUTDOWN
356
599e5a36
NB
357When changes are made to a RAID1, RAID4, RAID5, RAID6, or RAID10 array
358there is a possibility of inconsistency for short periods of time as
93e790af
SW
359each update requires at least two block to be written to different
360devices, and these writes probably won't happen at exactly the same
599e5a36
NB
361time. Thus if a system with one of these arrays is shutdown in the
362middle of a write operation (e.g. due to power failure), the array may
363not be consistent.
e0d19036 364
2d465520 365To handle this situation, the md driver marks an array as "dirty"
e0d19036 366before writing any data to it, and marks it as "clean" when the array
98c6faba
NB
367is being disabled, e.g. at shutdown. If the md driver finds an array
368to be dirty at startup, it proceeds to correct any possibly
369inconsistency. For RAID1, this involves copying the contents of the
370first drive onto all other drives. For RAID4, RAID5 and RAID6 this
371involves recalculating the parity for each stripe and making sure that
599e5a36
NB
372the parity block has the correct data. For RAID10 it involves copying
373one of the replicas of each block onto all the others. This process,
374known as "resynchronising" or "resync" is performed in the background.
375The array can still be used, though possibly with reduced performance.
98c6faba
NB
376
377If a RAID4, RAID5 or RAID6 array is degraded (missing at least one
93e790af 378drive, two for RAID6) when it is restarted after an unclean shutdown, it cannot
98c6faba
NB
379recalculate parity, and so it is possible that data might be
380undetectably corrupted. The 2.4 md driver
e0d19036 381.B does not
addc80c4
NB
382alert the operator to this condition. The 2.6 md driver will fail to
383start an array in this condition without manual intervention, though
35cc5be4 384this behaviour can be overridden by a kernel parameter.
e0d19036
NB
385
386.SS RECOVERY
387
addc80c4 388If the md driver detects a write error on a device in a RAID1, RAID4,
599e5a36
NB
389RAID5, RAID6, or RAID10 array, it immediately disables that device
390(marking it as faulty) and continues operation on the remaining
93e790af
SW
391devices. If there are spare drives, the driver will start recreating
392on one of the spare drives the data which was on that failed drive,
599e5a36
NB
393either by copying a working drive in a RAID1 configuration, or by
394doing calculations with the parity block on RAID4, RAID5 or RAID6, or
93e790af 395by finding and copying originals for RAID10.
e0d19036 396
addc80c4
NB
397In kernels prior to about 2.6.15, a read error would cause the same
398effect as a write error. In later kernels, a read-error will instead
399cause md to attempt a recovery by overwriting the bad block. i.e. it
400will find the correct data from elsewhere, write it over the block
401that failed, and then try to read it back again. If either the write
402or the re-read fail, md will treat the error the same way that a write
93e790af 403error is treated, and will fail the whole device.
addc80c4 404
2d465520 405While this recovery process is happening, the md driver will monitor
e0d19036
NB
406accesses to the array and will slow down the rate of recovery if other
407activity is happening, so that normal access to the array will not be
408unduly affected. When no other activity is happening, the recovery
409process proceeds at full speed. The actual speed targets for the two
410different situations can be controlled by the
411.B speed_limit_min
412and
413.B speed_limit_max
414control files mentioned below.
415
599e5a36
NB
416.SS BITMAP WRITE-INTENT LOGGING
417
418From Linux 2.6.13,
419.I md
420supports a bitmap based write-intent log. If configured, the bitmap
421is used to record which blocks of the array may be out of sync.
422Before any write request is honoured, md will make sure that the
423corresponding bit in the log is set. After a period of time with no
424writes to an area of the array, the corresponding bit will be cleared.
425
426This bitmap is used for two optimisations.
427
1afe1167 428Firstly, after an unclean shutdown, the resync process will consult
599e5a36 429the bitmap and only resync those blocks that correspond to bits in the
1afe1167 430bitmap that are set. This can dramatically reduce resync time.
599e5a36
NB
431
432Secondly, when a drive fails and is removed from the array, md stops
433clearing bits in the intent log. If that same drive is re-added to
434the array, md will notice and will only recover the sections of the
435drive that are covered by bits in the intent log that are set. This
436can allow a device to be temporarily removed and reinserted without
437causing an enormous recovery cost.
438
439The intent log can be stored in a file on a separate device, or it can
440be stored near the superblocks of an array which has superblocks.
441
93e790af 442It is possible to add an intent log to an active array, or remove an
addc80c4 443intent log if one is present.
599e5a36
NB
444
445In 2.6.13, intent bitmaps are only supported with RAID1. Other levels
addc80c4 446with redundancy are supported from 2.6.15.
599e5a36
NB
447
448.SS WRITE-BEHIND
449
450From Linux 2.6.14,
451.I md
addc80c4 452supports WRITE-BEHIND on RAID1 arrays.
599e5a36
NB
453
454This allows certain devices in the array to be flagged as
455.IR write-mostly .
456MD will only read from such devices if there is no
457other option.
458
459If a write-intent bitmap is also provided, write requests to
460write-mostly devices will be treated as write-behind requests and md
461will not wait for writes to those requests to complete before
462reporting the write as complete to the filesystem.
463
464This allows for a RAID1 with WRITE-BEHIND to be used to mirror data
8f21823f 465over a slow link to a remote computer (providing the link isn't too
599e5a36
NB
466slow). The extra latency of the remote link will not slow down normal
467operations, but the remote system will still have a reasonably
468up-to-date copy of all data.
469
addc80c4
NB
470.SS RESTRIPING
471
472.IR Restriping ,
473also known as
474.IR Reshaping ,
475is the processes of re-arranging the data stored in each stripe into a
476new layout. This might involve changing the number of devices in the
93e790af 477array (so the stripes are wider), changing the chunk size (so stripes
addc80c4 478are deeper or shallower), or changing the arrangement of data and
93e790af 479parity (possibly changing the raid level, e.g. 1 to 5 or 5 to 6).
addc80c4
NB
480
481As of Linux 2.6.17, md can reshape a raid5 array to have more
482devices. Other possibilities may follow in future kernels.
483
484During any stripe process there is a 'critical section' during which
35cc5be4 485live data is being overwritten on disk. For the operation of
addc80c4
NB
486increasing the number of drives in a raid5, this critical section
487covers the first few stripes (the number being the product of the old
488and new number of devices). After this critical section is passed,
489data is only written to areas of the array which no longer hold live
b3f1c093 490data \(em the live data has already been located away.
addc80c4
NB
491
492md is not able to ensure data preservation if there is a crash
493(e.g. power failure) during the critical section. If md is asked to
494start an array which failed during a critical section of restriping,
495it will fail to start the array.
496
497To deal with this possibility, a user-space program must
498.IP \(bu 4
499Disable writes to that section of the array (using the
500.B sysfs
501interface),
502.IP \(bu 4
93e790af 503take a copy of the data somewhere (i.e. make a backup),
addc80c4 504.IP \(bu 4
93e790af 505allow the process to continue and invalidate the backup and restore
addc80c4
NB
506write access once the critical section is passed, and
507.IP \(bu 4
93e790af 508provide for restoring the critical data before restarting the array
addc80c4
NB
509after a system crash.
510.PP
511
512.B mdadm
93e790af 513versions from 2.4 do this for growing a RAID5 array.
addc80c4
NB
514
515For operations that do not change the size of the array, like simply
516increasing chunk size, or converting RAID5 to RAID6 with one extra
93e790af
SW
517device, the entire process is the critical section. In this case, the
518restripe will need to progress in stages, as a section is suspended,
addc80c4 519backed up,
93e790af 520restriped, and released; this is not yet implemented.
addc80c4
NB
521
522.SS SYSFS INTERFACE
93e790af 523Each block device appears as a directory in
addc80c4 524.I sysfs
93e790af 525(which is usually mounted at
addc80c4
NB
526.BR /sys ).
527For MD devices, this directory will contain a subdirectory called
528.B md
529which contains various files for providing access to information about
530the array.
531
532This interface is documented more fully in the file
533.B Documentation/md.txt
534which is distributed with the kernel sources. That file should be
535consulted for full documentation. The following are just a selection
536of attribute files that are available.
537
538.TP
539.B md/sync_speed_min
540This value, if set, overrides the system-wide setting in
541.B /proc/sys/dev/raid/speed_limit_min
542for this array only.
543Writing the value
93e790af
SW
544.B "system"
545to this file will cause the system-wide setting to have effect.
addc80c4
NB
546
547.TP
548.B md/sync_speed_max
549This is the partner of
550.B md/sync_speed_min
551and overrides
552.B /proc/sys/dev/raid/spool_limit_max
553described below.
554
555.TP
556.B md/sync_action
557This can be used to monitor and control the resync/recovery process of
558MD.
559In particular, writing "check" here will cause the array to read all
560data block and check that they are consistent (e.g. parity is correct,
561or all mirror replicas are the same). Any discrepancies found are
562.B NOT
563corrected.
564
565A count of problems found will be stored in
566.BR md/mismatch_count .
567
568Alternately, "repair" can be written which will cause the same check
569to be performed, but any errors will be corrected.
570
571Finally, "idle" can be written to stop the check/repair process.
572
573.TP
574.B md/stripe_cache_size
575This is only available on RAID5 and RAID6. It records the size (in
576pages per device) of the stripe cache which is used for synchronising
800053d6
DW
577all write operations to the array and all read operations if the array
578is degraded. The default is 256. Valid values are 17 to 32768.
addc80c4 579Increasing this number can increase performance in some situations, at
800053d6
DW
580some cost in system memory. Note, setting this value too high can
581result in an "out of memory" condition for the system.
582
583memory_consumed = system_page_size * nr_disks * stripe_cache_size
addc80c4 584
a5ee6dfb
DW
585.TP
586.B md/preread_bypass_threshold
587This is only available on RAID5 and RAID6. This variable sets the
588number of times MD will service a full-stripe-write before servicing a
589stripe that requires some "prereading". For fairness this defaults to
800053d6
DW
5901. Valid values are 0 to stripe_cache_size. Setting this to 0
591maximizes sequential-write throughput at the cost of fairness to threads
592doing small or random writes.
addc80c4 593
5787fa49
NB
594.SS KERNEL PARAMETERS
595
addc80c4 596The md driver recognised several different kernel parameters.
5787fa49
NB
597.TP
598.B raid=noautodetect
599This will disable the normal detection of md arrays that happens at
600boot time. If a drive is partitioned with MS-DOS style partitions,
601then if any of the 4 main partitions has a partition type of 0xFD,
602then that partition will normally be inspected to see if it is part of
603an MD array, and if any full arrays are found, they are started. This
addc80c4 604kernel parameter disables this behaviour.
5787fa49 605
a9d69660
NB
606.TP
607.B raid=partitionable
608.TP
609.B raid=part
610These are available in 2.6 and later kernels only. They indicate that
611autodetected MD arrays should be created as partitionable arrays, with
612a different major device number to the original non-partitionable md
613arrays. The device number is listed as
614.I mdp
615in
616.IR /proc/devices .
617
addc80c4
NB
618.TP
619.B md_mod.start_ro=1
e0fe762a
N
620.TP
621.B /sys/module/md_mod/parameters/start_ro
addc80c4
NB
622This tells md to start all arrays in read-only mode. This is a soft
623read-only that will automatically switch to read-write on the first
624write request. However until that write request, nothing is written
625to any device by md, and in particular, no resync or recovery
626operation is started.
627
628.TP
629.B md_mod.start_dirty_degraded=1
e0fe762a
N
630.TP
631.B /sys/module/md_mod/parameters/start_dirty_degraded
addc80c4
NB
632As mentioned above, md will not normally start a RAID4, RAID5, or
633RAID6 that is both dirty and degraded as this situation can imply
634hidden data loss. This can be awkward if the root filesystem is
93e790af 635affected. Using this module parameter allows such arrays to be started
addc80c4
NB
636at boot time. It should be understood that there is a real (though
637small) risk of data corruption in this situation.
a9d69660 638
5787fa49
NB
639.TP
640.BI md= n , dev , dev ,...
a9d69660
NB
641.TP
642.BI md=d n , dev , dev ,...
5787fa49
NB
643This tells the md driver to assemble
644.B /dev/md n
645from the listed devices. It is only necessary to start the device
646holding the root filesystem this way. Other arrays are best started
647once the system is booted.
648
a9d69660
NB
649In 2.6 kernels, the
650.B d
651immediately after the
652.B =
653indicates that a partitionable device (e.g.
654.BR /dev/md/d0 )
655should be created rather than the original non-partitionable device.
656
5787fa49
NB
657.TP
658.BI md= n , l , c , i , dev...
659This tells the md driver to assemble a legacy RAID0 or LINEAR array
660without a superblock.
661.I n
662gives the md device number,
663.I l
664gives the level, 0 for RAID0 or -1 for LINEAR,
665.I c
666gives the chunk size as a base-2 logarithm offset by twelve, so 0
667means 4K, 1 means 8K.
668.I i
669is ignored (legacy support).
e0d19036 670
56eb10c0
NB
671.SH FILES
672.TP
673.B /proc/mdstat
674Contains information about the status of currently running array.
675.TP
676.B /proc/sys/dev/raid/speed_limit_min
93e790af 677A readable and writable file that reflects the current "goal" rebuild
56eb10c0
NB
678speed for times when non-rebuild activity is current on an array.
679The speed is in Kibibytes per second, and is a per-device rate, not a
93e790af 680per-array rate (which means that an array with more disks will shuffle
e0fe762a 681more data for a given speed). The default is 1000.
56eb10c0
NB
682
683.TP
684.B /proc/sys/dev/raid/speed_limit_max
93e790af 685A readable and writable file that reflects the current "goal" rebuild
56eb10c0 686speed for times when no non-rebuild activity is current on an array.
e0fe762a 687The default is 200,000.
56eb10c0
NB
688
689.SH SEE ALSO
690.BR mdadm (8),
691.BR mkraid (8).