dm-raid.txt 5.3 KB
Newer Older
1 2
dm-raid
-------
N
NeilBrown 已提交
3

4 5 6
The device-mapper RAID (dm-raid) target provides a bridge from DM to MD.
It allows the MD RAID drivers to be accessed using a device-mapper
interface.
N
NeilBrown 已提交
7

8 9 10 11 12 13
The target is named "raid" and it accepts the following parameters:

  <raid_type> <#raid_params> <raid_params> \
    <#raid_devs> <metadata_dev0> <dev0> [.. <metadata_devN> <devN>]

<raid_type>:
14
  raid1		RAID1 mirroring
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
  raid4		RAID4 dedicated parity disk
  raid5_la	RAID5 left asymmetric
		- rotating parity 0 with data continuation
  raid5_ra	RAID5 right asymmetric
		- rotating parity N with data continuation
  raid5_ls	RAID5 left symmetric
		- rotating parity 0 with data restart
  raid5_rs 	RAID5 right symmetric
		- rotating parity N with data restart
  raid6_zr	RAID6 zero restart
		- rotating parity zero (left-to-right) with data restart
  raid6_nr	RAID6 N restart
		- rotating parity N (right-to-left) with data restart
  raid6_nc	RAID6 N continue
		- rotating parity N (right-to-left) with data continuation
30 31 32 33
  raid10        Various RAID10 inspired algorithms chosen by additional params
		- RAID10: Striped Mirrors (aka 'Striping on top of mirrors')
		- RAID1E: Integrated Adjacent Stripe Mirroring
		-  and other similar RAID10 variants
34

35
  Reference: Chapter 4 of
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
  http://www.snia.org/sites/default/files/SNIA_DDF_Technical_Position_v2.0.pdf

<#raid_params>: The number of parameters that follow.

<raid_params> consists of
    Mandatory parameters:
        <chunk_size>: Chunk size in sectors.  This parameter is often known as
		      "stripe size".  It is the only mandatory parameter and
		      is placed first.

    followed by optional parameters (in any order):
	[sync|nosync]   Force or prevent RAID initialization.

	[rebuild <idx>]	Rebuild drive number idx (first drive is 0).

	[daemon_sleep <ms>]
		Interval between runs of the bitmap daemon that
		clear bits.  A longer interval means less bitmap I/O but
		resyncing after a failure is likely to take longer.

	[min_recovery_rate <kB/sec/disk>]  Throttle RAID initialization
	[max_recovery_rate <kB/sec/disk>]  Throttle RAID initialization
58
	[write_mostly <idx>]		   Drive index is write-mostly
59 60
	[max_write_behind <sectors>]       See '-write-behind=' (man mdadm)
	[stripe_cache <sectors>]           Stripe cache size (higher RAIDs only)
61 62 63 64
	[region_size <sectors>]
		The region_size multiplied by the number of regions is the
		logical size of the array.  The bitmap records the device
		synchronisation state for each region.
65

66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
        [raid10_copies   <# copies>]
        [raid10_format   near]
		These two options are used to alter the default layout of
		a RAID10 configuration.  The number of copies is can be
		specified, but the default is 2.  There are other variations
		to how the copies are laid down - the default and only current
		option is "near".  Near copies are what most people think of
		with respect to mirroring.  If these options are left
		unspecified, or 'raid10_copies 2' and/or 'raid10_format near'
		are given, then the layouts for 2, 3 and 4 devices are:
		2 drives         3 drives          4 drives
		--------         ----------        --------------
		A1  A1           A1  A1  A2        A1  A1  A2  A2
		A2  A2           A2  A3  A3        A3  A3  A4  A4
		A3  A3           A4  A4  A5        A5  A5  A6  A6
		A4  A4           A5  A6  A6        A7  A7  A8  A8
		..  ..           ..  ..  ..        ..  ..  ..  ..
		The 2-device layout is equivalent 2-way RAID1.  The 4-device
		layout is what a traditional RAID10 would look like.  The
		3-device layout is what might be called a 'RAID1E - Integrated
		Adjacent Stripe Mirroring'.

88 89 90
<#raid_devs>: The number of devices composing the array.
	Each device consists of two entries.  The first is the device
	containing the metadata (if any); the second is the one containing the
91
	data.
92 93 94 95 96 97 98

	If a drive has failed or is missing at creation time, a '-' can be
	given for both the metadata and data drives for a given position.


Example tables
--------------
99
# RAID4 - 4 data drives, 1 parity (no metadata devices)
N
NeilBrown 已提交
100 101 102
# No metadata devices specified to hold superblock/bitmap info
# Chunk size of 1MiB
# (Lines separated for easy reading)
103

N
NeilBrown 已提交
104 105 106 107
0 1960893648 raid \
        raid4 1 2048 \
        5 - 8:17 - 8:33 - 8:49 - 8:65 - 8:81

108
# RAID4 - 4 data drives, 1 parity (with metadata devices)
N
NeilBrown 已提交
109 110
# Chunk size of 1MiB, force RAID initialization,
#       min recovery rate at 20 kiB/sec/disk
111

N
NeilBrown 已提交
112
0 1960893648 raid \
113 114
        raid4 4 2048 sync min_recovery_rate 20 \
        5 8:17 8:18 8:33 8:34 8:49 8:50 8:65 8:66 8:81 8:82
N
NeilBrown 已提交
115

116
'dmsetup table' displays the table used to construct the mapping.
117
The optional parameters are always printed in the order listed
118 119
above with "sync" or "nosync" always output ahead of the other
arguments, regardless of the order used when originally loading the table.
120
Arguments that can be repeated are ordered by value.
N
NeilBrown 已提交
121

122 123 124
'dmsetup status' yields information on the state and health of the
array.
The output is as follows:
N
NeilBrown 已提交
125 126 127
1: <s> <l> raid \
2:      <raid_type> <#devices> <1 health char for each dev> <resync_ratio>

128 129
Line 1 is the standard output produced by device-mapper.
Line 2 is produced by the raid target, and best explained by example:
N
NeilBrown 已提交
130 131 132
        0 1960893648 raid raid4 5 AAAAA 2/490221568
Here we can see the RAID type is raid4, there are 5 devices - all of
which are 'A'live, and the array is 2/490221568 complete with recovery.
133 134
Faulty or missing devices are marked 'D'.  Devices that are out-of-sync
are marked 'a'.