1dm-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 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 18One or more underlying devices can be specified. The striped device size must 19be a multiple of the chunk size multiplied by the number of underlying devices. 20 21 22Example 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 30my $chunk_size = 128 * 2; 31my $dev_name = "stripe_dev"; 32my $num_devs = @ARGV; 33my @devs = @ARGV; 34my ($min_dev_size, $stripe_dev_size, $i); 35 36if (!$num_devs) { 37 die("Specify at least one device\n"); 38} 39 40$min_dev_size = `blockdev --getsize $devs[0]`; 41for ($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; 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"; 51for ($i = 0; $i < $num_devs; $i++) { 52 $table .= " $devs[$i] 0"; 53} 54 55`echo $table | dmsetup create $dev_name`; 56]] 57 58