SCSI Command Basics


SCSI has a rich command language that is used to move data between systems and storage quickly and accurately. Unlike commands used with systems and networking equipment, SCSI commands are rarely, if ever, entered from a command line or graphical user interface (GUI) by an administrator. Instead, SCSI commands are implemented programmatically and are embedded in software products, such as file systems and backup software. The sections that follow give a very abbreviated view of this deep and rich subject, including the following topics:

  • Command descriptor blocks (CDBs)

  • Types of SCSI commands

  • Basic SCSI commands

  • SCSI reservation

  • Extended copy and third-party copy

Command Descriptor Blocks

Protocols provide a defined format for communications, allowing sending and receiving nodes to agree completely on what is being communicated. The format of the information that is exchanged is called a protocol data unit (PDU).

The PDU for SCSI commands is called a command descriptor block (CDB). Initiators create CDBs, and the device server running in the logical unit interprets them. When the logical unit has finished processing the command, it responds by returning a status code for the command, along with any accompanying data, to the initiator.

Unlike most networking protocols, which have regularly-sized packet or frame sizes, SCSI CDBs do not have a prescribed, consistent length. Some commands are short, while others can be long. Implementations of SCSI-3 such as the Fibre Channel FCP protocol, define the way SCSI CDBs are mapped into their corresponding fixed-size network PDUs.

SCSI status codes have meanings that do not necessarily coincide with human intuition. A response signaling that a task has completed simply means that the task has finished processing; it does not necessarily mean that the intent of the command completed successfully. Only experienced storage and systems administrators who know what the status codes mean should attempt to use them when troubleshooting system I/O problems.

Types of SCSI Commands

There are several different types of commands in SCSI, reflecting the diversity of systems and devices it supports. In fact, multiple subcommittees in the T10 organization work on different subsets of the total specification. Some of the various types of commands in SCSI are as follows:

  • Primary commands (all devices) Considering the wide variety of functions afforded by SCSI and the mission-critical nature of storage, SCSI systems can be sizable and complex. Not surprisingly, the commands used to maintain a well-oiled SCSI environment have a great deal of depth. Primary SCSI commands are those that can be used by any system, device, or subsystem, including disk drives, tape drives, CD drives, printers, scanners, plotters, etc.

  • Block commands (storage devices such as disk drives) While there are many parts to storage and SCSI, the commands used to operate disk drives are the most critical and the most heavily used. SCSI block commands are primarily concerned with the operation of disk drives, but they also work with other block-storage rotating-media devices, such as CD and DVD drives. A related set of standards called reduced block commands is maintained for commands written for logical block devices that do not allow direct manipulation of their contents, but maintain a logical mapping of their contents.

  • Streaming commands (sequential access devices) Streaming commands control sequential-access devices. In general, sequential-access devices like tape drives are not considered random-access devices even though they can locate data anywhere on tape media. Printers and plotters are other examples of streaming devices. There are two types of commands for streaming devicesthose that contain positioning information and those that do not.

  • Media changer commands (removable media with robotics) The commands used to place and move media within automated changers as well as to insert and remove media from devices within changers constitute media changer commands. These include tape and optical media changers. At some point, they will likely also include the ability to change removable hard disk drives.

  • Enclosure services (cabinet/environmentals) SCSI devices are often enclosed in subsystem cabinets with many other devices. These cabinets necessarily have power and cooling systems to maintain the proper environment for reliable device operations. SCSI enclosure services commands are used to provide management operations and visibility to these important elements.

Basic SCSI Commands

The SCSI commands used most often for storage I/O transmissions are the READ and WRITE commands. READ commands request data to be sent by a logical unit in a storage target to the initiator, where it is then sent to a requesting application. WRITE commands request that data that is sent from the initiator to the logical unit be written to storage media. The intent of these commands is not just to transfer data between initiators and targets but to ensure that it reaches its eventual destination. There are several variations of both READ and WRITE commands.

