SCSI Command Descriptor Block (CDB)
The SCSI Command Descriptor Block (CDB) is a block of information that describes the command. Commands are sent from SCSI Initiators, which are contained in host computers, to SCSI Targets, which are controllers of some type of storage device (hard disk, tape drive, etc.). Almost every CDB contains 3 parts:
- a “What” field,
- a “Where” field, and
- a “How Much” field.
For some commands, these fields are implied or not required.
The “What” field is called the Operation Code (or OpCode) and tells the target what the command is supposed to do. A couple of examples would be READ or WRITE. The READ command moves data from the storage device to the host system, while the WRITE command moves data to the storage device for later access.
The “Where” field tells the target where to begin the operation and is expressed as a Logical Block Address, or LBA. This address ranges from zero (0) to the maximum address of the device. Some commands, such as INQUIRY, do not require this field.
The “How Much” field tells the target how many blocks (or bytes) or data to move. The block size of most storage devices is 512 bytes, but in certain storage devices, the block size can be different. This field is expressed as either Transfer Length (in blocks), Allocation Length (bytes moving to the host), or Parameter List Length (bytes moving to the device). Which name is used depends on the command itself.
CDBs come in various sizes, typically 6, 10, 12, or 16 bytes total. Below is a figure of a 10-byte READ command to be sent to a hard drive. This command, if successful, will move one block (512 bytes) of data to the host computer system, from logical block address 100h (hex). All other bits or fields that are not labeled are set to zero.