hd(7) hd(7)
NAME
hd - SCSI hard disk interface
DESCRIPTION
The hd device driver provides an interface to hard disk
attached to the SCSI connector.
Note: The Small Computer System Interface is defined by ANSI
standard and industry practices.
The disk driver included with this release of UNIX® is a
pre-release version which does not correspond to the final
product.
The driver uses a minimal set of SCSI commands to determine
the type of disk drive connected to the computer. Any disk
device responding to the ANSI SCSI commands to Test Unit
Ready, Set Mode to Default, Read Capacity, Read, and Write
should be accessible by this driver. The hardware must be
capable of determining the geometry and size of the disk
device. The pre-release driver will not initialize the
controller to the disk configuration. The driver has been
shown to work with Seagate ST225N, AST 4000, and Quantum 280
disk drives.
Normally the special files associated with the devices are
given names of the form /dev/dsk/cndnsn. The single decimal
digit integers correspond to the controller, drive, and
slice (aka partition). The controller number is the SCSI ID
numbered zero to six. The computer is always SCSI ID 7.
The drive number corresponds to the SCSI logical unit
number. This is typically used when two ``spindles'' share a
common controller. The slice number defines a UNIX
partition number which in this version of the driver will
always be 0, 1, or 7. In this version of the driver, all
special files for SCSI devices share the same UNIX major
number. Currently this is 4. The minor number may be
derived by the formula:
Ctl * 16 + Drive * 8 + Slice
The disk driver defines partitions based on the size of the
disk device. The size is determined by the Read Capacity
SCSI command. Each disk is divided into three partitions,
corresponding to the entire disk, a typical swap area, and a
file system area. In the final release of the product,
partitions will be determined dynamically on a per disk
basis. Apple will provide non-UNIX software to create and
manipulate partitions. If you avoid using the partition
which maps to the entire disk, you are more likely to be
able to adapt to the final partition scheme.
Page 1 (last mod. 1/15/87)
hd(7) hd(7)
The following are typical partition sizes. The precise size
of a partition may be determined by the command:
dd if=/dev/dsk/c0d1s? of=/dev/null bs=512
This will print the total number of blocks read on the
partition. On some drives, notably ones using the Adaptec
4000 controller, the total capacity of the drive will vary
with the number of bad sectors. For these drives, the shown
size is typical.
Quantum 280 Partitions
Slice Start Sector Length
0 (file system) 204 135685
1 (swap) 135889 20480
7 (entire disk) 0 156369
AST 4000 Partitions
Slice Start Sector Length
0 (file system) 204 128344
1 (swap) 128548 20480
7 (entire disk) 0 149028
Seagate ST225N Partitions
Slice Start Sector Length
0 (file system) 204 29241
1 (swap) 31484 10236
7 (entire disk) 0 41720
The driver accepts the following ioctls:
ioctl(fd, UIOCFORMAT, diskformat)
will format the disk. fd should be an open file
descriptor of the character special device (i.e.
/dev/rdsk/c?d?s?). The third parameter to the ioctl
function call contains the address of a diskformat
structure (defined in /usr/include/sys/diskformat.h).
The dsecsize field of this structure may be used to
specify 512 byte or 532 byte sector size for
formatting. 532 byte sector size will not be supported
in future versions of the driver and should not be
used. The other fields of the disk format structure
are ignored.
ioctl(fd, UIOCEXTE, 0)
will activate extended error printing on the system
console. The file descriptor may correspond to any
character special device file associated with the
desired controller.
ioctl(fd, UIOCNEXTE, 0)
will deactivate extended error printing. The file
Page 2 (last mod. 1/15/87)
hd(7) hd(7)
descriptor may correspond to any character special
device file associated with the desired controller.
FILES
/dev/dsk/c[0-6]d[01]s[017]
/dev/rdsk/c[0-6]d[01]s[017]
SEE ALSO
diskformat(1M), mkfs(1M), mknod(1M), ioctl(2).
Page 3 (last mod. 1/15/87)