xref: /openbmc/linux/Documentation/admin-guide/md.rst (revision 9a87ffc99ec8eb8d35eed7c4f816d75f5cc9662e)
19d85025bSMauro Carvalho ChehabRAID arrays
29d85025bSMauro Carvalho Chehab===========
39d85025bSMauro Carvalho Chehab
49d85025bSMauro Carvalho ChehabBoot time assembly of RAID arrays
59d85025bSMauro Carvalho Chehab---------------------------------
69d85025bSMauro Carvalho Chehab
79d85025bSMauro Carvalho ChehabTools that manage md devices can be found at
893431e06SAlexander A. Klimov   https://www.kernel.org/pub/linux/utils/raid/
99d85025bSMauro Carvalho Chehab
109d85025bSMauro Carvalho Chehab
119d85025bSMauro Carvalho ChehabYou can boot with your md device with the following kernel command
129d85025bSMauro Carvalho Chehablines:
139d85025bSMauro Carvalho Chehab
149d85025bSMauro Carvalho Chehabfor old raid arrays without persistent superblocks::
159d85025bSMauro Carvalho Chehab
169d85025bSMauro Carvalho Chehab  md=<md device no.>,<raid level>,<chunk size factor>,<fault level>,dev0,dev1,...,devn
179d85025bSMauro Carvalho Chehab
189d85025bSMauro Carvalho Chehabfor raid arrays with persistent superblocks::
199d85025bSMauro Carvalho Chehab
209d85025bSMauro Carvalho Chehab  md=<md device no.>,dev0,dev1,...,devn
219d85025bSMauro Carvalho Chehab
229d85025bSMauro Carvalho Chehabor, to assemble a partitionable array::
239d85025bSMauro Carvalho Chehab
249d85025bSMauro Carvalho Chehab  md=d<md device no.>,dev0,dev1,...,devn
259d85025bSMauro Carvalho Chehab
269d85025bSMauro Carvalho Chehab``md device no.``
279d85025bSMauro Carvalho Chehab+++++++++++++++++
289d85025bSMauro Carvalho Chehab
299d85025bSMauro Carvalho ChehabThe number of the md device
309d85025bSMauro Carvalho Chehab
319d85025bSMauro Carvalho Chehab================= =========
329d85025bSMauro Carvalho Chehab``md device no.`` device
339d85025bSMauro Carvalho Chehab================= =========
349d85025bSMauro Carvalho Chehab              0		md0
359d85025bSMauro Carvalho Chehab	      1		md1
369d85025bSMauro Carvalho Chehab	      2		md2
379d85025bSMauro Carvalho Chehab	      3		md3
389d85025bSMauro Carvalho Chehab	      4		md4
399d85025bSMauro Carvalho Chehab================= =========
409d85025bSMauro Carvalho Chehab
419d85025bSMauro Carvalho Chehab``raid level``
429d85025bSMauro Carvalho Chehab++++++++++++++
439d85025bSMauro Carvalho Chehab
449d85025bSMauro Carvalho Chehablevel of the RAID array
459d85025bSMauro Carvalho Chehab
469d85025bSMauro Carvalho Chehab=============== =============
479d85025bSMauro Carvalho Chehab``raid level``  level
489d85025bSMauro Carvalho Chehab=============== =============
499d85025bSMauro Carvalho Chehab-1		linear mode
509d85025bSMauro Carvalho Chehab0		striped mode
519d85025bSMauro Carvalho Chehab=============== =============
529d85025bSMauro Carvalho Chehab
539d85025bSMauro Carvalho Chehabother modes are only supported with persistent super blocks
549d85025bSMauro Carvalho Chehab
559d85025bSMauro Carvalho Chehab``chunk size factor``
569d85025bSMauro Carvalho Chehab+++++++++++++++++++++
579d85025bSMauro Carvalho Chehab
589d85025bSMauro Carvalho Chehab(raid-0 and raid-1 only)
599d85025bSMauro Carvalho Chehab
609d85025bSMauro Carvalho ChehabSet  the chunk size as 4k << n.
619d85025bSMauro Carvalho Chehab
629d85025bSMauro Carvalho Chehab``fault level``
639d85025bSMauro Carvalho Chehab+++++++++++++++
649d85025bSMauro Carvalho Chehab
659d85025bSMauro Carvalho ChehabTotally ignored
669d85025bSMauro Carvalho Chehab
679d85025bSMauro Carvalho Chehab``dev0`` to ``devn``
689d85025bSMauro Carvalho Chehab++++++++++++++++++++
699d85025bSMauro Carvalho Chehab
709d85025bSMauro Carvalho Chehabe.g. ``/dev/hda1``, ``/dev/hdc1``, ``/dev/sda1``, ``/dev/sdb1``
719d85025bSMauro Carvalho Chehab
729d85025bSMauro Carvalho ChehabA possible loadlin line (Harald Hoyer <HarryH@Royal.Net>)  looks like this::
739d85025bSMauro Carvalho Chehab
749d85025bSMauro Carvalho Chehab	e:\loadlin\loadlin e:\zimage root=/dev/md0 md=0,0,4,0,/dev/hdb2,/dev/hdc3 ro
759d85025bSMauro Carvalho Chehab
769d85025bSMauro Carvalho Chehab
779d85025bSMauro Carvalho ChehabBoot time autodetection of RAID arrays
789d85025bSMauro Carvalho Chehab--------------------------------------
799d85025bSMauro Carvalho Chehab
809d85025bSMauro Carvalho ChehabWhen md is compiled into the kernel (not as module), partitions of
819d85025bSMauro Carvalho Chehabtype 0xfd are scanned and automatically assembled into RAID arrays.
829d85025bSMauro Carvalho ChehabThis autodetection may be suppressed with the kernel parameter
839d85025bSMauro Carvalho Chehab``raid=noautodetect``.  As of kernel 2.6.9, only drives with a type 0
849d85025bSMauro Carvalho Chehabsuperblock can be autodetected and run at boot time.
859d85025bSMauro Carvalho Chehab
869d85025bSMauro Carvalho ChehabThe kernel parameter ``raid=partitionable`` (or ``raid=part``) means
879d85025bSMauro Carvalho Chehabthat all auto-detected arrays are assembled as partitionable.
889d85025bSMauro Carvalho Chehab
899d85025bSMauro Carvalho ChehabBoot time assembly of degraded/dirty arrays
909d85025bSMauro Carvalho Chehab-------------------------------------------
919d85025bSMauro Carvalho Chehab
929d85025bSMauro Carvalho ChehabIf a raid5 or raid6 array is both dirty and degraded, it could have
939d85025bSMauro Carvalho Chehabundetectable data corruption.  This is because the fact that it is
949d85025bSMauro Carvalho Chehab``dirty`` means that the parity cannot be trusted, and the fact that it
959d85025bSMauro Carvalho Chehabis degraded means that some datablocks are missing and cannot reliably
969d85025bSMauro Carvalho Chehabbe reconstructed (due to no parity).
979d85025bSMauro Carvalho Chehab
989d85025bSMauro Carvalho ChehabFor this reason, md will normally refuse to start such an array.  This
999d85025bSMauro Carvalho Chehabrequires the sysadmin to take action to explicitly start the array
1009d85025bSMauro Carvalho Chehabdespite possible corruption.  This is normally done with::
1019d85025bSMauro Carvalho Chehab
1029d85025bSMauro Carvalho Chehab   mdadm --assemble --force ....
1039d85025bSMauro Carvalho Chehab
1049d85025bSMauro Carvalho ChehabThis option is not really available if the array has the root
1059d85025bSMauro Carvalho Chehabfilesystem on it.  In order to support this booting from such an
1069d85025bSMauro Carvalho Chehabarray, md supports a module parameter ``start_dirty_degraded`` which,
1079d85025bSMauro Carvalho Chehabwhen set to 1, bypassed the checks and will allows dirty degraded
1089d85025bSMauro Carvalho Chehabarrays to be started.
1099d85025bSMauro Carvalho Chehab
1109d85025bSMauro Carvalho ChehabSo, to boot with a root filesystem of a dirty degraded raid 5 or 6, use::
1119d85025bSMauro Carvalho Chehab
1129d85025bSMauro Carvalho Chehab   md-mod.start_dirty_degraded=1
1139d85025bSMauro Carvalho Chehab
1149d85025bSMauro Carvalho Chehab
1159d85025bSMauro Carvalho ChehabSuperblock formats
1169d85025bSMauro Carvalho Chehab------------------
1179d85025bSMauro Carvalho Chehab
1189d85025bSMauro Carvalho ChehabThe md driver can support a variety of different superblock formats.
1199d85025bSMauro Carvalho ChehabCurrently, it supports superblock formats ``0.90.0`` and the ``md-1`` format
1209d85025bSMauro Carvalho Chehabintroduced in the 2.5 development series.
1219d85025bSMauro Carvalho Chehab
1229d85025bSMauro Carvalho ChehabThe kernel will autodetect which format superblock is being used.
1239d85025bSMauro Carvalho Chehab
1249d85025bSMauro Carvalho ChehabSuperblock format ``0`` is treated differently to others for legacy
1259d85025bSMauro Carvalho Chehabreasons - it is the original superblock format.
1269d85025bSMauro Carvalho Chehab
1279d85025bSMauro Carvalho Chehab
1289d85025bSMauro Carvalho ChehabGeneral Rules - apply for all superblock formats
1299d85025bSMauro Carvalho Chehab------------------------------------------------
1309d85025bSMauro Carvalho Chehab
1319d85025bSMauro Carvalho ChehabAn array is ``created`` by writing appropriate superblocks to all
1329d85025bSMauro Carvalho Chehabdevices.
1339d85025bSMauro Carvalho Chehab
1349d85025bSMauro Carvalho ChehabIt is ``assembled`` by associating each of these devices with an
1359d85025bSMauro Carvalho Chehabparticular md virtual device.  Once it is completely assembled, it can
1369d85025bSMauro Carvalho Chehabbe accessed.
1379d85025bSMauro Carvalho Chehab
1389d85025bSMauro Carvalho ChehabAn array should be created by a user-space tool.  This will write
1399d85025bSMauro Carvalho Chehabsuperblocks to all devices.  It will usually mark the array as
1409d85025bSMauro Carvalho Chehab``unclean``, or with some devices missing so that the kernel md driver
1419d85025bSMauro Carvalho Chehabcan create appropriate redundancy (copying in raid 1, parity
1429d85025bSMauro Carvalho Chehabcalculation in raid 4/5).
1439d85025bSMauro Carvalho Chehab
1449d85025bSMauro Carvalho ChehabWhen an array is assembled, it is first initialized with the
1459d85025bSMauro Carvalho ChehabSET_ARRAY_INFO ioctl.  This contains, in particular, a major and minor
1469d85025bSMauro Carvalho Chehabversion number.  The major version number selects which superblock
1479d85025bSMauro Carvalho Chehabformat is to be used.  The minor number might be used to tune handling
1489d85025bSMauro Carvalho Chehabof the format, such as suggesting where on each device to look for the
1499d85025bSMauro Carvalho Chehabsuperblock.
1509d85025bSMauro Carvalho Chehab
1519d85025bSMauro Carvalho ChehabThen each device is added using the ADD_NEW_DISK ioctl.  This
1529d85025bSMauro Carvalho Chehabprovides, in particular, a major and minor number identifying the
1539d85025bSMauro Carvalho Chehabdevice to add.
1549d85025bSMauro Carvalho Chehab
1559d85025bSMauro Carvalho ChehabThe array is started with the RUN_ARRAY ioctl.
1569d85025bSMauro Carvalho Chehab
1579d85025bSMauro Carvalho ChehabOnce started, new devices can be added.  They should have an
1589d85025bSMauro Carvalho Chehabappropriate superblock written to them, and then be passed in with
1599d85025bSMauro Carvalho ChehabADD_NEW_DISK.
1609d85025bSMauro Carvalho Chehab
1619d85025bSMauro Carvalho ChehabDevices that have failed or are not yet active can be detached from an
1629d85025bSMauro Carvalho Chehabarray using HOT_REMOVE_DISK.
1639d85025bSMauro Carvalho Chehab
1649d85025bSMauro Carvalho Chehab
1659d85025bSMauro Carvalho ChehabSpecific Rules that apply to format-0 super block arrays, and arrays with no superblock (non-persistent)
1669d85025bSMauro Carvalho Chehab--------------------------------------------------------------------------------------------------------
1679d85025bSMauro Carvalho Chehab
1689d85025bSMauro Carvalho ChehabAn array can be ``created`` by describing the array (level, chunksize
1699d85025bSMauro Carvalho Chehabetc) in a SET_ARRAY_INFO ioctl.  This must have ``major_version==0`` and
1709d85025bSMauro Carvalho Chehab``raid_disks != 0``.
1719d85025bSMauro Carvalho Chehab
1729d85025bSMauro Carvalho ChehabThen uninitialized devices can be added with ADD_NEW_DISK.  The
1739d85025bSMauro Carvalho Chehabstructure passed to ADD_NEW_DISK must specify the state of the device
1749d85025bSMauro Carvalho Chehaband its role in the array.
1759d85025bSMauro Carvalho Chehab
1769d85025bSMauro Carvalho ChehabOnce started with RUN_ARRAY, uninitialized spares can be added with
1779d85025bSMauro Carvalho ChehabHOT_ADD_DISK.
1789d85025bSMauro Carvalho Chehab
1799d85025bSMauro Carvalho Chehab
1809d85025bSMauro Carvalho ChehabMD devices in sysfs
1819d85025bSMauro Carvalho Chehab-------------------
1829d85025bSMauro Carvalho Chehab
1839d85025bSMauro Carvalho Chehabmd devices appear in sysfs (``/sys``) as regular block devices,
1849d85025bSMauro Carvalho Chehabe.g.::
1859d85025bSMauro Carvalho Chehab
1869d85025bSMauro Carvalho Chehab   /sys/block/md0
1879d85025bSMauro Carvalho Chehab
1889d85025bSMauro Carvalho ChehabEach ``md`` device will contain a subdirectory called ``md`` which
1899d85025bSMauro Carvalho Chehabcontains further md-specific information about the device.
1909d85025bSMauro Carvalho Chehab
1919d85025bSMauro Carvalho ChehabAll md devices contain:
1929d85025bSMauro Carvalho Chehab
1939d85025bSMauro Carvalho Chehab  level
1949d85025bSMauro Carvalho Chehab     a text file indicating the ``raid level``. e.g. raid0, raid1,
1959d85025bSMauro Carvalho Chehab     raid5, linear, multipath, faulty.
1969d85025bSMauro Carvalho Chehab     If no raid level has been set yet (array is still being
1979d85025bSMauro Carvalho Chehab     assembled), the value will reflect whatever has been written
1989d85025bSMauro Carvalho Chehab     to it, which may be a name like the above, or may be a number
1999d85025bSMauro Carvalho Chehab     such as ``0``, ``5``, etc.
2009d85025bSMauro Carvalho Chehab
2019d85025bSMauro Carvalho Chehab  raid_disks
2029d85025bSMauro Carvalho Chehab     a text file with a simple number indicating the number of devices
2039d85025bSMauro Carvalho Chehab     in a fully functional array.  If this is not yet known, the file
2049d85025bSMauro Carvalho Chehab     will be empty.  If an array is being resized this will contain
2059d85025bSMauro Carvalho Chehab     the new number of devices.
2069d85025bSMauro Carvalho Chehab     Some raid levels allow this value to be set while the array is
2079d85025bSMauro Carvalho Chehab     active.  This will reconfigure the array.   Otherwise it can only
2089d85025bSMauro Carvalho Chehab     be set while assembling an array.
2099d85025bSMauro Carvalho Chehab     A change to this attribute will not be permitted if it would
2109d85025bSMauro Carvalho Chehab     reduce the size of the array.  To reduce the number of drives
2119d85025bSMauro Carvalho Chehab     in an e.g. raid5, the array size must first be reduced by
2129d85025bSMauro Carvalho Chehab     setting the ``array_size`` attribute.
2139d85025bSMauro Carvalho Chehab
2149d85025bSMauro Carvalho Chehab  chunk_size
2159d85025bSMauro Carvalho Chehab     This is the size in bytes for ``chunks`` and is only relevant to
2169d85025bSMauro Carvalho Chehab     raid levels that involve striping (0,4,5,6,10). The address space
2179d85025bSMauro Carvalho Chehab     of the array is conceptually divided into chunks and consecutive
2189d85025bSMauro Carvalho Chehab     chunks are striped onto neighbouring devices.
2199d85025bSMauro Carvalho Chehab     The size should be at least PAGE_SIZE (4k) and should be a power
2209d85025bSMauro Carvalho Chehab     of 2.  This can only be set while assembling an array
2219d85025bSMauro Carvalho Chehab
2229d85025bSMauro Carvalho Chehab  layout
2239d85025bSMauro Carvalho Chehab     The ``layout`` for the array for the particular level.  This is
224751d5b27SAndrew Klychkov     simply a number that is interpreted differently by different
2259d85025bSMauro Carvalho Chehab     levels.  It can be written while assembling an array.
2269d85025bSMauro Carvalho Chehab
2279d85025bSMauro Carvalho Chehab  array_size
2289d85025bSMauro Carvalho Chehab     This can be used to artificially constrain the available space in
2299d85025bSMauro Carvalho Chehab     the array to be less than is actually available on the combined
2309d85025bSMauro Carvalho Chehab     devices.  Writing a number (in Kilobytes) which is less than
2319d85025bSMauro Carvalho Chehab     the available size will set the size.  Any reconfiguration of the
2329d85025bSMauro Carvalho Chehab     array (e.g. adding devices) will not cause the size to change.
2339d85025bSMauro Carvalho Chehab     Writing the word ``default`` will cause the effective size of the
2349d85025bSMauro Carvalho Chehab     array to be whatever size is actually available based on
2359d85025bSMauro Carvalho Chehab     ``level``, ``chunk_size`` and ``component_size``.
2369d85025bSMauro Carvalho Chehab
2379d85025bSMauro Carvalho Chehab     This can be used to reduce the size of the array before reducing
2389d85025bSMauro Carvalho Chehab     the number of devices in a raid4/5/6, or to support external
2399d85025bSMauro Carvalho Chehab     metadata formats which mandate such clipping.
2409d85025bSMauro Carvalho Chehab
2419d85025bSMauro Carvalho Chehab  reshape_position
2429d85025bSMauro Carvalho Chehab     This is either ``none`` or a sector number within the devices of
2439d85025bSMauro Carvalho Chehab     the array where ``reshape`` is up to.  If this is set, the three
2449d85025bSMauro Carvalho Chehab     attributes mentioned above (raid_disks, chunk_size, layout) can
2459d85025bSMauro Carvalho Chehab     potentially have 2 values, an old and a new value.  If these
2469d85025bSMauro Carvalho Chehab     values differ, reading the attribute returns::
2479d85025bSMauro Carvalho Chehab
2489d85025bSMauro Carvalho Chehab        new (old)
2499d85025bSMauro Carvalho Chehab
2509d85025bSMauro Carvalho Chehab     and writing will effect the ``new`` value, leaving the ``old``
2519d85025bSMauro Carvalho Chehab     unchanged.
2529d85025bSMauro Carvalho Chehab
2539d85025bSMauro Carvalho Chehab  component_size
2549d85025bSMauro Carvalho Chehab     For arrays with data redundancy (i.e. not raid0, linear, faulty,
2559d85025bSMauro Carvalho Chehab     multipath), all components must be the same size - or at least
2569d85025bSMauro Carvalho Chehab     there must a size that they all provide space for.  This is a key
2579d85025bSMauro Carvalho Chehab     part or the geometry of the array.  It is measured in sectors
2589d85025bSMauro Carvalho Chehab     and can be read from here.  Writing to this value may resize
2599d85025bSMauro Carvalho Chehab     the array if the personality supports it (raid1, raid5, raid6),
2609d85025bSMauro Carvalho Chehab     and if the component drives are large enough.
2619d85025bSMauro Carvalho Chehab
2629d85025bSMauro Carvalho Chehab  metadata_version
2639d85025bSMauro Carvalho Chehab     This indicates the format that is being used to record metadata
2649d85025bSMauro Carvalho Chehab     about the array.  It can be 0.90 (traditional format), 1.0, 1.1,
2659d85025bSMauro Carvalho Chehab     1.2 (newer format in varying locations) or ``none`` indicating that
2669d85025bSMauro Carvalho Chehab     the kernel isn't managing metadata at all.
2679d85025bSMauro Carvalho Chehab     Alternately it can be ``external:`` followed by a string which
2689d85025bSMauro Carvalho Chehab     is set by user-space.  This indicates that metadata is managed
2699d85025bSMauro Carvalho Chehab     by a user-space program.  Any device failure or other event that
2709d85025bSMauro Carvalho Chehab     requires a metadata update will cause array activity to be
2719d85025bSMauro Carvalho Chehab     suspended until the event is acknowledged.
2729d85025bSMauro Carvalho Chehab
2739d85025bSMauro Carvalho Chehab  resync_start
2749d85025bSMauro Carvalho Chehab     The point at which resync should start.  If no resync is needed,
2759d85025bSMauro Carvalho Chehab     this will be a very large number (or ``none`` since 2.6.30-rc1).  At
2769d85025bSMauro Carvalho Chehab     array creation it will default to 0, though starting the array as
2779d85025bSMauro Carvalho Chehab     ``clean`` will set it much larger.
2789d85025bSMauro Carvalho Chehab
2799d85025bSMauro Carvalho Chehab  new_dev
2809d85025bSMauro Carvalho Chehab     This file can be written but not read.  The value written should
2819d85025bSMauro Carvalho Chehab     be a block device number as major:minor.  e.g. 8:0
2829d85025bSMauro Carvalho Chehab     This will cause that device to be attached to the array, if it is
2839d85025bSMauro Carvalho Chehab     available.  It will then appear at md/dev-XXX (depending on the
2849d85025bSMauro Carvalho Chehab     name of the device) and further configuration is then possible.
2859d85025bSMauro Carvalho Chehab
2869d85025bSMauro Carvalho Chehab  safe_mode_delay
2879d85025bSMauro Carvalho Chehab     When an md array has seen no write requests for a certain period
2889d85025bSMauro Carvalho Chehab     of time, it will be marked as ``clean``.  When another write
2899d85025bSMauro Carvalho Chehab     request arrives, the array is marked as ``dirty`` before the write
2909d85025bSMauro Carvalho Chehab     commences.  This is known as ``safe_mode``.
2919d85025bSMauro Carvalho Chehab     The ``certain period`` is controlled by this file which stores the
2929d85025bSMauro Carvalho Chehab     period as a number of seconds.  The default is 200msec (0.200).
2939d85025bSMauro Carvalho Chehab     Writing a value of 0 disables safemode.
2949d85025bSMauro Carvalho Chehab
2959d85025bSMauro Carvalho Chehab  array_state
2969d85025bSMauro Carvalho Chehab     This file contains a single word which describes the current
2979d85025bSMauro Carvalho Chehab     state of the array.  In many cases, the state can be set by
2989d85025bSMauro Carvalho Chehab     writing the word for the desired state, however some states
2999d85025bSMauro Carvalho Chehab     cannot be explicitly set, and some transitions are not allowed.
3009d85025bSMauro Carvalho Chehab
3019d85025bSMauro Carvalho Chehab     Select/poll works on this file.  All changes except between
3029d85025bSMauro Carvalho Chehab     Active_idle and active (which can be frequent and are not
3039d85025bSMauro Carvalho Chehab     very interesting) are notified.  active->active_idle is
3049d85025bSMauro Carvalho Chehab     reported if the metadata is externally managed.
3059d85025bSMauro Carvalho Chehab
3069d85025bSMauro Carvalho Chehab     clear
3079d85025bSMauro Carvalho Chehab         No devices, no size, no level
3089d85025bSMauro Carvalho Chehab
3099d85025bSMauro Carvalho Chehab         Writing is equivalent to STOP_ARRAY ioctl
3109d85025bSMauro Carvalho Chehab
3119d85025bSMauro Carvalho Chehab     inactive
3129d85025bSMauro Carvalho Chehab         May have some settings, but array is not active
3139d85025bSMauro Carvalho Chehab         all IO results in error
3149d85025bSMauro Carvalho Chehab
3159d85025bSMauro Carvalho Chehab         When written, doesn't tear down array, but just stops it
3169d85025bSMauro Carvalho Chehab
3179d85025bSMauro Carvalho Chehab     suspended (not supported yet)
3189d85025bSMauro Carvalho Chehab         All IO requests will block. The array can be reconfigured.
3199d85025bSMauro Carvalho Chehab
320*dbeb56feSRandy Dunlap         Writing this, if accepted, will block until array is quiescent
3219d85025bSMauro Carvalho Chehab
3229d85025bSMauro Carvalho Chehab     readonly
3239d85025bSMauro Carvalho Chehab         no resync can happen.  no superblocks get written.
3249d85025bSMauro Carvalho Chehab
3259d85025bSMauro Carvalho Chehab         Write requests fail
3269d85025bSMauro Carvalho Chehab
3279d85025bSMauro Carvalho Chehab     read-auto
3289d85025bSMauro Carvalho Chehab         like readonly, but behaves like ``clean`` on a write request.
3299d85025bSMauro Carvalho Chehab
3309d85025bSMauro Carvalho Chehab     clean
3319d85025bSMauro Carvalho Chehab         no pending writes, but otherwise active.
3329d85025bSMauro Carvalho Chehab
3339d85025bSMauro Carvalho Chehab         When written to inactive array, starts without resync
3349d85025bSMauro Carvalho Chehab
3359d85025bSMauro Carvalho Chehab         If a write request arrives then
3369d85025bSMauro Carvalho Chehab         if metadata is known, mark ``dirty`` and switch to ``active``.
3379d85025bSMauro Carvalho Chehab         if not known, block and switch to write-pending
3389d85025bSMauro Carvalho Chehab
3399d85025bSMauro Carvalho Chehab         If written to an active array that has pending writes, then fails.
3409d85025bSMauro Carvalho Chehab     active
3419d85025bSMauro Carvalho Chehab         fully active: IO and resync can be happening.
3429d85025bSMauro Carvalho Chehab         When written to inactive array, starts with resync
3439d85025bSMauro Carvalho Chehab
3449d85025bSMauro Carvalho Chehab     write-pending
3459d85025bSMauro Carvalho Chehab         clean, but writes are blocked waiting for ``active`` to be written.
3469d85025bSMauro Carvalho Chehab
3479d85025bSMauro Carvalho Chehab     active-idle
3489d85025bSMauro Carvalho Chehab         like active, but no writes have been seen for a while (safe_mode_delay).
3499d85025bSMauro Carvalho Chehab
3509d85025bSMauro Carvalho Chehab  bitmap/location
3519d85025bSMauro Carvalho Chehab     This indicates where the write-intent bitmap for the array is
3529d85025bSMauro Carvalho Chehab     stored.
3539d85025bSMauro Carvalho Chehab
3549d85025bSMauro Carvalho Chehab     It can be one of ``none``, ``file`` or ``[+-]N``.
3559d85025bSMauro Carvalho Chehab     ``file`` may later be extended to ``file:/file/name``
3569d85025bSMauro Carvalho Chehab     ``[+-]N`` means that many sectors from the start of the metadata.
3579d85025bSMauro Carvalho Chehab
3589d85025bSMauro Carvalho Chehab     This is replicated on all devices.  For arrays with externally
3599d85025bSMauro Carvalho Chehab     managed metadata, the offset is from the beginning of the
3609d85025bSMauro Carvalho Chehab     device.
3619d85025bSMauro Carvalho Chehab
3629d85025bSMauro Carvalho Chehab  bitmap/chunksize
3639d85025bSMauro Carvalho Chehab     The size, in bytes, of the chunk which will be represented by a
3649d85025bSMauro Carvalho Chehab     single bit.  For RAID456, it is a portion of an individual
3659d85025bSMauro Carvalho Chehab     device. For RAID10, it is a portion of the array.  For RAID1, it
3669d85025bSMauro Carvalho Chehab     is both (they come to the same thing).
3679d85025bSMauro Carvalho Chehab
3689d85025bSMauro Carvalho Chehab  bitmap/time_base
3699d85025bSMauro Carvalho Chehab     The time, in seconds, between looking for bits in the bitmap to
3709d85025bSMauro Carvalho Chehab     be cleared. In the current implementation, a bit will be cleared
3719d85025bSMauro Carvalho Chehab     between 2 and 3 times ``time_base`` after all the covered blocks
3729d85025bSMauro Carvalho Chehab     are known to be in-sync.
3739d85025bSMauro Carvalho Chehab
3749d85025bSMauro Carvalho Chehab  bitmap/backlog
3759d85025bSMauro Carvalho Chehab     When write-mostly devices are active in a RAID1, write requests
3769d85025bSMauro Carvalho Chehab     to those devices proceed in the background - the filesystem (or
3779d85025bSMauro Carvalho Chehab     other user of the device) does not have to wait for them.
3789d85025bSMauro Carvalho Chehab     ``backlog`` sets a limit on the number of concurrent background
3799d85025bSMauro Carvalho Chehab     writes.  If there are more than this, new writes will by
3809d85025bSMauro Carvalho Chehab     synchronous.
3819d85025bSMauro Carvalho Chehab
3829d85025bSMauro Carvalho Chehab  bitmap/metadata
3839d85025bSMauro Carvalho Chehab     This can be either ``internal`` or ``external``.
3849d85025bSMauro Carvalho Chehab
3859d85025bSMauro Carvalho Chehab     ``internal``
3869d85025bSMauro Carvalho Chehab       is the default and means the metadata for the bitmap
3879d85025bSMauro Carvalho Chehab       is stored in the first 256 bytes of the allocated space and is
3889d85025bSMauro Carvalho Chehab       managed by the md module.
3899d85025bSMauro Carvalho Chehab
3909d85025bSMauro Carvalho Chehab     ``external``
3919d85025bSMauro Carvalho Chehab       means that bitmap metadata is managed externally to
3929d85025bSMauro Carvalho Chehab       the kernel (i.e. by some userspace program)
3939d85025bSMauro Carvalho Chehab
3949d85025bSMauro Carvalho Chehab  bitmap/can_clear
3959d85025bSMauro Carvalho Chehab     This is either ``true`` or ``false``.  If ``true``, then bits in the
3969d85025bSMauro Carvalho Chehab     bitmap will be cleared when the corresponding blocks are thought
3979d85025bSMauro Carvalho Chehab     to be in-sync.  If ``false``, bits will never be cleared.
3989d85025bSMauro Carvalho Chehab     This is automatically set to ``false`` if a write happens on a
3999d85025bSMauro Carvalho Chehab     degraded array, or if the array becomes degraded during a write.
4009d85025bSMauro Carvalho Chehab     When metadata is managed externally, it should be set to true
4019d85025bSMauro Carvalho Chehab     once the array becomes non-degraded, and this fact has been
4029d85025bSMauro Carvalho Chehab     recorded in the metadata.
4039d85025bSMauro Carvalho Chehab
404664aed04SArtur Paszkiewicz  consistency_policy
405664aed04SArtur Paszkiewicz     This indicates how the array maintains consistency in case of unexpected
406664aed04SArtur Paszkiewicz     shutdown. It can be:
4079d85025bSMauro Carvalho Chehab
408664aed04SArtur Paszkiewicz     none
409664aed04SArtur Paszkiewicz       Array has no redundancy information, e.g. raid0, linear.
410664aed04SArtur Paszkiewicz
411664aed04SArtur Paszkiewicz     resync
412664aed04SArtur Paszkiewicz       Full resync is performed and all redundancy is regenerated when the
413664aed04SArtur Paszkiewicz       array is started after unclean shutdown.
414664aed04SArtur Paszkiewicz
415664aed04SArtur Paszkiewicz     bitmap
416664aed04SArtur Paszkiewicz       Resync assisted by a write-intent bitmap.
417664aed04SArtur Paszkiewicz
418664aed04SArtur Paszkiewicz     journal
419664aed04SArtur Paszkiewicz       For raid4/5/6, journal device is used to log transactions and replay
420664aed04SArtur Paszkiewicz       after unclean shutdown.
421664aed04SArtur Paszkiewicz
422664aed04SArtur Paszkiewicz     ppl
423664aed04SArtur Paszkiewicz       For raid5 only, Partial Parity Log is used to close the write hole and
424664aed04SArtur Paszkiewicz       eliminate resync.
425664aed04SArtur Paszkiewicz
426664aed04SArtur Paszkiewicz     The accepted values when writing to this file are ``ppl`` and ``resync``,
427664aed04SArtur Paszkiewicz     used to enable and disable PPL.
4289d85025bSMauro Carvalho Chehab
429ec164d07SSebastian Parschauer  uuid
430ec164d07SSebastian Parschauer     This indicates the UUID of the array in the following format:
431ec164d07SSebastian Parschauer     xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
432ec164d07SSebastian Parschauer
4339d85025bSMauro Carvalho Chehab
4349d85025bSMauro Carvalho ChehabAs component devices are added to an md array, they appear in the ``md``
4359d85025bSMauro Carvalho Chehabdirectory as new directories named::
4369d85025bSMauro Carvalho Chehab
4379d85025bSMauro Carvalho Chehab      dev-XXX
4389d85025bSMauro Carvalho Chehab
4399d85025bSMauro Carvalho Chehabwhere ``XXX`` is a name that the kernel knows for the device, e.g. hdb1.
4409d85025bSMauro Carvalho ChehabEach directory contains:
4419d85025bSMauro Carvalho Chehab
4429d85025bSMauro Carvalho Chehab      block
4439d85025bSMauro Carvalho Chehab        a symlink to the block device in /sys/block, e.g.::
4449d85025bSMauro Carvalho Chehab
4459d85025bSMauro Carvalho Chehab	     /sys/block/md0/md/dev-hdb1/block -> ../../../../block/hdb/hdb1
4469d85025bSMauro Carvalho Chehab
4479d85025bSMauro Carvalho Chehab      super
4489d85025bSMauro Carvalho Chehab        A file containing an image of the superblock read from, or
4499d85025bSMauro Carvalho Chehab        written to, that device.
4509d85025bSMauro Carvalho Chehab
4519d85025bSMauro Carvalho Chehab      state
4529d85025bSMauro Carvalho Chehab	A file recording the current state of the device in the array
4539d85025bSMauro Carvalho Chehab	which can be a comma separated list of:
4549d85025bSMauro Carvalho Chehab
4559d85025bSMauro Carvalho Chehab	      faulty
4569d85025bSMauro Carvalho Chehab			device has been kicked from active use due to
4579d85025bSMauro Carvalho Chehab			a detected fault, or it has unacknowledged bad
4589d85025bSMauro Carvalho Chehab			blocks
4599d85025bSMauro Carvalho Chehab
4609d85025bSMauro Carvalho Chehab	      in_sync
4619d85025bSMauro Carvalho Chehab			device is a fully in-sync member of the array
4629d85025bSMauro Carvalho Chehab
4639d85025bSMauro Carvalho Chehab	      writemostly
4649d85025bSMauro Carvalho Chehab			device will only be subject to read
4659d85025bSMauro Carvalho Chehab			requests if there are no other options.
4669d85025bSMauro Carvalho Chehab
4679d85025bSMauro Carvalho Chehab			This applies only to raid1 arrays.
4689d85025bSMauro Carvalho Chehab
4699d85025bSMauro Carvalho Chehab	      blocked
4709d85025bSMauro Carvalho Chehab			device has failed, and the failure hasn't been
4719d85025bSMauro Carvalho Chehab			acknowledged yet by the metadata handler.
4729d85025bSMauro Carvalho Chehab
4739d85025bSMauro Carvalho Chehab			Writes that would write to this device if
4749d85025bSMauro Carvalho Chehab			it were not faulty are blocked.
4759d85025bSMauro Carvalho Chehab
4769d85025bSMauro Carvalho Chehab	      spare
4779d85025bSMauro Carvalho Chehab			device is working, but not a full member.
4789d85025bSMauro Carvalho Chehab
4799d85025bSMauro Carvalho Chehab			This includes spares that are in the process
4809d85025bSMauro Carvalho Chehab			of being recovered to
4819d85025bSMauro Carvalho Chehab
4829d85025bSMauro Carvalho Chehab	      write_error
4839d85025bSMauro Carvalho Chehab			device has ever seen a write error.
4849d85025bSMauro Carvalho Chehab
4859d85025bSMauro Carvalho Chehab	      want_replacement
4869d85025bSMauro Carvalho Chehab			device is (mostly) working but probably
4879d85025bSMauro Carvalho Chehab			should be replaced, either due to errors or
4889d85025bSMauro Carvalho Chehab			due to user request.
4899d85025bSMauro Carvalho Chehab
4909d85025bSMauro Carvalho Chehab	      replacement
4919d85025bSMauro Carvalho Chehab			device is a replacement for another active
4929d85025bSMauro Carvalho Chehab			device with same raid_disk.
4939d85025bSMauro Carvalho Chehab
4949d85025bSMauro Carvalho Chehab
4959d85025bSMauro Carvalho Chehab	This list may grow in future.
4969d85025bSMauro Carvalho Chehab
4979d85025bSMauro Carvalho Chehab	This can be written to.
4989d85025bSMauro Carvalho Chehab
4999d85025bSMauro Carvalho Chehab	Writing ``faulty``  simulates a failure on the device.
5009d85025bSMauro Carvalho Chehab
5019d85025bSMauro Carvalho Chehab	Writing ``remove`` removes the device from the array.
5029d85025bSMauro Carvalho Chehab
5039d85025bSMauro Carvalho Chehab	Writing ``writemostly`` sets the writemostly flag.
5049d85025bSMauro Carvalho Chehab
5059d85025bSMauro Carvalho Chehab	Writing ``-writemostly`` clears the writemostly flag.
5069d85025bSMauro Carvalho Chehab
5079d85025bSMauro Carvalho Chehab	Writing ``blocked`` sets the ``blocked`` flag.
5089d85025bSMauro Carvalho Chehab
5099d85025bSMauro Carvalho Chehab	Writing ``-blocked`` clears the ``blocked`` flags and allows writes
5109d85025bSMauro Carvalho Chehab	to complete and possibly simulates an error.
5119d85025bSMauro Carvalho Chehab
5129d85025bSMauro Carvalho Chehab	Writing ``in_sync`` sets the in_sync flag.
5139d85025bSMauro Carvalho Chehab
5149d85025bSMauro Carvalho Chehab	Writing ``write_error`` sets writeerrorseen flag.
5159d85025bSMauro Carvalho Chehab
5169d85025bSMauro Carvalho Chehab	Writing ``-write_error`` clears writeerrorseen flag.
5179d85025bSMauro Carvalho Chehab
5189d85025bSMauro Carvalho Chehab	Writing ``want_replacement`` is allowed at any time except to a
5199d85025bSMauro Carvalho Chehab	replacement device or a spare.  It sets the flag.
5209d85025bSMauro Carvalho Chehab
5219d85025bSMauro Carvalho Chehab	Writing ``-want_replacement`` is allowed at any time.  It clears
5229d85025bSMauro Carvalho Chehab	the flag.
5239d85025bSMauro Carvalho Chehab
5249d85025bSMauro Carvalho Chehab	Writing ``replacement`` or ``-replacement`` is only allowed before
5259d85025bSMauro Carvalho Chehab	starting the array.  It sets or clears the flag.
5269d85025bSMauro Carvalho Chehab
5279d85025bSMauro Carvalho Chehab
5289d85025bSMauro Carvalho Chehab	This file responds to select/poll. Any change to ``faulty``
5299d85025bSMauro Carvalho Chehab	or ``blocked`` causes an event.
5309d85025bSMauro Carvalho Chehab
5319d85025bSMauro Carvalho Chehab      errors
5329d85025bSMauro Carvalho Chehab	An approximate count of read errors that have been detected on
5339d85025bSMauro Carvalho Chehab	this device but have not caused the device to be evicted from
5349d85025bSMauro Carvalho Chehab	the array (either because they were corrected or because they
5359d85025bSMauro Carvalho Chehab	happened while the array was read-only).  When using version-1
5369d85025bSMauro Carvalho Chehab	metadata, this value persists across restarts of the array.
5379d85025bSMauro Carvalho Chehab
5389d85025bSMauro Carvalho Chehab	This value can be written while assembling an array thus
5399d85025bSMauro Carvalho Chehab	providing an ongoing count for arrays with metadata managed by
5409d85025bSMauro Carvalho Chehab	userspace.
5419d85025bSMauro Carvalho Chehab
5429d85025bSMauro Carvalho Chehab      slot
5439d85025bSMauro Carvalho Chehab        This gives the role that the device has in the array.  It will
5449d85025bSMauro Carvalho Chehab	either be ``none`` if the device is not active in the array
5459d85025bSMauro Carvalho Chehab        (i.e. is a spare or has failed) or an integer less than the
5469d85025bSMauro Carvalho Chehab	``raid_disks`` number for the array indicating which position
5479d85025bSMauro Carvalho Chehab	it currently fills.  This can only be set while assembling an
5489d85025bSMauro Carvalho Chehab	array.  A device for which this is set is assumed to be working.
5499d85025bSMauro Carvalho Chehab
5509d85025bSMauro Carvalho Chehab      offset
5519d85025bSMauro Carvalho Chehab        This gives the location in the device (in sectors from the
5529d85025bSMauro Carvalho Chehab        start) where data from the array will be stored.  Any part of
5539d85025bSMauro Carvalho Chehab        the device before this offset is not touched, unless it is
5549d85025bSMauro Carvalho Chehab        used for storing metadata (Formats 1.1 and 1.2).
5559d85025bSMauro Carvalho Chehab
5569d85025bSMauro Carvalho Chehab      size
5579d85025bSMauro Carvalho Chehab        The amount of the device, after the offset, that can be used
5589d85025bSMauro Carvalho Chehab        for storage of data.  This will normally be the same as the
5599d85025bSMauro Carvalho Chehab	component_size.  This can be written while assembling an
5609d85025bSMauro Carvalho Chehab        array.  If a value less than the current component_size is
5619d85025bSMauro Carvalho Chehab        written, it will be rejected.
5629d85025bSMauro Carvalho Chehab
5639d85025bSMauro Carvalho Chehab      recovery_start
5649d85025bSMauro Carvalho Chehab        When the device is not ``in_sync``, this records the number of
5659d85025bSMauro Carvalho Chehab	sectors from the start of the device which are known to be
5669d85025bSMauro Carvalho Chehab	correct.  This is normally zero, but during a recovery
5679d85025bSMauro Carvalho Chehab	operation it will steadily increase, and if the recovery is
5689d85025bSMauro Carvalho Chehab	interrupted, restoring this value can cause recovery to
5699d85025bSMauro Carvalho Chehab	avoid repeating the earlier blocks.  With v1.x metadata, this
5709d85025bSMauro Carvalho Chehab	value is saved and restored automatically.
5719d85025bSMauro Carvalho Chehab
5729d85025bSMauro Carvalho Chehab	This can be set whenever the device is not an active member of
5739d85025bSMauro Carvalho Chehab	the array, either before the array is activated, or before
5749d85025bSMauro Carvalho Chehab	the ``slot`` is set.
5759d85025bSMauro Carvalho Chehab
5769d85025bSMauro Carvalho Chehab	Setting this to ``none`` is equivalent to setting ``in_sync``.
5779d85025bSMauro Carvalho Chehab	Setting to any other value also clears the ``in_sync`` flag.
5789d85025bSMauro Carvalho Chehab
5799d85025bSMauro Carvalho Chehab      bad_blocks
5809d85025bSMauro Carvalho Chehab	This gives the list of all known bad blocks in the form of
5819d85025bSMauro Carvalho Chehab	start address and length (in sectors respectively). If output
5829d85025bSMauro Carvalho Chehab	is too big to fit in a page, it will be truncated. Writing
5839d85025bSMauro Carvalho Chehab	``sector length`` to this file adds new acknowledged (i.e.
5849d85025bSMauro Carvalho Chehab	recorded to disk safely) bad blocks.
5859d85025bSMauro Carvalho Chehab
5869d85025bSMauro Carvalho Chehab      unacknowledged_bad_blocks
5879d85025bSMauro Carvalho Chehab	This gives the list of known-but-not-yet-saved-to-disk bad
5889d85025bSMauro Carvalho Chehab	blocks in the same form of ``bad_blocks``. If output is too big
5899d85025bSMauro Carvalho Chehab	to fit in a page, it will be truncated. Writing to this file
5909d85025bSMauro Carvalho Chehab	adds bad blocks without acknowledging them. This is largely
5919d85025bSMauro Carvalho Chehab	for testing.
5929d85025bSMauro Carvalho Chehab
593664aed04SArtur Paszkiewicz      ppl_sector, ppl_size
594664aed04SArtur Paszkiewicz        Location and size (in sectors) of the space used for Partial Parity Log
595664aed04SArtur Paszkiewicz        on this device.
5969d85025bSMauro Carvalho Chehab
5979d85025bSMauro Carvalho Chehab
5989d85025bSMauro Carvalho ChehabAn active md device will also contain an entry for each active device
5999d85025bSMauro Carvalho Chehabin the array.  These are named::
6009d85025bSMauro Carvalho Chehab
6019d85025bSMauro Carvalho Chehab    rdNN
6029d85025bSMauro Carvalho Chehab
6039d85025bSMauro Carvalho Chehabwhere ``NN`` is the position in the array, starting from 0.
6049d85025bSMauro Carvalho ChehabSo for a 3 drive array there will be rd0, rd1, rd2.
6059d85025bSMauro Carvalho ChehabThese are symbolic links to the appropriate ``dev-XXX`` entry.
6069d85025bSMauro Carvalho ChehabThus, for example::
6079d85025bSMauro Carvalho Chehab
6089d85025bSMauro Carvalho Chehab       cat /sys/block/md*/md/rd*/state
6099d85025bSMauro Carvalho Chehab
6109d85025bSMauro Carvalho Chehabwill show ``in_sync`` on every line.
6119d85025bSMauro Carvalho Chehab
6129d85025bSMauro Carvalho Chehab
6139d85025bSMauro Carvalho Chehab
6149d85025bSMauro Carvalho ChehabActive md devices for levels that support data redundancy (1,4,5,6,10)
6159d85025bSMauro Carvalho Chehabalso have
6169d85025bSMauro Carvalho Chehab
6179d85025bSMauro Carvalho Chehab   sync_action
6189d85025bSMauro Carvalho Chehab     a text file that can be used to monitor and control the rebuild
6199d85025bSMauro Carvalho Chehab     process.  It contains one word which can be one of:
6209d85025bSMauro Carvalho Chehab
6219d85025bSMauro Carvalho Chehab       resync
6229d85025bSMauro Carvalho Chehab		redundancy is being recalculated after unclean
6239d85025bSMauro Carvalho Chehab                shutdown or creation
6249d85025bSMauro Carvalho Chehab
6259d85025bSMauro Carvalho Chehab       recover
6269d85025bSMauro Carvalho Chehab		a hot spare is being built to replace a
6279d85025bSMauro Carvalho Chehab		failed/missing device
6289d85025bSMauro Carvalho Chehab
6299d85025bSMauro Carvalho Chehab       idle
6309d85025bSMauro Carvalho Chehab		nothing is happening
6319d85025bSMauro Carvalho Chehab       check
6329d85025bSMauro Carvalho Chehab		A full check of redundancy was requested and is
6339d85025bSMauro Carvalho Chehab                happening.  This reads all blocks and checks
6349d85025bSMauro Carvalho Chehab                them. A repair may also happen for some raid
6359d85025bSMauro Carvalho Chehab                levels.
6369d85025bSMauro Carvalho Chehab
6379d85025bSMauro Carvalho Chehab       repair
6389d85025bSMauro Carvalho Chehab		A full check and repair is happening.  This is
6399d85025bSMauro Carvalho Chehab		similar to ``resync``, but was requested by the
6409d85025bSMauro Carvalho Chehab                user, and the write-intent bitmap is NOT used to
6419d85025bSMauro Carvalho Chehab		optimise the process.
6429d85025bSMauro Carvalho Chehab
6439d85025bSMauro Carvalho Chehab      This file is writable, and each of the strings that could be
6449d85025bSMauro Carvalho Chehab      read are meaningful for writing.
6459d85025bSMauro Carvalho Chehab
6469d85025bSMauro Carvalho Chehab	``idle`` will stop an active resync/recovery etc.  There is no
6479d85025bSMauro Carvalho Chehab	guarantee that another resync/recovery may not be automatically
6489d85025bSMauro Carvalho Chehab	started again, though some event will be needed to trigger
6499d85025bSMauro Carvalho Chehab	this.
6509d85025bSMauro Carvalho Chehab
6519d85025bSMauro Carvalho Chehab	``resync`` or ``recovery`` can be used to restart the
6529d85025bSMauro Carvalho Chehab        corresponding operation if it was stopped with ``idle``.
6539d85025bSMauro Carvalho Chehab
6549d85025bSMauro Carvalho Chehab	``check`` and ``repair`` will start the appropriate process
6559d85025bSMauro Carvalho Chehab	providing the current state is ``idle``.
6569d85025bSMauro Carvalho Chehab
6579d85025bSMauro Carvalho Chehab      This file responds to select/poll.  Any important change in the value
6589d85025bSMauro Carvalho Chehab      triggers a poll event.  Sometimes the value will briefly be
6599d85025bSMauro Carvalho Chehab      ``recover`` if a recovery seems to be needed, but cannot be
6609d85025bSMauro Carvalho Chehab      achieved. In that case, the transition to ``recover`` isn't
6619d85025bSMauro Carvalho Chehab      notified, but the transition away is.
6629d85025bSMauro Carvalho Chehab
6639d85025bSMauro Carvalho Chehab   degraded
6649d85025bSMauro Carvalho Chehab      This contains a count of the number of devices by which the
6659d85025bSMauro Carvalho Chehab      arrays is degraded.  So an optimal array will show ``0``.  A
6669d85025bSMauro Carvalho Chehab      single failed/missing drive will show ``1``, etc.
6679d85025bSMauro Carvalho Chehab
6689d85025bSMauro Carvalho Chehab      This file responds to select/poll, any increase or decrease
6699d85025bSMauro Carvalho Chehab      in the count of missing devices will trigger an event.
6709d85025bSMauro Carvalho Chehab
6719d85025bSMauro Carvalho Chehab   mismatch_count
6729d85025bSMauro Carvalho Chehab      When performing ``check`` and ``repair``, and possibly when
6739d85025bSMauro Carvalho Chehab      performing ``resync``, md will count the number of errors that are
6749d85025bSMauro Carvalho Chehab      found.  The count in ``mismatch_cnt`` is the number of sectors
6759d85025bSMauro Carvalho Chehab      that were re-written, or (for ``check``) would have been
6769d85025bSMauro Carvalho Chehab      re-written.  As most raid levels work in units of pages rather
6779d85025bSMauro Carvalho Chehab      than sectors, this may be larger than the number of actual errors
6789d85025bSMauro Carvalho Chehab      by a factor of the number of sectors in a page.
6799d85025bSMauro Carvalho Chehab
6809d85025bSMauro Carvalho Chehab   bitmap_set_bits
6819d85025bSMauro Carvalho Chehab      If the array has a write-intent bitmap, then writing to this
6829d85025bSMauro Carvalho Chehab      attribute can set bits in the bitmap, indicating that a resync
6839d85025bSMauro Carvalho Chehab      would need to check the corresponding blocks. Either individual
6849d85025bSMauro Carvalho Chehab      numbers or start-end pairs can be written.  Multiple numbers
6859d85025bSMauro Carvalho Chehab      can be separated by a space.
6869d85025bSMauro Carvalho Chehab
6879d85025bSMauro Carvalho Chehab      Note that the numbers are ``bit`` numbers, not ``block`` numbers.
6889d85025bSMauro Carvalho Chehab      They should be scaled by the bitmap_chunksize.
6899d85025bSMauro Carvalho Chehab
6909d85025bSMauro Carvalho Chehab   sync_speed_min, sync_speed_max
6919d85025bSMauro Carvalho Chehab     This are similar to ``/proc/sys/dev/raid/speed_limit_{min,max}``
6929d85025bSMauro Carvalho Chehab     however they only apply to the particular array.
6939d85025bSMauro Carvalho Chehab
6949d85025bSMauro Carvalho Chehab     If no value has been written to these, or if the word ``system``
6959d85025bSMauro Carvalho Chehab     is written, then the system-wide value is used.  If a value,
6969d85025bSMauro Carvalho Chehab     in kibibytes-per-second is written, then it is used.
6979d85025bSMauro Carvalho Chehab
6989d85025bSMauro Carvalho Chehab     When the files are read, they show the currently active value
6999d85025bSMauro Carvalho Chehab     followed by ``(local)`` or ``(system)`` depending on whether it is
7009d85025bSMauro Carvalho Chehab     a locally set or system-wide value.
7019d85025bSMauro Carvalho Chehab
7029d85025bSMauro Carvalho Chehab   sync_completed
7039d85025bSMauro Carvalho Chehab     This shows the number of sectors that have been completed of
7049d85025bSMauro Carvalho Chehab     whatever the current sync_action is, followed by the number of
7059d85025bSMauro Carvalho Chehab     sectors in total that could need to be processed.  The two
7069d85025bSMauro Carvalho Chehab     numbers are separated by a ``/``  thus effectively showing one
7079d85025bSMauro Carvalho Chehab     value, a fraction of the process that is complete.
7089d85025bSMauro Carvalho Chehab
7099d85025bSMauro Carvalho Chehab     A ``select`` on this attribute will return when resync completes,
7109d85025bSMauro Carvalho Chehab     when it reaches the current sync_max (below) and possibly at
7119d85025bSMauro Carvalho Chehab     other times.
7129d85025bSMauro Carvalho Chehab
7139d85025bSMauro Carvalho Chehab   sync_speed
7149d85025bSMauro Carvalho Chehab     This shows the current actual speed, in K/sec, of the current
7159d85025bSMauro Carvalho Chehab     sync_action.  It is averaged over the last 30 seconds.
7169d85025bSMauro Carvalho Chehab
7179d85025bSMauro Carvalho Chehab   suspend_lo, suspend_hi
7189d85025bSMauro Carvalho Chehab     The two values, given as numbers of sectors, indicate a range
7199d85025bSMauro Carvalho Chehab     within the array where IO will be blocked.  This is currently
7209d85025bSMauro Carvalho Chehab     only supported for raid4/5/6.
7219d85025bSMauro Carvalho Chehab
7229d85025bSMauro Carvalho Chehab   sync_min, sync_max
7239d85025bSMauro Carvalho Chehab     The two values, given as numbers of sectors, indicate a range
7249d85025bSMauro Carvalho Chehab     within the array where ``check``/``repair`` will operate. Must be
7259d85025bSMauro Carvalho Chehab     a multiple of chunk_size. When it reaches ``sync_max`` it will
7269d85025bSMauro Carvalho Chehab     pause, rather than complete.
7279d85025bSMauro Carvalho Chehab     You can use ``select`` or ``poll`` on ``sync_completed`` to wait for
7289d85025bSMauro Carvalho Chehab     that number to reach sync_max.  Then you can either increase
7299d85025bSMauro Carvalho Chehab     ``sync_max``, or can write ``idle`` to ``sync_action``.
7309d85025bSMauro Carvalho Chehab
7319d85025bSMauro Carvalho Chehab     The value of ``max`` for ``sync_max`` effectively disables the limit.
7329d85025bSMauro Carvalho Chehab     When a resync is active, the value can only ever be increased,
7339d85025bSMauro Carvalho Chehab     never decreased.
7349d85025bSMauro Carvalho Chehab     The value of ``0`` is the minimum for ``sync_min``.
7359d85025bSMauro Carvalho Chehab
7369d85025bSMauro Carvalho Chehab
7379d85025bSMauro Carvalho Chehab
7389d85025bSMauro Carvalho ChehabEach active md device may also have attributes specific to the
7399d85025bSMauro Carvalho Chehabpersonality module that manages it.
7409d85025bSMauro Carvalho ChehabThese are specific to the implementation of the module and could
7419d85025bSMauro Carvalho Chehabchange substantially if the implementation changes.
7429d85025bSMauro Carvalho Chehab
7439d85025bSMauro Carvalho ChehabThese currently include:
7449d85025bSMauro Carvalho Chehab
7459d85025bSMauro Carvalho Chehab  stripe_cache_size  (currently raid5 only)
7469d85025bSMauro Carvalho Chehab      number of entries in the stripe cache.  This is writable, but
7479d85025bSMauro Carvalho Chehab      there are upper and lower limits (32768, 17).  Default is 256.
7489d85025bSMauro Carvalho Chehab
7499d85025bSMauro Carvalho Chehab  strip_cache_active (currently raid5 only)
7509d85025bSMauro Carvalho Chehab      number of active entries in the stripe cache
7519d85025bSMauro Carvalho Chehab
7529d85025bSMauro Carvalho Chehab  preread_bypass_threshold (currently raid5 only)
7539d85025bSMauro Carvalho Chehab      number of times a stripe requiring preread will be bypassed by
7549d85025bSMauro Carvalho Chehab      a stripe that does not require preread.  For fairness defaults
7559d85025bSMauro Carvalho Chehab      to 1.  Setting this to 0 disables bypass accounting and
7569d85025bSMauro Carvalho Chehab      requires preread stripes to wait until all full-width stripe-
7579d85025bSMauro Carvalho Chehab      writes are complete.  Valid values are 0 to stripe_cache_size.
7585a6265f9SShaohua Li
7595a6265f9SShaohua Li  journal_mode (currently raid5 only)
7605a6265f9SShaohua Li      The cache mode for raid5. raid5 could include an extra disk for
7615a6265f9SShaohua Li      caching. The mode can be "write-throuth" and "write-back". The
7625a6265f9SShaohua Li      default is "write-through".
763a596d086SMariusz Dabrowski
764a596d086SMariusz Dabrowski  ppl_write_hint
765a596d086SMariusz Dabrowski      NVMe stream ID to be set for each PPL write request.
766