Bits Bytes and Blocks
When discussing Storage Networking, or getting into the “nuts and bolts” of commands and moving data around, the topic of Bits, Bytes, and Blocks almost always seems to come up. It usually starts with a question like “where can I find the bit that turns on (or off) a particular function.”
For example, there is a bit called “IMMED” (Immediate) in several SCSI commands (CDBs) that tells the device to send back Status immediately. This is not really true, if you read the details about that particular bit, but the important part is where will you find this bit and how would you identify it in a precise manor. That is where the bits and bytes come in.
The example above shows that this particular bit is Bit zero (0) of Byte one (1), in this particular command. Where the confusion comes in is usually based on what a person has worked with in the past and what they are used to.
In some environments, people will often start with bit 0 on the far left and move up as they move to the right. But since most of the storage industry started with bit 7 on the left of each byte, and count down as they move to the right, this is the way it is displayed and labeled in the SCSI Standards.
Also note that in SCSI land (the land of storage) when we start counting bytes, we start with zero (0) and count up from there (even if the bytes are shown going down the page). That is why this 6-byte command (or 6-byte CDB) starts with byte 0 and goes to by 5 – a total of six bytes. The key for most people is to be flexible, and get to know the system that you are working with.
That brings us to Blocks, and the big question of “How big is a Block?” The real answer to that question is … It depends! What is depends on is the device type that you are talking to. Since a large amount of people in the storage industry deal with disk drives, the “typical” answer is – 512 bytes. I say “typical” because I have worked with systems that have larger block sizes, such as 520 or 528 byte blocks. These are usually hard drives that are installed in special RAID arrays and have been formatted for that system.
When you talk with different device types, the block size may be different. For example, many of the optical media devices I have worked with use a 2K byte block size. Again, you have to be flexible and have the ability to find out how the device you are talking to is used most of the time.
If you have any questions, just leave a comment here.