"SfR Fresh" - the SfR Freeware/Shareware Archive

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


As a special service "SfR Fresh" has tried to format the requested source page into HTML format using source code syntax highlighting with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. That can be also achieved for any archive member file by clicking within an archive contents listing on the first character of the file(path) respectively on the according byte size field.
    1 mapscsi - Linux SCSI device mapping tool
    2 
    3 Problem: Currently SCSI devices names are allocated in the order of probing.
    4 If an additional device is added and has a lower host, channel or id
    5 than existing devices, these other devices will all be shuffled along on
    6 the next reboot ie. /dev/sdb becomes /dev/sdc, etc. Causing much mayhem with
    7 fstab et al.
    8 
    9 mapscsi is a small utility that creates a consistent mapping to Linux
   10 scsi devices. mapscsi achieves this by creating symbolic links to linux
   11 scsi disk devices after scanning all scsi disk devices, finding out their
   12 host, channel, id, lun, pci location (if available), Fibre Channel world
   13 wide node and port names, loop and port ids (with qla2x00 v4.46.5 driver)
   14 vendor, product and serial number details and using this information plus
   15 a mapping rules file containing device templates to dynamically create
   16 link names.
   17 
   18 mapscsi is a simple alternative to devfs and provides the added ability
   19 of including drive information such as vendor / product details and serial
   20 numbers in in device link names.
   21 
   22 It is intended to be run at boot time after device probing. There is still
   23 no guarantee these mappings are correct if devices have been hotplugged. It
   24 would be advisable to run this program from hotplug scripts or in
   25 background mode (polls /proc/scsi/scsi for changes).
   26 
   27 Matching rules are specified as a combination of attribute=value pairs.
   28 One line is one rule. Each device is checked against the rules and if they
   29 match, device nodes are created using the rules device template 'map' with
   30 values substituted into the devicename based on those listed below.
   31 
   32 Matching rules are read from /etc/mapscsi.rules or rules can be provided
   33 on the commandline, overiding the rules file, eg.
   34 
   35   ./mapscsi 'type=disk map=/dev/scsi/h%hc%ct%tl%l'
   36 
   37 'map' specifies the device template and 'partmap' optionally specifies the
   38 template for devices with partitions (a default of the device template is
   39 used with p%p appended if this parameter is not provided).
   40 
   41 If no rules file is provided, these default rules are used (this is a
   42 wildcard rule that matches all devices):
   43 
   44   map=/dev/%D/c%hb%ct%tu%l
   45 
   46 example /etc/mapscsi.rules
   47 
   48   type=disk map=/dev/scsi/h%hc%ct%tl%l partmap=/dev/scsi/h%hc%ct%tl%lp%p
   49   type=disk vendor=CNSi map=/dev/san/h%hc%ct%tl%l
   50   type=disk fcwwpn=2000005013b3385a map=/dev/san/array1-lun%l
   51   type=cdrom vendor='HP' product='CD-Writer-8200' map=/dev/cdburner
   52 
   53 Substitution codes and match parameters:
   54 %h     host       Host / adapter no
   55 %c     channel    Channel no
   56 %t     id         Target / scsi id
   57 %l     lun        LUN
   58 %p     part       Partition number
   59 %w     fcwwnn     FC World Wide Node Name (with qla2x00 v4.46.5)
   60 %W     fcwwpn     FC World Wide Port Name (with qla2x00 v4.46.5)
   61 %I     fcdid      FC Port ID (with qla2x00 v4.46.5)
   62 %L     fclid      FC Loop ID (with qla2x00 v4.46.5)
   63 %B     pci        PCI dev:slot.function (eg 00:0f.0)
   64 %H     hostname   HBA Driver Name
   65 %V     vendor     Vendor Inquiry info
   66 %P     product    Product Inquiry info
   67 %R     revision   Revision Inquiry info
   68 %S     serial     Serial Number Inquiry info
   69 %D     prefix     device prefix (sd, scd)
   70 %T     type       device type (disk, cdrom)
   71 %g     sg_device  generic device (eg. /dev/sg0)
   72 %d     device     original device (eg. /dev/sda)
   73 
   74 mapscsi will read /proc/partitions to work out how many partition links
   75 to create.
   76 
   77 Run with no options, mapscsi will output mappings with BSDish style device
   78 names. To actually create the links you need to use the -x option.
   79 
   80 # ./mapscsi
   81 /dev/sd/c0b1t0u0 -> /dev/sda
   82 /dev/sd/c0b1t0u0p1 -> /dev/sda1
   83 /dev/sd/c0b1t0u0p2 -> /dev/sda2
   84 /dev/sd/c0b1t0u0p3 -> /dev/sda3
   85 /dev/sd/c0b1t0u0p4 -> /dev/sda4
   86 /dev/sd/c0b1t0u0p5 -> /dev/sda5
   87 /dev/sd/c0b1t0u0p6 -> /dev/sda6
   88 /dev/sd/c0b1t0u0p7 -> /dev/sda7
   89 /dev/sd/c0b1t0u0p8 -> /dev/sda8
   90 /dev/sd/c0b1t0u0p9 -> /dev/sda9
   91 /dev/sd/c0b1t0u0p10 -> /dev/sda10
   92 /dev/scd/c1b0t0u0 -> /dev/scd0
   93 /dev/scd/c1b0t1u0 -> /dev/scd1
   94 
   95 mapscsi now removes links created by previous runs. It does this by storing
   96 previously links in a file /var/state/mapscsi/devicemap.
   97 
   98 Command line options
   99 
  100 usage: mapscsi [-h] [-x] [-s] [-n] [-a] \
  101 	       [-c <config file>] [-d <devicemap file>] \
  102 	       "[attrib=value [attrib=value]...]" ...
  103 
  104 -h     show this help message
  105 -x     execute - actually make the links
  106 -b     background - poll for changes in the background
  107 -s     silent - don't show mappings on stdout
  108 -n     numeric sg device names eg. /dev/sg0 (default)
  109 -a     alpha sg device names eg. /dev/sga
  110 -p     print device scan information
  111 -R     don't remove previous links
  112 -S     don't save state in /var/state/mapscsi/devicemap
  113 -c <f> mapscsi rules file (default /etc/mapscsi.rules)
  114 -d <f> mapscsi state file (default /var/state/mapscsi/devicemap)
  115 
  116 Related software
  117 
  118 An alternative and more mature tool that has similar function is scsidev:
  119 
  120   http://www.garloff.de/kurt/linux/scsidev/
  121 
  122 I didn't discover scsidev until after I'd written mapscsi. I think mapscsi
  123 is a little more flexible with device mapping than scsidev and it has the
  124 addition of mapping Fibre channel WWNs and a background daemon mode to
  125 dynamically pick up device changes. Although mapscsi support for removeable
  126 devices and tapes isn't quite there yet.
  127 
  128 Many thanks to Doug Gilbert (sg_utils) and the authors of the SCSI
  129 Programming HOWTO for providing the examples I needed to create
  130 this program.
  131 
  132 
  133 Copyright Metaparadigm Pte. Ltd. 2001. Michael Clark <michael@metaparadigm.com>
  134 
  135 
  136 This program is free software; you can redistribute it and/or modify
  137 it under the terms of the GNU General Public License version 2 as published
  138 by the Free Software Foundation.
  139