| Jonathan Brassow | c0a2fa1 | 2011-08-02 12:32:06 +0100 | [diff] [blame] | 1 | dm-raid | 
|  | 2 | ------- | 
| NeilBrown | 9d09e66 | 2011-01-13 20:00:02 +0000 | [diff] [blame] | 3 |  | 
| Jonathan Brassow | c0a2fa1 | 2011-08-02 12:32:06 +0100 | [diff] [blame] | 4 | The device-mapper RAID (dm-raid) target provides a bridge from DM to MD. | 
|  | 5 | It allows the MD RAID drivers to be accessed using a device-mapper | 
|  | 6 | interface. | 
| NeilBrown | 9d09e66 | 2011-01-13 20:00:02 +0000 | [diff] [blame] | 7 |  | 
| Jonathan Brassow | c0a2fa1 | 2011-08-02 12:32:06 +0100 | [diff] [blame] | 8 | The target is named "raid" and it accepts the following parameters: | 
| NeilBrown | 9d09e66 | 2011-01-13 20:00:02 +0000 | [diff] [blame] | 9 |  | 
| Jonathan Brassow | c0a2fa1 | 2011-08-02 12:32:06 +0100 | [diff] [blame] | 10 | <raid_type> <#raid_params> <raid_params> \ | 
|  | 11 | <#raid_devs> <metadata_dev0> <dev0> [.. <metadata_devN> <devN>] | 
| NeilBrown | 9d09e66 | 2011-01-13 20:00:02 +0000 | [diff] [blame] | 12 |  | 
| Jonathan Brassow | c0a2fa1 | 2011-08-02 12:32:06 +0100 | [diff] [blame] | 13 | <raid_type>: | 
| Jonathan Brassow | b12d437 | 2011-08-02 12:32:07 +0100 | [diff] [blame] | 14 | raid1		RAID1 mirroring | 
| Jonathan Brassow | c0a2fa1 | 2011-08-02 12:32:06 +0100 | [diff] [blame] | 15 | raid4		RAID4 dedicated parity disk | 
|  | 16 | raid5_la	RAID5 left asymmetric | 
|  | 17 | - rotating parity 0 with data continuation | 
|  | 18 | raid5_ra	RAID5 right asymmetric | 
|  | 19 | - rotating parity N with data continuation | 
|  | 20 | raid5_ls	RAID5 left symmetric | 
|  | 21 | - rotating parity 0 with data restart | 
|  | 22 | raid5_rs 	RAID5 right symmetric | 
|  | 23 | - rotating parity N with data restart | 
|  | 24 | raid6_zr	RAID6 zero restart | 
|  | 25 | - rotating parity zero (left-to-right) with data restart | 
|  | 26 | raid6_nr	RAID6 N restart | 
|  | 27 | - rotating parity N (right-to-left) with data restart | 
|  | 28 | raid6_nc	RAID6 N continue | 
|  | 29 | - rotating parity N (right-to-left) with data continuation | 
| NeilBrown | 9d09e66 | 2011-01-13 20:00:02 +0000 | [diff] [blame] | 30 |  | 
| Masanari Iida | 40e4712 | 2012-03-04 23:16:11 +0900 | [diff] [blame] | 31 | Reference: Chapter 4 of | 
| Jonathan Brassow | c0a2fa1 | 2011-08-02 12:32:06 +0100 | [diff] [blame] | 32 | http://www.snia.org/sites/default/files/SNIA_DDF_Technical_Position_v2.0.pdf | 
| NeilBrown | 9d09e66 | 2011-01-13 20:00:02 +0000 | [diff] [blame] | 33 |  | 
| Jonathan Brassow | c0a2fa1 | 2011-08-02 12:32:06 +0100 | [diff] [blame] | 34 | <#raid_params>: The number of parameters that follow. | 
| NeilBrown | 9d09e66 | 2011-01-13 20:00:02 +0000 | [diff] [blame] | 35 |  | 
| Jonathan Brassow | c0a2fa1 | 2011-08-02 12:32:06 +0100 | [diff] [blame] | 36 | <raid_params> consists of | 
|  | 37 | Mandatory parameters: | 
|  | 38 | <chunk_size>: Chunk size in sectors.  This parameter is often known as | 
|  | 39 | "stripe size".  It is the only mandatory parameter and | 
|  | 40 | is placed first. | 
|  | 41 |  | 
|  | 42 | followed by optional parameters (in any order): | 
|  | 43 | [sync|nosync]   Force or prevent RAID initialization. | 
|  | 44 |  | 
|  | 45 | [rebuild <idx>]	Rebuild drive number idx (first drive is 0). | 
|  | 46 |  | 
|  | 47 | [daemon_sleep <ms>] | 
|  | 48 | Interval between runs of the bitmap daemon that | 
|  | 49 | clear bits.  A longer interval means less bitmap I/O but | 
|  | 50 | resyncing after a failure is likely to take longer. | 
|  | 51 |  | 
|  | 52 | [min_recovery_rate <kB/sec/disk>]  Throttle RAID initialization | 
|  | 53 | [max_recovery_rate <kB/sec/disk>]  Throttle RAID initialization | 
| Jonathan Brassow | 46bed2b | 2011-08-02 12:32:07 +0100 | [diff] [blame] | 54 | [write_mostly <idx>]		   Drive index is write-mostly | 
| Jonathan Brassow | c0a2fa1 | 2011-08-02 12:32:06 +0100 | [diff] [blame] | 55 | [max_write_behind <sectors>]       See '-write-behind=' (man mdadm) | 
|  | 56 | [stripe_cache <sectors>]           Stripe cache size (higher RAIDs only) | 
| Jonathan Brassow | c108456 | 2011-08-02 12:32:07 +0100 | [diff] [blame] | 57 | [region_size <sectors>] | 
|  | 58 | The region_size multiplied by the number of regions is the | 
|  | 59 | logical size of the array.  The bitmap records the device | 
|  | 60 | synchronisation state for each region. | 
| Jonathan Brassow | c0a2fa1 | 2011-08-02 12:32:06 +0100 | [diff] [blame] | 61 |  | 
|  | 62 | <#raid_devs>: The number of devices composing the array. | 
|  | 63 | Each device consists of two entries.  The first is the device | 
|  | 64 | containing the metadata (if any); the second is the one containing the | 
| Jonathan Brassow | b12d437 | 2011-08-02 12:32:07 +0100 | [diff] [blame] | 65 | data. | 
| Jonathan Brassow | c0a2fa1 | 2011-08-02 12:32:06 +0100 | [diff] [blame] | 66 |  | 
|  | 67 | If a drive has failed or is missing at creation time, a '-' can be | 
|  | 68 | given for both the metadata and data drives for a given position. | 
|  | 69 |  | 
|  | 70 |  | 
|  | 71 | Example tables | 
|  | 72 | -------------- | 
| Jonathan Brassow | b12d437 | 2011-08-02 12:32:07 +0100 | [diff] [blame] | 73 | # RAID4 - 4 data drives, 1 parity (no metadata devices) | 
| NeilBrown | 9d09e66 | 2011-01-13 20:00:02 +0000 | [diff] [blame] | 74 | # No metadata devices specified to hold superblock/bitmap info | 
|  | 75 | # Chunk size of 1MiB | 
|  | 76 | # (Lines separated for easy reading) | 
| Jonathan Brassow | c0a2fa1 | 2011-08-02 12:32:06 +0100 | [diff] [blame] | 77 |  | 
| NeilBrown | 9d09e66 | 2011-01-13 20:00:02 +0000 | [diff] [blame] | 78 | 0 1960893648 raid \ | 
|  | 79 | raid4 1 2048 \ | 
|  | 80 | 5 - 8:17 - 8:33 - 8:49 - 8:65 - 8:81 | 
|  | 81 |  | 
| Jonathan Brassow | b12d437 | 2011-08-02 12:32:07 +0100 | [diff] [blame] | 82 | # RAID4 - 4 data drives, 1 parity (with metadata devices) | 
| NeilBrown | 9d09e66 | 2011-01-13 20:00:02 +0000 | [diff] [blame] | 83 | # Chunk size of 1MiB, force RAID initialization, | 
|  | 84 | #       min recovery rate at 20 kiB/sec/disk | 
| Jonathan Brassow | c0a2fa1 | 2011-08-02 12:32:06 +0100 | [diff] [blame] | 85 |  | 
| NeilBrown | 9d09e66 | 2011-01-13 20:00:02 +0000 | [diff] [blame] | 86 | 0 1960893648 raid \ | 
| Jonathan Brassow | b12d437 | 2011-08-02 12:32:07 +0100 | [diff] [blame] | 87 | raid4 4 2048 sync min_recovery_rate 20 \ | 
|  | 88 | 5 8:17 8:18 8:33 8:34 8:49 8:50 8:65 8:66 8:81 8:82 | 
| NeilBrown | 9d09e66 | 2011-01-13 20:00:02 +0000 | [diff] [blame] | 89 |  | 
| Jonathan Brassow | c0a2fa1 | 2011-08-02 12:32:06 +0100 | [diff] [blame] | 90 | 'dmsetup table' displays the table used to construct the mapping. | 
| Jonathan Brassow | 46bed2b | 2011-08-02 12:32:07 +0100 | [diff] [blame] | 91 | The optional parameters are always printed in the order listed | 
| Jonathan Brassow | c0a2fa1 | 2011-08-02 12:32:06 +0100 | [diff] [blame] | 92 | above with "sync" or "nosync" always output ahead of the other | 
|  | 93 | arguments, regardless of the order used when originally loading the table. | 
| Jonathan Brassow | 46bed2b | 2011-08-02 12:32:07 +0100 | [diff] [blame] | 94 | Arguments that can be repeated are ordered by value. | 
| NeilBrown | 9d09e66 | 2011-01-13 20:00:02 +0000 | [diff] [blame] | 95 |  | 
| Jonathan Brassow | c0a2fa1 | 2011-08-02 12:32:06 +0100 | [diff] [blame] | 96 | 'dmsetup status' yields information on the state and health of the | 
|  | 97 | array. | 
|  | 98 | The output is as follows: | 
| NeilBrown | 9d09e66 | 2011-01-13 20:00:02 +0000 | [diff] [blame] | 99 | 1: <s> <l> raid \ | 
|  | 100 | 2:      <raid_type> <#devices> <1 health char for each dev> <resync_ratio> | 
|  | 101 |  | 
| Jonathan Brassow | c0a2fa1 | 2011-08-02 12:32:06 +0100 | [diff] [blame] | 102 | Line 1 is the standard output produced by device-mapper. | 
|  | 103 | Line 2 is produced by the raid target, and best explained by example: | 
| NeilBrown | 9d09e66 | 2011-01-13 20:00:02 +0000 | [diff] [blame] | 104 | 0 1960893648 raid raid4 5 AAAAA 2/490221568 | 
|  | 105 | Here we can see the RAID type is raid4, there are 5 devices - all of | 
|  | 106 | which are 'A'live, and the array is 2/490221568 complete with recovery. | 
| Jonathan Brassow | c0a2fa1 | 2011-08-02 12:32:06 +0100 | [diff] [blame] | 107 | Faulty or missing devices are marked 'D'.  Devices that are out-of-sync | 
|  | 108 | are marked 'a'. |