"SfR Fresh" - the SfR Freeware/Shareware Archive

Member "mapscsi-0.0.11/README.html" of archive mapscsi-0.0.11.tar.gz:


    <link rel='stylesheet' type='text/css' href='/site.css'>
    <h2>mapscsi - Linux SCSI device mapping tool</h2>
    <p>Latest version: <a href="mapscsi-0.0.11.tar.gz">mapscsi-0.0.11.tar.gz</a></p>
    <p>Problem: Currently SCSI devices names are allocated in the order of probing.
      If an additional device is added and has a lower host, channel or id
      than existing devices, these other devices will all be shuffled along on
      the next reboot ie. /dev/sdb becomes /dev/sdc, etc. Causing much mayhem with
      fstab et al.</p>
    <p>mapscsi is a small utility that creates a consistent mapping to Linux
      scsi devices. mapscsi achieves this by creating symbolic links to linux
      scsi disk devices after scanning all scsi disk devices, finding out their
      host, channel, id, lun, pci location (if available), Fibre Channel world
      wide node and port names, loop and port ids (with qla2x00 v4.46.5 driver)
      vendor, product and serial number details and using this information plus
      a mapping rules file containing device templates to dynamically create
      link names.</p>
    <p>mapscsi is a simple alternative to devfs and provides the added ability
      of including drive information such as vendor / product details and serial
      numbers in in device link names.</p>
    <p>It is intended to be run at boot time after device probing. There is still
      no guarantee these mappings are correct if devices have been hotplugged. It
      would be advisable to run this program from hotplug scripts or in
      background mode (polls /proc/scsi/scsi for changes).</p>
    <p>Matching rules are specified as a combination of attribute=value pairs.
      One line is one rule. Each device is checked against the rules and if they
      match, device nodes are created using the rules device template 'map' with
      values substituted into the devicename based on those listed below.</p>
    <p>Matching rules are read from /etc/mapscsi.rules or rules can be provided
      on the commandline, overiding the rules file, eg.</p>
    <pre>./mapscsi 'type=disk map=/dev/scsi/h%hc%ct%tl%l'</pre>
    <p>'map' specifies the device template and 'partmap' optionally specifies the
      template for devices with partitions (a default of the device template is
      used with p%p appended if this parameter is not provided).</p>
    <p>If no rules file is provided, these default rules are used (this is a
      wildcard rule that matches all devices):</p>
    <pre>map=/dev/%D/c%hb%ct%tu%l</pre>
    <h3>example /etc/mapscsi.rules</h3>
<pre>type=disk map=/dev/scsi/h%hc%ct%tl%l partmap=/dev/scsi/h%hc%ct%tl%lp%p
type=disk vendor=CNSi map=/dev/san/h%hc%ct%tl%l
type=disk fcwwpn=2000005013b3385a map=/dev/san/array1-lun%l
type=cdrom vendor='HP' product='CD-Writer-8200' map=/dev/cdburner</pre>
    <h3>Substitution codes and match parameters</h3>
    <table border="1">
      <tr><th>subst code</th><th>match param</th><th>description</th></tr>
      <tr><td>%h</td><td>host</td><td>Host / adapter no</td></tr>
      <tr><td>%c</td><td>channel</td><td>Channel no</td></tr>
      <tr><td>%t</td><td>id</td><td>Target / scsi id</td></tr>
      <tr><td>%l</td><td>lun</td><td>LUN</td></tr>
      <tr><td>%p</td><td>part</td><td>Partition number</td></tr>
      <tr><td>%w</td><td>fcwwnn</td><td>FC World Wide Node Name (with qla2x00 v4.46.5)</td></tr>
      <tr><td>%W</td><td>fcwwpn</td><td>FC World Wide Port Name (with qla2x00 v4.46.5)</td></tr>
      <tr><td>%I</td><td>fcdid</td><td>FC Port ID (with qla2x00 v4.46.5)</td></tr>
      <tr><td>%L</td><td>fclid</td><td>FC Loop ID (with qla2x00 v4.46.5)</td></tr>
      <tr><td>%B</td><td>pci</td><td>PCI dev:slot.function (eg 00:0f.0)</td></tr>
      <tr><td>%H</td><td>hostname</td><td>HBA Driver Name</td></tr>
      <tr><td>%V</td><td>vendor</td><td>Vendor Inquiry info</td></tr>
      <tr><td>%P</td><td>product</td><td>Product Inquiry info</td></tr>
      <tr><td>%R</td><td>revision</td><td>Revision Inquiry info</td></tr>
      <tr><td>%S</td><td>serial</td><td>Serial Number Inquiry info</td></tr>
      <tr><td>%D</td><td>prefix</td><td>device prefix (sd, scd)</td></tr>
      <tr><td>%T</td><td>type</td><td>device type (disk, cdrom)</td></tr>
      <tr><td>%g</td><td>sg_device</td><td>generic device (eg. /dev/sg0)</td></tr>
      <tr><td>%d</td><td>device</td><td>original device (eg. /dev/sda)</td></tr>
    </table>
    <p>mapscsi will read /proc/partitions to work out how many partition links
