18c2ecf20Sopenharmony_ci=======
28c2ecf20Sopenharmony_cidm-raid
38c2ecf20Sopenharmony_ci=======
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ciThe device-mapper RAID (dm-raid) target provides a bridge from DM to MD.
68c2ecf20Sopenharmony_ciIt allows the MD RAID drivers to be accessed using a device-mapper
78c2ecf20Sopenharmony_ciinterface.
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ciMapping Table Interface
118c2ecf20Sopenharmony_ci-----------------------
128c2ecf20Sopenharmony_ciThe target is named "raid" and it accepts the following parameters::
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci  <raid_type> <#raid_params> <raid_params> \
158c2ecf20Sopenharmony_ci    <#raid_devs> <metadata_dev0> <dev0> [.. <metadata_devN> <devN>]
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci<raid_type>:
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci  ============= ===============================================================
208c2ecf20Sopenharmony_ci  raid0		RAID0 striping (no resilience)
218c2ecf20Sopenharmony_ci  raid1		RAID1 mirroring
228c2ecf20Sopenharmony_ci  raid4		RAID4 with dedicated last parity disk
238c2ecf20Sopenharmony_ci  raid5_n 	RAID5 with dedicated last parity disk supporting takeover
248c2ecf20Sopenharmony_ci		Same as raid4
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci		- Transitory layout
278c2ecf20Sopenharmony_ci  raid5_la	RAID5 left asymmetric
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci		- rotating parity 0 with data continuation
308c2ecf20Sopenharmony_ci  raid5_ra	RAID5 right asymmetric
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci		- rotating parity N with data continuation
338c2ecf20Sopenharmony_ci  raid5_ls	RAID5 left symmetric
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci		- rotating parity 0 with data restart
368c2ecf20Sopenharmony_ci  raid5_rs 	RAID5 right symmetric
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci		- rotating parity N with data restart
398c2ecf20Sopenharmony_ci  raid6_zr	RAID6 zero restart
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci		- rotating parity zero (left-to-right) with data restart
428c2ecf20Sopenharmony_ci  raid6_nr	RAID6 N restart
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci		- rotating parity N (right-to-left) with data restart
458c2ecf20Sopenharmony_ci  raid6_nc	RAID6 N continue
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci		- rotating parity N (right-to-left) with data continuation
488c2ecf20Sopenharmony_ci  raid6_n_6	RAID6 with dedicate parity disks
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci		- parity and Q-syndrome on the last 2 disks;
518c2ecf20Sopenharmony_ci		  layout for takeover from/to raid4/raid5_n
528c2ecf20Sopenharmony_ci  raid6_la_6	Same as "raid_la" plus dedicated last Q-syndrome disk
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci		- layout for takeover from raid5_la from/to raid6
558c2ecf20Sopenharmony_ci  raid6_ra_6	Same as "raid5_ra" dedicated last Q-syndrome disk
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci		- layout for takeover from raid5_ra from/to raid6
588c2ecf20Sopenharmony_ci  raid6_ls_6	Same as "raid5_ls" dedicated last Q-syndrome disk
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci		- layout for takeover from raid5_ls from/to raid6
618c2ecf20Sopenharmony_ci  raid6_rs_6	Same as "raid5_rs" dedicated last Q-syndrome disk
628c2ecf20Sopenharmony_ci
638c2ecf20Sopenharmony_ci		- layout for takeover from raid5_rs from/to raid6
648c2ecf20Sopenharmony_ci  raid10        Various RAID10 inspired algorithms chosen by additional params
658c2ecf20Sopenharmony_ci		(see raid10_format and raid10_copies below)
668c2ecf20Sopenharmony_ci
678c2ecf20Sopenharmony_ci		- RAID10: Striped Mirrors (aka 'Striping on top of mirrors')
688c2ecf20Sopenharmony_ci		- RAID1E: Integrated Adjacent Stripe Mirroring
698c2ecf20Sopenharmony_ci		- RAID1E: Integrated Offset Stripe Mirroring
708c2ecf20Sopenharmony_ci		- and other similar RAID10 variants
718c2ecf20Sopenharmony_ci  ============= ===============================================================
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci  Reference: Chapter 4 of
748c2ecf20Sopenharmony_ci  https://www.snia.org/sites/default/files/SNIA_DDF_Technical_Position_v2.0.pdf
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci<#raid_params>: The number of parameters that follow.
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ci<raid_params> consists of
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci    Mandatory parameters:
818c2ecf20Sopenharmony_ci        <chunk_size>:
828c2ecf20Sopenharmony_ci		      Chunk size in sectors.  This parameter is often known as
838c2ecf20Sopenharmony_ci		      "stripe size".  It is the only mandatory parameter and
848c2ecf20Sopenharmony_ci		      is placed first.
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci    followed by optional parameters (in any order):
878c2ecf20Sopenharmony_ci	[sync|nosync]
888c2ecf20Sopenharmony_ci		Force or prevent RAID initialization.
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_ci	[rebuild <idx>]
918c2ecf20Sopenharmony_ci		Rebuild drive number 'idx' (first drive is 0).
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci	[daemon_sleep <ms>]
948c2ecf20Sopenharmony_ci		Interval between runs of the bitmap daemon that
958c2ecf20Sopenharmony_ci		clear bits.  A longer interval means less bitmap I/O but
968c2ecf20Sopenharmony_ci		resyncing after a failure is likely to take longer.
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci	[min_recovery_rate <kB/sec/disk>]
998c2ecf20Sopenharmony_ci		Throttle RAID initialization
1008c2ecf20Sopenharmony_ci	[max_recovery_rate <kB/sec/disk>]
1018c2ecf20Sopenharmony_ci		Throttle RAID initialization
1028c2ecf20Sopenharmony_ci	[write_mostly <idx>]
1038c2ecf20Sopenharmony_ci		Mark drive index 'idx' write-mostly.
1048c2ecf20Sopenharmony_ci	[max_write_behind <sectors>]
1058c2ecf20Sopenharmony_ci		See '--write-behind=' (man mdadm)
1068c2ecf20Sopenharmony_ci	[stripe_cache <sectors>]
1078c2ecf20Sopenharmony_ci		Stripe cache size (RAID 4/5/6 only)
1088c2ecf20Sopenharmony_ci	[region_size <sectors>]
1098c2ecf20Sopenharmony_ci		The region_size multiplied by the number of regions is the
1108c2ecf20Sopenharmony_ci		logical size of the array.  The bitmap records the device
1118c2ecf20Sopenharmony_ci		synchronisation state for each region.
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ci        [raid10_copies   <# copies>], [raid10_format   <near|far|offset>]
1148c2ecf20Sopenharmony_ci		These two options are used to alter the default layout of
1158c2ecf20Sopenharmony_ci		a RAID10 configuration.  The number of copies is can be
1168c2ecf20Sopenharmony_ci		specified, but the default is 2.  There are also three
1178c2ecf20Sopenharmony_ci		variations to how the copies are laid down - the default
1188c2ecf20Sopenharmony_ci		is "near".  Near copies are what most people think of with
1198c2ecf20Sopenharmony_ci		respect to mirroring.  If these options are left unspecified,
1208c2ecf20Sopenharmony_ci		or 'raid10_copies 2' and/or 'raid10_format near' are given,
1218c2ecf20Sopenharmony_ci		then the layouts for 2, 3 and 4 devices	are:
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_ci		========	 ==========	   ==============
1248c2ecf20Sopenharmony_ci		2 drives         3 drives          4 drives
1258c2ecf20Sopenharmony_ci		========	 ==========	   ==============
1268c2ecf20Sopenharmony_ci		A1  A1           A1  A1  A2        A1  A1  A2  A2
1278c2ecf20Sopenharmony_ci		A2  A2           A2  A3  A3        A3  A3  A4  A4
1288c2ecf20Sopenharmony_ci		A3  A3           A4  A4  A5        A5  A5  A6  A6
1298c2ecf20Sopenharmony_ci		A4  A4           A5  A6  A6        A7  A7  A8  A8
1308c2ecf20Sopenharmony_ci		..  ..           ..  ..  ..        ..  ..  ..  ..
1318c2ecf20Sopenharmony_ci		========	 ==========	   ==============
1328c2ecf20Sopenharmony_ci
1338c2ecf20Sopenharmony_ci		The 2-device layout is equivalent 2-way RAID1.  The 4-device
1348c2ecf20Sopenharmony_ci		layout is what a traditional RAID10 would look like.  The
1358c2ecf20Sopenharmony_ci		3-device layout is what might be called a 'RAID1E - Integrated
1368c2ecf20Sopenharmony_ci		Adjacent Stripe Mirroring'.
1378c2ecf20Sopenharmony_ci
1388c2ecf20Sopenharmony_ci		If 'raid10_copies 2' and 'raid10_format far', then the layouts
1398c2ecf20Sopenharmony_ci		for 2, 3 and 4 devices are:
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_ci		========	     ============	  ===================
1428c2ecf20Sopenharmony_ci		2 drives             3 drives             4 drives
1438c2ecf20Sopenharmony_ci		========	     ============	  ===================
1448c2ecf20Sopenharmony_ci		A1  A2               A1   A2   A3         A1   A2   A3   A4
1458c2ecf20Sopenharmony_ci		A3  A4               A4   A5   A6         A5   A6   A7   A8
1468c2ecf20Sopenharmony_ci		A5  A6               A7   A8   A9         A9   A10  A11  A12
1478c2ecf20Sopenharmony_ci		..  ..               ..   ..   ..         ..   ..   ..   ..
1488c2ecf20Sopenharmony_ci		A2  A1               A3   A1   A2         A2   A1   A4   A3
1498c2ecf20Sopenharmony_ci		A4  A3               A6   A4   A5         A6   A5   A8   A7
1508c2ecf20Sopenharmony_ci		A6  A5               A9   A7   A8         A10  A9   A12  A11
1518c2ecf20Sopenharmony_ci		..  ..               ..   ..   ..         ..   ..   ..   ..
1528c2ecf20Sopenharmony_ci		========	     ============	  ===================
1538c2ecf20Sopenharmony_ci
1548c2ecf20Sopenharmony_ci		If 'raid10_copies 2' and 'raid10_format offset', then the
1558c2ecf20Sopenharmony_ci		layouts for 2, 3 and 4 devices are:
1568c2ecf20Sopenharmony_ci
1578c2ecf20Sopenharmony_ci		========       ==========         ================
1588c2ecf20Sopenharmony_ci		2 drives       3 drives           4 drives
1598c2ecf20Sopenharmony_ci		========       ==========         ================
1608c2ecf20Sopenharmony_ci		A1  A2         A1  A2  A3         A1  A2  A3  A4
1618c2ecf20Sopenharmony_ci		A2  A1         A3  A1  A2         A2  A1  A4  A3
1628c2ecf20Sopenharmony_ci		A3  A4         A4  A5  A6         A5  A6  A7  A8
1638c2ecf20Sopenharmony_ci		A4  A3         A6  A4  A5         A6  A5  A8  A7
1648c2ecf20Sopenharmony_ci		A5  A6         A7  A8  A9         A9  A10 A11 A12
1658c2ecf20Sopenharmony_ci		A6  A5         A9  A7  A8         A10 A9  A12 A11
1668c2ecf20Sopenharmony_ci		..  ..         ..  ..  ..         ..  ..  ..  ..
1678c2ecf20Sopenharmony_ci		========       ==========         ================
1688c2ecf20Sopenharmony_ci
1698c2ecf20Sopenharmony_ci		Here we see layouts closely akin to 'RAID1E - Integrated
1708c2ecf20Sopenharmony_ci		Offset Stripe Mirroring'.
1718c2ecf20Sopenharmony_ci
1728c2ecf20Sopenharmony_ci        [delta_disks <N>]
1738c2ecf20Sopenharmony_ci		The delta_disks option value (-251 < N < +251) triggers
1748c2ecf20Sopenharmony_ci		device removal (negative value) or device addition (positive
1758c2ecf20Sopenharmony_ci		value) to any reshape supporting raid levels 4/5/6 and 10.
1768c2ecf20Sopenharmony_ci		RAID levels 4/5/6 allow for addition of devices (metadata
1778c2ecf20Sopenharmony_ci		and data device tuple), raid10_near and raid10_offset only
1788c2ecf20Sopenharmony_ci		allow for device addition. raid10_far does not support any
1798c2ecf20Sopenharmony_ci		reshaping at all.
1808c2ecf20Sopenharmony_ci		A minimum of devices have to be kept to enforce resilience,
1818c2ecf20Sopenharmony_ci		which is 3 devices for raid4/5 and 4 devices for raid6.
1828c2ecf20Sopenharmony_ci
1838c2ecf20Sopenharmony_ci        [data_offset <sectors>]
1848c2ecf20Sopenharmony_ci		This option value defines the offset into each data device
1858c2ecf20Sopenharmony_ci		where the data starts. This is used to provide out-of-place
1868c2ecf20Sopenharmony_ci		reshaping space to avoid writing over data while
1878c2ecf20Sopenharmony_ci		changing the layout of stripes, hence an interruption/crash
1888c2ecf20Sopenharmony_ci		may happen at any time without the risk of losing data.
1898c2ecf20Sopenharmony_ci		E.g. when adding devices to an existing raid set during
1908c2ecf20Sopenharmony_ci		forward reshaping, the out-of-place space will be allocated
1918c2ecf20Sopenharmony_ci		at the beginning of each raid device. The kernel raid4/5/6/10
1928c2ecf20Sopenharmony_ci		MD personalities supporting such device addition will read the data from
1938c2ecf20Sopenharmony_ci		the existing first stripes (those with smaller number of stripes)
1948c2ecf20Sopenharmony_ci		starting at data_offset to fill up a new stripe with the larger
1958c2ecf20Sopenharmony_ci		number of stripes, calculate the redundancy blocks (CRC/Q-syndrome)
1968c2ecf20Sopenharmony_ci		and write that new stripe to offset 0. Same will be applied to all
1978c2ecf20Sopenharmony_ci		N-1 other new stripes. This out-of-place scheme is used to change
1988c2ecf20Sopenharmony_ci		the RAID type (i.e. the allocation algorithm) as well, e.g.
1998c2ecf20Sopenharmony_ci		changing from raid5_ls to raid5_n.
2008c2ecf20Sopenharmony_ci
2018c2ecf20Sopenharmony_ci	[journal_dev <dev>]
2028c2ecf20Sopenharmony_ci		This option adds a journal device to raid4/5/6 raid sets and
2038c2ecf20Sopenharmony_ci		uses it to close the 'write hole' caused by the non-atomic updates
2048c2ecf20Sopenharmony_ci		to the component devices which can cause data loss during recovery.
2058c2ecf20Sopenharmony_ci		The journal device is used as writethrough thus causing writes to
2068c2ecf20Sopenharmony_ci		be throttled versus non-journaled raid4/5/6 sets.
2078c2ecf20Sopenharmony_ci		Takeover/reshape is not possible with a raid4/5/6 journal device;
2088c2ecf20Sopenharmony_ci		it has to be deconfigured before requesting these.
2098c2ecf20Sopenharmony_ci
2108c2ecf20Sopenharmony_ci	[journal_mode <mode>]
2118c2ecf20Sopenharmony_ci		This option sets the caching mode on journaled raid4/5/6 raid sets
2128c2ecf20Sopenharmony_ci		(see 'journal_dev <dev>' above) to 'writethrough' or 'writeback'.
2138c2ecf20Sopenharmony_ci		If 'writeback' is selected the journal device has to be resilient
2148c2ecf20Sopenharmony_ci		and must not suffer from the 'write hole' problem itself (e.g. use
2158c2ecf20Sopenharmony_ci		raid1 or raid10) to avoid a single point of failure.
2168c2ecf20Sopenharmony_ci
2178c2ecf20Sopenharmony_ci<#raid_devs>: The number of devices composing the array.
2188c2ecf20Sopenharmony_ci	Each device consists of two entries.  The first is the device
2198c2ecf20Sopenharmony_ci	containing the metadata (if any); the second is the one containing the
2208c2ecf20Sopenharmony_ci	data. A Maximum of 64 metadata/data device entries are supported
2218c2ecf20Sopenharmony_ci	up to target version 1.8.0.
2228c2ecf20Sopenharmony_ci	1.9.0 supports up to 253 which is enforced by the used MD kernel runtime.
2238c2ecf20Sopenharmony_ci
2248c2ecf20Sopenharmony_ci	If a drive has failed or is missing at creation time, a '-' can be
2258c2ecf20Sopenharmony_ci	given for both the metadata and data drives for a given position.
2268c2ecf20Sopenharmony_ci
2278c2ecf20Sopenharmony_ci
2288c2ecf20Sopenharmony_ciExample Tables
2298c2ecf20Sopenharmony_ci--------------
2308c2ecf20Sopenharmony_ci
2318c2ecf20Sopenharmony_ci::
2328c2ecf20Sopenharmony_ci
2338c2ecf20Sopenharmony_ci  # RAID4 - 4 data drives, 1 parity (no metadata devices)
2348c2ecf20Sopenharmony_ci  # No metadata devices specified to hold superblock/bitmap info
2358c2ecf20Sopenharmony_ci  # Chunk size of 1MiB
2368c2ecf20Sopenharmony_ci  # (Lines separated for easy reading)
2378c2ecf20Sopenharmony_ci
2388c2ecf20Sopenharmony_ci  0 1960893648 raid \
2398c2ecf20Sopenharmony_ci          raid4 1 2048 \
2408c2ecf20Sopenharmony_ci          5 - 8:17 - 8:33 - 8:49 - 8:65 - 8:81
2418c2ecf20Sopenharmony_ci
2428c2ecf20Sopenharmony_ci  # RAID4 - 4 data drives, 1 parity (with metadata devices)
2438c2ecf20Sopenharmony_ci  # Chunk size of 1MiB, force RAID initialization,
2448c2ecf20Sopenharmony_ci  #       min recovery rate at 20 kiB/sec/disk
2458c2ecf20Sopenharmony_ci
2468c2ecf20Sopenharmony_ci  0 1960893648 raid \
2478c2ecf20Sopenharmony_ci          raid4 4 2048 sync min_recovery_rate 20 \
2488c2ecf20Sopenharmony_ci          5 8:17 8:18 8:33 8:34 8:49 8:50 8:65 8:66 8:81 8:82
2498c2ecf20Sopenharmony_ci
2508c2ecf20Sopenharmony_ci
2518c2ecf20Sopenharmony_ciStatus Output
2528c2ecf20Sopenharmony_ci-------------
2538c2ecf20Sopenharmony_ci'dmsetup table' displays the table used to construct the mapping.
2548c2ecf20Sopenharmony_ciThe optional parameters are always printed in the order listed
2558c2ecf20Sopenharmony_ciabove with "sync" or "nosync" always output ahead of the other
2568c2ecf20Sopenharmony_ciarguments, regardless of the order used when originally loading the table.
2578c2ecf20Sopenharmony_ciArguments that can be repeated are ordered by value.
2588c2ecf20Sopenharmony_ci
2598c2ecf20Sopenharmony_ci
2608c2ecf20Sopenharmony_ci'dmsetup status' yields information on the state and health of the array.
2618c2ecf20Sopenharmony_ciThe output is as follows (normally a single line, but expanded here for
2628c2ecf20Sopenharmony_ciclarity)::
2638c2ecf20Sopenharmony_ci
2648c2ecf20Sopenharmony_ci  1: <s> <l> raid \
2658c2ecf20Sopenharmony_ci  2:      <raid_type> <#devices> <health_chars> \
2668c2ecf20Sopenharmony_ci  3:      <sync_ratio> <sync_action> <mismatch_cnt>
2678c2ecf20Sopenharmony_ci
2688c2ecf20Sopenharmony_ciLine 1 is the standard output produced by device-mapper.
2698c2ecf20Sopenharmony_ci
2708c2ecf20Sopenharmony_ciLine 2 & 3 are produced by the raid target and are best explained by example::
2718c2ecf20Sopenharmony_ci
2728c2ecf20Sopenharmony_ci        0 1960893648 raid raid4 5 AAAAA 2/490221568 init 0
2738c2ecf20Sopenharmony_ci
2748c2ecf20Sopenharmony_ciHere we can see the RAID type is raid4, there are 5 devices - all of
2758c2ecf20Sopenharmony_ciwhich are 'A'live, and the array is 2/490221568 complete with its initial
2768c2ecf20Sopenharmony_cirecovery.  Here is a fuller description of the individual fields:
2778c2ecf20Sopenharmony_ci
2788c2ecf20Sopenharmony_ci	=============== =========================================================
2798c2ecf20Sopenharmony_ci	<raid_type>     Same as the <raid_type> used to create the array.
2808c2ecf20Sopenharmony_ci	<health_chars>  One char for each device, indicating:
2818c2ecf20Sopenharmony_ci
2828c2ecf20Sopenharmony_ci			- 'A' = alive and in-sync
2838c2ecf20Sopenharmony_ci			- 'a' = alive but not in-sync
2848c2ecf20Sopenharmony_ci			- 'D' = dead/failed.
2858c2ecf20Sopenharmony_ci	<sync_ratio>    The ratio indicating how much of the array has undergone
2868c2ecf20Sopenharmony_ci			the process described by 'sync_action'.  If the
2878c2ecf20Sopenharmony_ci			'sync_action' is "check" or "repair", then the process
2888c2ecf20Sopenharmony_ci			of "resync" or "recover" can be considered complete.
2898c2ecf20Sopenharmony_ci	<sync_action>   One of the following possible states:
2908c2ecf20Sopenharmony_ci
2918c2ecf20Sopenharmony_ci			idle
2928c2ecf20Sopenharmony_ci				- No synchronization action is being performed.
2938c2ecf20Sopenharmony_ci			frozen
2948c2ecf20Sopenharmony_ci				- The current action has been halted.
2958c2ecf20Sopenharmony_ci			resync
2968c2ecf20Sopenharmony_ci				- Array is undergoing its initial synchronization
2978c2ecf20Sopenharmony_ci				  or is resynchronizing after an unclean shutdown
2988c2ecf20Sopenharmony_ci				  (possibly aided by a bitmap).
2998c2ecf20Sopenharmony_ci			recover
3008c2ecf20Sopenharmony_ci				- A device in the array is being rebuilt or
3018c2ecf20Sopenharmony_ci				  replaced.
3028c2ecf20Sopenharmony_ci			check
3038c2ecf20Sopenharmony_ci				- A user-initiated full check of the array is
3048c2ecf20Sopenharmony_ci				  being performed.  All blocks are read and
3058c2ecf20Sopenharmony_ci				  checked for consistency.  The number of
3068c2ecf20Sopenharmony_ci				  discrepancies found are recorded in
3078c2ecf20Sopenharmony_ci				  <mismatch_cnt>.  No changes are made to the
3088c2ecf20Sopenharmony_ci				  array by this action.
3098c2ecf20Sopenharmony_ci			repair
3108c2ecf20Sopenharmony_ci				- The same as "check", but discrepancies are
3118c2ecf20Sopenharmony_ci				  corrected.
3128c2ecf20Sopenharmony_ci			reshape
3138c2ecf20Sopenharmony_ci				- The array is undergoing a reshape.
3148c2ecf20Sopenharmony_ci	<mismatch_cnt>  The number of discrepancies found between mirror copies
3158c2ecf20Sopenharmony_ci			in RAID1/10 or wrong parity values found in RAID4/5/6.
3168c2ecf20Sopenharmony_ci			This value is valid only after a "check" of the array
3178c2ecf20Sopenharmony_ci			is performed.  A healthy array has a 'mismatch_cnt' of 0.
3188c2ecf20Sopenharmony_ci	<data_offset>   The current data offset to the start of the user data on
3198c2ecf20Sopenharmony_ci			each component device of a raid set (see the respective
3208c2ecf20Sopenharmony_ci			raid parameter to support out-of-place reshaping).
3218c2ecf20Sopenharmony_ci	<journal_char>	- 'A' - active write-through journal device.
3228c2ecf20Sopenharmony_ci			- 'a' - active write-back journal device.
3238c2ecf20Sopenharmony_ci			- 'D' - dead journal device.
3248c2ecf20Sopenharmony_ci			- '-' - no journal device.
3258c2ecf20Sopenharmony_ci	=============== =========================================================
3268c2ecf20Sopenharmony_ci
3278c2ecf20Sopenharmony_ci
3288c2ecf20Sopenharmony_ciMessage Interface
3298c2ecf20Sopenharmony_ci-----------------
3308c2ecf20Sopenharmony_ciThe dm-raid target will accept certain actions through the 'message' interface.
3318c2ecf20Sopenharmony_ci('man dmsetup' for more information on the message interface.)  These actions
3328c2ecf20Sopenharmony_ciinclude:
3338c2ecf20Sopenharmony_ci
3348c2ecf20Sopenharmony_ci	========= ================================================
3358c2ecf20Sopenharmony_ci	"idle"    Halt the current sync action.
3368c2ecf20Sopenharmony_ci	"frozen"  Freeze the current sync action.
3378c2ecf20Sopenharmony_ci	"resync"  Initiate/continue a resync.
3388c2ecf20Sopenharmony_ci	"recover" Initiate/continue a recover process.
3398c2ecf20Sopenharmony_ci	"check"   Initiate a check (i.e. a "scrub") of the array.
3408c2ecf20Sopenharmony_ci	"repair"  Initiate a repair of the array.
3418c2ecf20Sopenharmony_ci	========= ================================================
3428c2ecf20Sopenharmony_ci
3438c2ecf20Sopenharmony_ci
3448c2ecf20Sopenharmony_ciDiscard Support
3458c2ecf20Sopenharmony_ci---------------
3468c2ecf20Sopenharmony_ciThe implementation of discard support among hardware vendors varies.
3478c2ecf20Sopenharmony_ciWhen a block is discarded, some storage devices will return zeroes when
3488c2ecf20Sopenharmony_cithe block is read.  These devices set the 'discard_zeroes_data'
3498c2ecf20Sopenharmony_ciattribute.  Other devices will return random data.  Confusingly, some
3508c2ecf20Sopenharmony_cidevices that advertise 'discard_zeroes_data' will not reliably return
3518c2ecf20Sopenharmony_cizeroes when discarded blocks are read!  Since RAID 4/5/6 uses blocks
3528c2ecf20Sopenharmony_cifrom a number of devices to calculate parity blocks and (for performance
3538c2ecf20Sopenharmony_cireasons) relies on 'discard_zeroes_data' being reliable, it is important
3548c2ecf20Sopenharmony_cithat the devices be consistent.  Blocks may be discarded in the middle
3558c2ecf20Sopenharmony_ciof a RAID 4/5/6 stripe and if subsequent read results are not
3568c2ecf20Sopenharmony_ciconsistent, the parity blocks may be calculated differently at any time;
3578c2ecf20Sopenharmony_cimaking the parity blocks useless for redundancy.  It is important to
3588c2ecf20Sopenharmony_ciunderstand how your hardware behaves with discards if you are going to
3598c2ecf20Sopenharmony_cienable discards with RAID 4/5/6.
3608c2ecf20Sopenharmony_ci
3618c2ecf20Sopenharmony_ciSince the behavior of storage devices is unreliable in this respect,
3628c2ecf20Sopenharmony_cieven when reporting 'discard_zeroes_data', by default RAID 4/5/6
3638c2ecf20Sopenharmony_cidiscard support is disabled -- this ensures data integrity at the
3648c2ecf20Sopenharmony_ciexpense of losing some performance.
3658c2ecf20Sopenharmony_ci
3668c2ecf20Sopenharmony_ciStorage devices that properly support 'discard_zeroes_data' are
3678c2ecf20Sopenharmony_ciincreasingly whitelisted in the kernel and can thus be trusted.
3688c2ecf20Sopenharmony_ci
3698c2ecf20Sopenharmony_ciFor trusted devices, the following dm-raid module parameter can be set
3708c2ecf20Sopenharmony_cito safely enable discard support for RAID 4/5/6:
3718c2ecf20Sopenharmony_ci
3728c2ecf20Sopenharmony_ci    'devices_handle_discards_safely'
3738c2ecf20Sopenharmony_ci
3748c2ecf20Sopenharmony_ci
3758c2ecf20Sopenharmony_ciVersion History
3768c2ecf20Sopenharmony_ci---------------
3778c2ecf20Sopenharmony_ci
3788c2ecf20Sopenharmony_ci::
3798c2ecf20Sopenharmony_ci
3808c2ecf20Sopenharmony_ci 1.0.0	Initial version.  Support for RAID 4/5/6
3818c2ecf20Sopenharmony_ci 1.1.0	Added support for RAID 1
3828c2ecf20Sopenharmony_ci 1.2.0	Handle creation of arrays that contain failed devices.
3838c2ecf20Sopenharmony_ci 1.3.0	Added support for RAID 10
3848c2ecf20Sopenharmony_ci 1.3.1	Allow device replacement/rebuild for RAID 10
3858c2ecf20Sopenharmony_ci 1.3.2	Fix/improve redundancy checking for RAID10
3868c2ecf20Sopenharmony_ci 1.4.0	Non-functional change.  Removes arg from mapping function.
3878c2ecf20Sopenharmony_ci 1.4.1	RAID10 fix redundancy validation checks (commit 55ebbb5).
3888c2ecf20Sopenharmony_ci 1.4.2	Add RAID10 "far" and "offset" algorithm support.
3898c2ecf20Sopenharmony_ci 1.5.0	Add message interface to allow manipulation of the sync_action.
3908c2ecf20Sopenharmony_ci	New status (STATUSTYPE_INFO) fields: sync_action and mismatch_cnt.
3918c2ecf20Sopenharmony_ci 1.5.1	Add ability to restore transiently failed devices on resume.
3928c2ecf20Sopenharmony_ci 1.5.2	'mismatch_cnt' is zero unless [last_]sync_action is "check".
3938c2ecf20Sopenharmony_ci 1.6.0	Add discard support (and devices_handle_discard_safely module param).
3948c2ecf20Sopenharmony_ci 1.7.0	Add support for MD RAID0 mappings.
3958c2ecf20Sopenharmony_ci 1.8.0	Explicitly check for compatible flags in the superblock metadata
3968c2ecf20Sopenharmony_ci	and reject to start the raid set if any are set by a newer
3978c2ecf20Sopenharmony_ci	target version, thus avoiding data corruption on a raid set
3988c2ecf20Sopenharmony_ci	with a reshape in progress.
3998c2ecf20Sopenharmony_ci 1.9.0	Add support for RAID level takeover/reshape/region size
4008c2ecf20Sopenharmony_ci	and set size reduction.
4018c2ecf20Sopenharmony_ci 1.9.1	Fix activation of existing RAID 4/10 mapped devices
4028c2ecf20Sopenharmony_ci 1.9.2	Don't emit '- -' on the status table line in case the constructor
4038c2ecf20Sopenharmony_ci	fails reading a superblock. Correctly emit 'maj:min1 maj:min2' and
4048c2ecf20Sopenharmony_ci	'D' on the status line.  If '- -' is passed into the constructor, emit
4058c2ecf20Sopenharmony_ci	'- -' on the table line and '-' as the status line health character.
4068c2ecf20Sopenharmony_ci 1.10.0	Add support for raid4/5/6 journal device
4078c2ecf20Sopenharmony_ci 1.10.1	Fix data corruption on reshape request
4088c2ecf20Sopenharmony_ci 1.11.0	Fix table line argument order
4098c2ecf20Sopenharmony_ci	(wrong raid10_copies/raid10_format sequence)
4108c2ecf20Sopenharmony_ci 1.11.1	Add raid4/5/6 journal write-back support via journal_mode option
4118c2ecf20Sopenharmony_ci 1.12.1	Fix for MD deadlock between mddev_suspend() and md_write_start() available
4128c2ecf20Sopenharmony_ci 1.13.0	Fix dev_health status at end of "recover" (was 'a', now 'A')
4138c2ecf20Sopenharmony_ci 1.13.1	Fix deadlock caused by early md_stop_writes().  Also fix size an
4148c2ecf20Sopenharmony_ci	state races.
4158c2ecf20Sopenharmony_ci 1.13.2	Fix raid redundancy validation and avoid keeping raid set frozen
4168c2ecf20Sopenharmony_ci 1.14.0	Fix reshape race on small devices.  Fix stripe adding reshape
4178c2ecf20Sopenharmony_ci	deadlock/potential data corruption.  Update superblock when
4188c2ecf20Sopenharmony_ci	specific devices are requested via rebuild.  Fix RAID leg
4198c2ecf20Sopenharmony_ci	rebuild errors.
4208c2ecf20Sopenharmony_ci 1.15.0 Fix size extensions not being synchronized in case of new MD bitmap
4218c2ecf20Sopenharmony_ci        pages allocated;  also fix those not occuring after previous reductions
4228c2ecf20Sopenharmony_ci 1.15.1 Fix argument count and arguments for rebuild/write_mostly/journal_(dev|mode)
4238c2ecf20Sopenharmony_ci        on the status line.
424