SATA is not SCSI… or is it?

One further comment on The sorry state of open source today, which I did not want to include in my previous entry as I felt it would distract from my main point, which was the inaccuracies in the author’s discussion of FreeBSD.

On page 19, Béranger discusses problems with the disk drivers in Linux 2.6.20. These problems are real (though hopefully transient), and I have myself been bitten by them, as on one machine, Ubuntu’s linux-image-2.6.20-14-386 would not recognize the disks at all; I could boot an older kernel, but then of course nvidia-glx, which had been updated to match the newer non-working kernel, would not load.

Where Béranger stumbles is where he asserts—or implies—that there are fundamental differences between PATA, SATA and SCSI, and that it therefore does not make sense to use similar names (/dev/sdX) for them all.

The reality is far more fluid. Not only is the line between these technologies shifting, it is also gradually disappearing. With the arrival of Serial Attached SCSI, for instance, SATA and SCSI drives share the same cables, connectors and electrical specs, and can be attached to the same controller (although the protocol remains different). Going further back, ATAPI (the standard for attaching removable-media drives to the ATA bus) uses SCSI commands for everything except actual data transfer.

The questions Béranger should be asking are not why PATA, SATA and SCSI hard disks need to share a name, but rather:

  • why they haven’t done so since the start,
  • why the common name should refer explicitly to only one of these standards (sd is short for “SCSI disk”), and
  • why removable-media and fixed-media drives shared a name (/dev/hdX) for so long, especially when that name refers explicitly to fixed-media disks (hd being short for “hard disk”).

Compare with FreeBSD, which also uses different names for ATA and SCSI devices, but at least differentiates between the various types of media: ad (“ATA disk”) and da (“direct access”) for PATA/SATA and SCSI fixed-media disks respectively, acd and cd for CD and DVD drives, ast and st for tape streamers. There is work under way to bring the ATA driver into the CAM framework (which was introduced in 3.0 to clean up SCSI device handling), erasing these differences.

6 thoughts on “SATA is not SCSI… or is it?”

  1. Beyond just SCSI vs ATA naming, I think it’s also silly that all of the other block drivers (RAID drivers, mostly) have different names for their disk-like devices. Windows and Linux avoid this by putting most drivers under the SCSI subsystem, unifying the namespace that way. I’d like to avoid doing that for FreeBSD, but I’d still like a unified namespace. It would be interesting if devfs/GEOM could take care of that automatically; all disk-like devices get a uniform name in /dev, regardless of what the actual driver thinks the name is.

    And just to fan the flames some more, I think that network drivers should have a unified namespace as well, like they do on just about every other OS.

  2. CISS, ASR, TWA, and MLY are already under CAM because their firmware expects to get SCSI-like commands from the OS. The others don’t, and putting them under CAM just means that you incur the overhead of generating a SCSI command followed by translating it back to a block command. Other details like device discovery and error recovery are also vastly different in non-SCSI systems, and pretending otherwise is a poor fit.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.