Three other commonly used SCSI commands are MODE SENSE, MODE SELECT, and REPORT LUNS. The MODE SENSE and MODE SELECT commands are used together by applications to determine what operating capabilities (modes) a storage device or logical device has and to choose to use one of those modes. For instance, a MODE SENSE command could be used to discover the ways a tape drive can handle end-of-tape conditions. MODE SELECT could then be used by a backup application to work in the optimal fashion with the software's logic.

The REPORT LUNS command is used by an initiator when it attempts to discover what LUNs are available through a specific device port. After receiving the REPORT LUNS command, a target responds with an inventory of all the available LUNs exported through the port the command was received on. The REPORT LUNS command is at the core of how LUN masking works in SAN storage subsystems, as discussed in Chapter 5, "Storage Subsystems." By not including certain LUNs in the inventory that is returned to the initiator, the initiator will not discover them and try to use them.

While there is a lot of flexibility in how storage devices are designed, all SCSI targets are required to support four commands: INQUIRY, READ CAPACITY, REQUEST SENSE, and TEST UNIT READY.

The SCSI INQUIRY command is used to discover what the configuration is for a target and logical unit, including such things as manufacturers and product identification, version numbers, and information about its command support. READ CAPACITY is used by a system to discover the block size and the number of blocks used in a storage address space. The REQUEST SENSE command is used to query about command status, and the TEST UNIT READY command is a way to determine if a device and its media are available to commence operations.

SCSI Reservation

Certain SCSI commands reserve storage devices for the use of specific applications servers. This feature is particularly useful for backup applications where it is desired to reserve the use of tape drives and tapes for the highest-priority servers. This mechanism also includes a way to remove reservations.

The SCSI reservation mechanism was not used much prior to the advent of SANs. However, with the potential for many servers to back up data over a SAN to centralized backup storage, it became obvious that the SCSI reservation mechanism could be useful. This topic is discussed more in Chapter 13, "Network Backup: The Foundation of Storage Management."

Extended Copy and Third-Party Copy

A relatively new SCSI command that is primarily applicable to SAN environments is the EXTENDED COPY command. EXTENDED COPY allows dual-mode SCSI controllers to act as "proxy" initiators that copy data on behalf of another initiator. A controller supporting this function receives an EXTENDED COPY command from an initiator and then issues READ and WRITE commands to specified logical units for a specific block range of data. The terms third-party copy, x-copy, and e-copy are all used to refer to the function provided by the EXTENDED COPY command. Figure 6-7 illustrates the mechanism used for EXTENDED COPY.

Figure 6-7. SCSI EXTENDED COPY Processing


In Figure 6-7, an initiator in a system sends an EXTENDED COPY command to a dual-mode storage controller. Acting as a SCSI target, this controller receives and interprets the EXTENDED COPY command and then proceeds to execute its initiator role by reading data from the source target and writing it to a destination target. The network ports on the dual-mode controller are not shown. There could be a single port or multiple ports. The actual port configuration does not impact the SCSI function, which is independent of the connecting technology.

The EXTENDED COPY command was designed to enable the transfer of data between different types of storage devices, such as disk, tape, and optical devices/subsystems. But it can also be used to transfer data between different virtual storage resources within the same subsystem.

Intuitively, EXTENDED COPY would seem to make a lot of sense for performing backups in a SAN. Using EXTENDED COPY allows systems to be bypassed while transferring large amounts of backup data. However, the concept is far simpler than the implementation due to the necessity of synchronizing host system software operations to ensure data integrity. The topic of third-party copy backup is discussed in more detail in Chapter 13.



Storage Networking Fundamentals(c) An Introduction to Storage Devices, Subsystems, Applications, Management, a[... ]stems
Storage Networking Fundamentals: An Introduction to Storage Devices, Subsystems, Applications, Management, and File Systems (Vol 1)
ISBN: 1587051621
EAN: 2147483647
Year: 2006
Pages: 184
Authors: Marc Farley

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net