to create.</p>
    <p>Run with no options, mapscsi will output mappings with BSDish style device
names. To actually create the links you need to use the -x option.</p>
<pre># ./mapscsi
/dev/sd/c0b1t0u0 -> /dev/sda
/dev/sd/c0b1t0u0p1 -> /dev/sda1
/dev/sd/c0b1t0u0p2 -> /dev/sda2
/dev/sd/c0b1t0u0p3 -> /dev/sda3
/dev/sd/c0b1t0u0p4 -> /dev/sda4
/dev/sd/c0b1t0u0p5 -> /dev/sda5
/dev/sd/c0b1t0u0p6 -> /dev/sda6
/dev/sd/c0b1t0u0p7 -> /dev/sda7
/dev/sd/c0b1t0u0p8 -> /dev/sda8
/dev/sd/c0b1t0u0p9 -> /dev/sda9
/dev/sd/c0b1t0u0p10 -> /dev/sda10
/dev/scd/c1b0t0u0 -> /dev/scd0
/dev/scd/c1b0t1u0 -> /dev/scd1</pre>
    <p>mapscsi now removes links created by previous runs. It does this by storing
      previously links in a file /var/state/mapscsi/devicemap.</p>
    <h3>Command line options</h3>
<pre>usage: mapscsi [-h] [-x] [-s] [-n] [-a] \
	       [-c &lt;config file>] [-d &lt;devicemap file>] \
	       "[attrib=value [attrib=value]...]" ...

-h     show this help message
-x     execute - actually make the links
-b     background - poll for changes in the background
-s     silent - don't show mappings on stdout
-n     numeric sg device names eg. /dev/sg0 (default)
-a     alpha sg device names eg. /dev/sga
-p     print device scan information
-R     don't remove previous links
-S     don't save state in /var/state/mapscsi/devicemap
-c &lt;f> mapscsi rules file (default /etc/mapscsi.rules)
-d &lt;f> mapscsi state file (default /var/state/mapscsi/devicemap)</pre>
    <h3>Related software</h3>
    <p>An alternative and more mature tool that has similar
     function is <a href="http://www.garloff.de/kurt/linux/scsidev/">scsidev</a>.
     I didn't discover scsidev until after I'd written mapscsi. I think mapscsi
     is a little more flexible with device mapping than scsidev and it has the
     addition of mapping Fibre channel WWNs and a background daemon mode to
     dynamically pick up device changes. Although mapscsi support for
     removeable devices and tapes isn't quite there yet.
     support for removeable devices and tapes isn't quite there yet.</p>
    <p>Many thanks to Doug Gilbert (sg_utils) and the authors of the SCSI
      Programming HOWTO for providing the examples I needed to create
      this program.</p>
    <p>Copyright Metaparadigm Pte. Ltd. 2001. <a href="mailto:michael@metaparadigm.com">Michael Clark</a></p>
    <p>This program is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License version 2 as published
      by the Free Software Foundation.</p>
<hr>