~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux-2.6.17/Documentation/device-mapper/striped.txt

Version: ~ [ 2.6.16 ] ~ [ 2.6.17 ] ~
Architecture: ~ [ ia64 ] ~ [ i386 ] ~ [ arm ] ~ [ ppc ] ~ [ sparc64 ] ~

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

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.