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
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.
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.
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.
30 my $chunk_size = 128 * 2;
31 my $dev_name = "stripe_dev";
34 my ($min_dev_size, $stripe_dev_size, $i);
37 die("Specify at least one device\n");
40 $min_dev_size = `blockdev --getsize $devs[0]`;
41 for ($i = 1; $i < $num_devs; $i++) {
42 my $this_size = `blockdev --getsize $devs[$i]`;
43 $min_dev_size = ($min_dev_size < $this_size) ?
44 $min_dev_size : $this_size;
47 $stripe_dev_size = $min_dev_size * $num_devs;
48 $stripe_dev_size -= $stripe_dev_size % ($chunk_size * $num_devs);
50 $table = "0 $stripe_dev_size striped $num_devs $chunk_size";
51 for ($i = 0; $i < $num_devs; $i++) {
52 $table .= " $devs[$i] 0";
55 `echo $table | dmsetup create $dev_name`;