About Kernel Documentation Linux Kernel Contact Linux Resources Linux Blog

Documentation / device-mapper / striped.txt


Based on kernel version 4.16.1. Page generated on 2018-04-09 11:52 EST.

1	dm-stripe
2	=========
3	
4	Device-Mapper's "striped" target is used to create a striped (i.e. RAID-0)
5	device across one or more underlying devices. Data is written in "chunks",
6	with consecutive chunks rotating among the underlying devices. This can
7	potentially provide improved I/O throughput by utilizing several physical
8	devices in parallel.
9	
10	Parameters: <num devs> <chunk size> [<dev path> <offset>]+
11	    <num devs>: Number of underlying devices.
12	    <chunk size>: Size of each chunk of data. Must be at least as
13	                  large as the system's PAGE_SIZE.
14	    <dev path>: Full pathname to the underlying block-device, or a
15	                "major:minor" device-number.
16	    <offset>: Starting sector within the device.
17	
18	One or more underlying devices can be specified. The striped device size must
19	be a multiple of the chunk size multiplied by the number of underlying devices.
20	
21	
22	Example scripts
23	===============
24	
25	[[
26	#!/usr/bin/perl -w
27	# Create a striped device across any number of underlying devices. The device
28	# will be called "stripe_dev" and have a chunk-size of 128k.
29	
30	my $chunk_size = 128 * 2;
31	my $dev_name = "stripe_dev";
32	my $num_devs = @ARGV;
33	my @devs = @ARGV;
34	my ($min_dev_size, $stripe_dev_size, $i);
35	
36	if (!$num_devs) {
37	        die("Specify at least one device\n");
38	}
39	
40	$min_dev_size = `blockdev --getsz $devs[0]`;
41	for ($i = 1; $i < $num_devs; $i++) {
42	        my $this_size = `blockdev --getsz $devs[$i]`;
43	        $min_dev_size = ($min_dev_size < $this_size) ?
44	                        $min_dev_size : $this_size;
45	}
46	
47	$stripe_dev_size = $min_dev_size * $num_devs;
48	$stripe_dev_size -= $stripe_dev_size % ($chunk_size * $num_devs);
49	
50	$table = "0 $stripe_dev_size striped $num_devs $chunk_size";
51	for ($i = 0; $i < $num_devs; $i++) {
52	        $table .= " $devs[$i] 0";
53	}
54	
55	`echo $table | dmsetup create $dev_name`;
56	]]
Hide Line Numbers


About Kernel Documentation Linux Kernel Contact Linux Resources Linux Blog