blob: f34d3236b9da838e0a3e81516e135b914f5577ee [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001dm-stripe
2=========
3
4Device-Mapper's "striped" target is used to create a striped (i.e. RAID-0)
5device across one or more underlying devices. Data is written in "chunks",
6with consecutive chunks rotating among the underlying devices. This can
7potentially provide improved I/O throughput by utilizing several physical
8devices in parallel.
9
10Parameters: <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 a power-of-2 and at
13 least as 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
18One or more underlying devices can be specified. The striped device size must
19be a multiple of the chunk size and a multiple of the number of underlying
20devices.
21
22
23Example scripts
24===============
25
26[[
27#!/usr/bin/perl -w
28# Create a striped device across any number of underlying devices. The device
29# will be called "stripe_dev" and have a chunk-size of 128k.
30
31my $chunk_size = 128 * 2;
32my $dev_name = "stripe_dev";
33my $num_devs = @ARGV;
34my @devs = @ARGV;
35my ($min_dev_size, $stripe_dev_size, $i);
36
37if (!$num_devs) {
38 die("Specify at least one device\n");
39}
40
41$min_dev_size = `blockdev --getsize $devs[0]`;
42for ($i = 1; $i < $num_devs; $i++) {
43 my $this_size = `blockdev --getsize $devs[$i]`;
44 $min_dev_size = ($min_dev_size < $this_size) ?
45 $min_dev_size : $this_size;
46}
47
48$stripe_dev_size = $min_dev_size * $num_devs;
49$stripe_dev_size -= $stripe_dev_size % ($chunk_size * $num_devs);
50
51$table = "0 $stripe_dev_size striped $num_devs $chunk_size";
52for ($i = 0; $i < $num_devs; $i++) {
53 $table .= " $devs[$i] 0";
54}
55
56`echo $table | dmsetup create $dev_name`;
57]]
58