Installation notes for Linux iSCSI driver

 Copyright (C) 2001, 2002, Cisco Systems, Inc.
 maintained by linux-iscsi@cisco.com

 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or (at
 your option) any later version.

 This program is distributed in the hope that it will be useful, but
 WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 General Public License for more details.

 See the file COPYING included with this distribution for more
 details.

============================================================================
CONTENTS
============================================================================

  Before Installing the iSCSI Driver
  Installing And Configuring The iSCSI Driver

===============================================================================
BEFORE INSTALLING THE iSCSI DRIVER
===============================================================================

  The iSCSI client drivers, README files, and example configuration files
  are available on the Linux-iSCSI homepage at:

    http://linux-iscsi.sourceforge.com

  In addition, at the website you can get information about the availability
  of new drivers, updated drivers, driver compatibility, and other relevant
  information.


===============================================================================
INSTALLING AND CONFIGURING THE iSCSI DRIVER
===============================================================================

  This section is the starting point for installing and configuring the
  iSCSI Driver for Linux and contains the following topics:

   o  Product Overview
   o  System Requirements
   o  Installation Procedures
   o  Mounting Filesystems
   o  Unmounting Filesystems
   o  Making Configuration Changes
   o  Removing the Driver

----------------
PRODUCT OVERVIEW
----------------

  The iSCSI Driver for Linux provides an IP host with the ability to
  access storage through an IP network. The iSCSI driver acts as an iSCSI
  protocol initiator to transport SCSI requests and responses over an IP
  network between the IP host and an iSCSI target device such as a
  Cisco SN 5400 Series system. (The iSCSI protocol is an IETF-defined
  protocol for IP storage. For more information about the iSCSI protocol,
  refer to the IETF standards for IP storage at http://www.ietf.org.)

  Architecturally, the iSCSI driver combines with the IP host TCP/IP
  stack, network drivers, and NICs to provide the same functions as a SCSI
  or Fibre Channel adapter driver with an HBA. (See Figure 1.)


  FIGURE  1  iSCSI Driver Architecture

  ====================================================================
                                   |
             IP host OS            |         Storage host OS
           and applications        |         and applications
                                   |
  ====================================================================
                                   |
              +------------+       |           +-----------+
              |   iSCSI    |       |           |           |
              |   driver   |       |           |   SCSI    |
              |            |       |           |    or     |
    +---------+------------+       |           |    FC     |
    |        TCP/IP        |       |           |  adapter  |
    +----------------------+       |           |  driver   |
    |   Network drivers    |       |           |           |
    +----------------------+       |           +-----------+
               |                   |                 |
  =============|=====================================|================
               |                   |                 |
         +-----------+             |           +-----------+
         |    NIC    |             |           |    HBA    |
         +-----------+             |           +-----------+
               |                   |                 |
  =============|=====================================|================
               |                   |                 |
              _|_                  |                 |
            _(   )_                |           +-----------+
          _(  IP   )_              |           |  SCSI or  |
         (_ network _)             |           | FC media  |
           (_     _)               |           +-----------+
             (_ _)                 |                 |
               |                   |                 |
      +------------------+         |        +------------------+
      |      iSCSI       |         |        |      Storage     |
      |      target      |         |        +------------------+
      |     interface    |         |        |  ___  ___  ___   |
      +------------------+         |        | (___)(___)(___)  |
               |                   |        | (___)(___)(___)  |
               |                   |        | (___)(___)(___)  |
      +------------------+         |        | (___)(___)(___)  |
      |     Storage      |         |        +------------------+
      +------------------+         |
      |  ___  ___  ___   |         |
      | (___)(___)(___)  |         |
      | (___)(___)(___)  |         |
      | (___)(___)(___)  |         |
      | (___)(___)(___)  |         |
      +------------------+         |
                                   |
  ====================================================================

  The iSCSI driver provides a transport for SCSI requests and responses for
  storage devices; however, instead of providing a transport for directly
  attached devices, the driver transports the SCSI requests and responses
  between the IP host and an iSCSI target system via an IP network.
  The iSCSI target system, in turn, transports SCSI requests and responses
  between it and the storage devices attached to it.

  Once the iSCSI driver is installed and started, the IP host will proceed
  with a discovery process for iSCSI storage devices as follows:

  1.  The iSCSI driver requests available iSCSI targets from the
      iSCSI target system.

  2.  The iSCSI target system sends available iSCSI target names to
      the IP host.

  3.  The IP host logs in to the iSCSI targets.

  4.  The iSCSI target system accepts the IP host login.

  5.  The IP host queries targets for device information.

  6.  Targets respond with device information.

  7.  The IP host creates a table of internal devices.

  The iSCSI Driver for Linux provides IP access to a maximum of sixteen
  remote SCSI targets.  Each target will be probed for up to 32 LUNs,
  until the Linux kernel's limit of SCSI devices has been reached.

-------------------
SYSTEM REQUIREMENTS
-------------------

  This driver requires either a 2.2.x Linux kernel version of 2.2.16 or
  later, or a 2.4.x Linux kernel version of 2.4.16 or later. Compilation
  will require the kernel header files matching the kernel version you wish
  to use the driver with.

  As of February 22, 2002 there are several issues with the Linux kernel
  code that can cause problems when using SCSI devices (including iSCSI
  devices).  Linux kernels released after this date may or may not have
  fixed these problems.

  o  Linux kernels 2.2.16 through 2.2.20 and 2.4.0 through 2.4.17 are known
     to have a problem in the SCSI error recovery process. In some cases, a
     successful LUN reset may be ignored and the SCSI layer will continue
     on to the later stages of the error recovery process.

     The problem occurs when multiple SCSI commands for a particular LUN
     are queued in the low-level SCSI driver when a LUN reset occurs. Even
     if the low-level driver correctly reports that all the commands for
     the LUN have been completed by the LUN reset, Linux will assume only
     one command has been completed and continue the error recovery
     process. (If only one command has timed out or failed, Linux will
     correctly terminate the error recovery process following
     the LUN reset.)

     This action is undesirable because the later stages of error recovery
     may send target resets, which can affect other SCSI initiators using
     the target. It is also undesirable because there are more serious bugs
     in the later stages of the Linux SCSI error recovery process.


  o  Linux kernels 2.2.16 through 2.2.20 and 2.4.0 through 2.4.2 may take
     SCSI devices offline after Linux issues a target reset as part of the
     error recovery process.  Taking a device offline causes all I/O to the
     device to fail until the HBA driver is reloaded.

     After the error recovery process does a target reset, it sends a SCSI
     Test Unit Ready command to check if the the SCSI target is operational
     again. If this command returns SCSI sense data, instead of correctly
     retrying the command, Linux will treat it as a fatal error, and
     immediately take the SCSI device offline.

     The Test Unit Ready will almost always be returned with sense data
     because most targets return a deferred error in the sense data of the
     first command received after a target reset. This is a way of telling
     the initiator that a target reset has occurred. Therefore, the
     affected Linux kernel versions almost always take a SCSI device
     offline after a target reset occurs.

     This bug is fixed in Linux kernels 2.4.3 and later.


  o  Linux kernels 2.2.16 through 2.2.20 and 2.4.0 through 2.4.17 appear to
     have problems when SCSI commands are completed with a check condition
     containing sense data. This can result in applications receiving I/O
     errors, short reads or short writes.

     After receiving a SCSI command with sense data, the Linux SCSI
     midlayer checks if some sectors of an I/O request have been
     transferred and informs the application layer if an I/O request has
     partially completed. The SCSI midlayer then retries the request for
     any sectors that have not yet been transferred. Because of the partial
     I/O request completion, applications may receive short reads or
     writes.

     All UNIX applications should handle these conditions, but there may be
     some applications which do not.

     There are also some cases where the application receives an I/O error
     rather than a short read or write.  The exact cause of the I/O errors
     is still being investigated, but it appears to be a bug in the Linux
     kernel's SCSI layer or block device layer.


  o  Linux kernels 2.2.16 through 2.2.20 and 2.4.0 through 2.4.17 may crash
     on a NULL pointer if a SCSI device is taken offline while one of the
     Linux kernel's I/O daemons (e.g. kpiod, kflushd, etc.) is trying to do
     I/O to the SCSI device. The exact cause of this problem is still being
     investigated.

     Note that some of the other bugs in the Linux kernel's error recovery
     handling may result in a SCSI device being taken offline, thus
     triggering this bug and resulting in a Linux kernel crash.


----------
SETTING UP
----------

  1. Update /etc/iscsi.conf to include the IP addresses for your
     iSCSI targets. A sample configuration file might include entries
     like this:

       DiscoveryAddress=192.168.10.94
       Target,Lun=0,0

     The iscsi.conf man page has a more detailed description of the
     configuration file format.  To read the man page, type:

     man iscsi.conf

  2. Manually start iSCSI services to test your configuration. Run:

       service iscsi start

     If there are problems loading the iSCSI kernel module, diagnostic
     information will be placed in /var/log/iscsi.log.

     The iSCSI initialization will report information on each detected
     device to the console or in dmesg(8) output. For example:

       Vendor: SEAGATE   Model: ST39103FC         Rev: 0002
       Type:   Direct-Access                      ANSI SCSI revision: 02
       Detected scsi disk sda at scsi0, channel 0, id 0, lun 0
       SCSI device sda: hdwr sector= 512 bytes.
                                       Sectors= 17783240 [8683 MB] [8.7 GB]
       sda: sda1
       scsi singledevice 0 0 0 1

     Normal disk commands like fdisk, mkfs, and fsck will work on the
     iSCSI devices like a local drive.

     /proc/scsi/iscsi will contain a file (the controller number) that
     contains information about the iSCSI devices.

     To manually stop the iSCSI driver enter:

       service iscsi stop

  3. List your iSCSI partitions in /etc/fstab with the _netdev option.

--------------------
MOUNTING FILESYSTEMS
--------------------

  Because the Linux boot process normally mounts filesystems listed in
  /etc/fstab before the network is configured, you need to add the
  _netdev option to each filesystem on an iSCSI device.

  It is recommended to use filesystem UUIDs or labels (see man pages
  for mke2fs, mount, and fstab) to avoid the configuration problems
  associated with device name changes resulting from configuration
  changes.


----------------------
UNMOUNTING FILESYSTEMS
----------------------
	
  It is very important to unmount all filesystems on iSCSI devices
  before the iSCSI driver stops.  If the iSCSI driver stops while
  iSCSI devices are mounted, buffered writes may not be committed to
  disk and filesystem corruption may occur.

  For this reason, the system automatically umounts all file
  systems with the _netdev option before the iSCSI driver
  stops and before the network is stopped.
	
  Since Linux will not unmount filesystems that are being used by a
  running process, before iSCSI devices can be unmounted, any
  processes using those devices must be stopped (see fuser(1)).

  To avoid filesystem corruption, the netfs shutdown script will
  automatically kill all processes using _netdev devices in /etc/fstab,
  first by sending them SIGTERM, and then by sending any remaining
  processes SIGKILL. It will then unmount all iSCSI filesystems and
  kill the iSCSI daemon, terminating all connections to iSCSI devices.

-----------
MAINTENANCE
-----------

  Making changes to your storage configuration, including adding or
  removing targets or LUNs, remapping targets, or modifying target
  access, may change how the devices are presented to the client. This
  may require corresponding changes in your iSCSI driver configuration
  and /etc/fstab.

  For example, adding a new storage volume may change the order of
  device discovery, thus changing the operating system's numbering
  of existing devices. Applications running on the client may
  require modification to appropriately access the current drives.

  Note: if a client's iSCSI configuration file contains an IP address
  that does not exist or is unreachable, the iSCSI driver will not be
  able to login and discover targets at that address, and the driver
  will not discover targets at IP addresses that appear later in the
  configuration file until a login to the failing address completes
  successfully.

  It is recommended to use filesystem UUIDs or labels (see man pages
  for mke2fs, mount, and fstab) to avoid the configuration problems
  associated with changing device names.

  In general, the following steps are normally required when
  reconfiguring iSCSI storage:

  1. Unmount any file systems and stop any applications using iSCSI
     devices.

  2. Stop the iSCSI driver.

       service iscsi stop

  3. Make the appropriate changes to the iSCSI driver configuration
     file. Remove any references to canonical iSCSI targets that have
     been removed, or that no longer have valid targets for this
     client.

  4. Modify /etc/fstab and application configurations as
     appropriate.

  5. Restart the iSCSI driver or, optionally, reboot the client.

       service iscsi start

  Failure to appropriately update the iSCSI configuration using the
  above procedure may result in a situation that prevents the client
  from accessing iSCSI storage resources.


-------
REMOVAL
-------

  Run rpm -e iscsi
