sd – storage device interface|
bind #S /dev |
The storage device interface serves a two–level directory giving
access to multiple storage units, typically ATA(PI) or SCSI discs.
Each unit is accessed via files in the directory named by the
controller to which it is attached, C, and by its unit number
u. The controller naming convention for ATA(PI) units starts with
first controller being named C, the second D, etc. up to a maximum
of 4 controllers ([C–F]); legacy controllers are always 'C' and
'D'. There can be a maximum of 2 units per ATA(PI) controller
(). The controller naming convention for SCSI units starts
with the first controller being named 0, the second 1, etc. up
a maximum of 16 controllers ([0–9a–f]). There can be a maximum of
16 units per SCSI controller ([0–9a–f]). |
Units are not accessed before the first attach. Units may be individually
attached using the attach specifier, for example
The subdirectory for each unit contains two files, ctl and raw.
In addition, if the unit is a direct–access disc of some type it
may be split into partitions and the subdirectory may contain
a file per partition. By default, the partition data will exist
for such media.
ctl and partitions
Partitions are usually created using fdisk and prep(8); the convention is to name non–Plan 9 partitions after their corresponding operating systems (e.g., /dev/sdC0/dos) and Plan 9 partitions according to their function (e.g., /dev/sdC0/swap). The example in prep(8) shows how.
Reading the ctl file returns at least one line of textual information about the unit. The first line will always be prefixed by inquiry and will give a manufacturer and model number if possible. A line prefixed by config will be returned for appropriate media, e.g. for ATA(PI) units the remainder of the line contains configuration information from the device's identify command (config and capabilities) and also the available I/O transfer options; this is a diagnostic aid. A line prefixed by geometry will be returned for appropriate media; at least two numbers will follow, the first being the number of sectors contained in the unit and the second the sector size in bytes. Any remaining information on the geometry line is unit–dependent, for instance, head, cylinder and sector counts for ATA discs. If any partitions are defined for the media, their name, start–sector and end–sector will be returned, prefixed by part.
LUNs (logical unit numbers) are inconsistently implemented. The
SCSI drivers implement them, but in the (S)ATA drivers, LUNs are
not merely ignored but are actively prevented from working except
for INQUIRY commands. |
The 4 controller limit for ATA(PI) is not enforced.
No account is taken of some buggy ATA PCI controllers such as the CMD640.
ATA(PI) units come up with DMA and multi–sector read/write capability