hd(HW) 06 January 1993 hd(HW) Name hd - internal hard disk drive Description Block-buffered access to the primary hard disk is provided through the following block special files: hd00, hd01 through hd04, hd0a and hd0d, root, and swap. Block-buffered access to the secondary hard disk is pro- vided through the following block special files: hd10, hd11 through hd14, hd1a. hd00 refers to the entire physical disk; hd01 through hd04 refer to the fdisk partitions. root refers to the root file system; swap refers to the swap area; the block special files access the disks via the system's nor- mal buffering mechanism and may be read and written without regard to the size of physical disk records. Character special files follow the same naming convention as the block special files except that the character special file is prefaced with an ``r'' (for ``raw'' or character device). For example, the character spe- cial file referring to the entire physical disk is /dev/rhd00. The following are example names of the fixed disk partitions. Each partition can be accessed through a block interface, for example /dev/hd01, or through a character (raw) interface, for example /dev/rhd01. The above devices follow the XENIX naming convention. Equivalent UNIX devices are found in the /dev/dsk (character) and /dev/rdsk (raw) direc- tories. In the table that follows, both XENIX and UNIX devices are shown. XENIX devices extend only to disks located on the first control- ler; beyond this, the UNIX devices shown must be used. Device filenames for fixed disks _________________________________________________________________________ First Controller Disk 1 Disk 2 Partition _________________________________________________________________________ /dev/hd00 /dev/hd10 entire disk /dev/rhd00 /dev/rhd10 /dev/hd01 /dev/hd11 first partition /dev/rhd01 /dev/rhd11 /dev/hd02 /dev/hd12 second partition /dev/rhd02 /dev/rhd12 /dev/hd03 /dev/hd13 third partition /dev/rhd03 /dev/rhd13 /dev/hd04 /dev/hd14 fourth partition /dev/rhd04 /dev/rhd14 /dev/hd0a /dev/hd1a active partition /dev/rhd0a /dev/rhd1a /dev/root root file system /dev/rroot /dev/swap swap area /dev/rswap Note that the root and swap files exist only for the root disk. The scheme of the minor device number bit representation is show in the following table: Hard disk minor device bit representation ________________________________________________________________________ Bits 7 6 5 4 3 2 1 0 Description ________________________________________________________________________ X X - - - - - - disk # (0-3) - - X X X - - - partition # (1-4) - - - - - X X X division # (0-6) - - X X X 1 1 1 whole partition - - 0 0 0 0 0 0 whole physical disk - - 1 0 1 - - - active partition - - 1 1 0 - - - DOS partition - - 1 1 0 X X X DOS drive (C-J) Because some SCSI controllers support large numbers of physical drives, an extended minor device numbering scheme is provided for those devices requiring more than 256 minor numbers. Each driver that uses extended minor numbers has a base major number which is used to refer to the driver through the extended minor numbers. The driver has a normal entry in the mdevice table for the base major number, plus one additional entry for each group of 256 minor devices that the driver uses. Additional entries are identified by the ``M'' flag in the driver's de- vice characteristics field. The ``M'' flag indicates that the entry cor- responds to a virtual major number that points to a device driver that uses extended minor numbers. Therefore a very large disk may sometimes have two (or more) major numbers; the first will correspond to minor num- bers 0-255, the second to minor devices 256-512, and so on. The following table lists the minor device number definitions for the hard disk special files, along with examples. Note that the block and character special devices share the same minor device definition. The minor device bits for DOS disk special files are listed in a separate table. Minor device bits _________________________________________________________________________ Disk Partition Division Device special Description 7 6 5 4 3 2 1 0 file name _________________________________________________________________________ 0 0 0 0 0 0 0 0 /dev/hd00 whole PD 0 0 1 0 0 0 0 0 0 /dev/hd10 whole PD 1 1 0 0 0 0 0 0 0 /dev/dsk/4s0 whole PD 2 1 1 0 0 0 0 0 0 /dev/dsk/5s0 whole PD 3 0 0 0 0 1 1 1 1 /dev/hd01 PD 0, whole FP 1 0 0 0 1 0 1 1 1 /dev/hd02 PD 0, whole FP 2 0 0 0 1 1 1 1 1 /dev/hd03 PD 0, whole FP 3 0 0 1 0 0 1 1 1 /dev/hd04 PD 0, whole FP 4 0 0 1 0 1 1 1 1 /dev/hd0a PD 0, whole active FP 0 0 1 0 1 0 0 0 /dev/root PD 0, active partition, DP 0 0 0 1 0 1 0 0 1 /dev/swap PD 0, active partition, DP 1 0 0 1 0 1 0 1 0 /dev/u PD 0, active partition, DP 2* 0 0 1 0 1 1 1 0 /dev/recover PD 0, active partition, DP 6 0 1 0 0 1 1 1 1 /dev/hd11 PD 1, whole FP 1 0 1 0 1 0 1 1 1 /dev/hd12 PD 1, whole FP 2 0 1 0 1 1 1 1 1 /dev/hd13 PD 1, whole FP 3 0 1 1 0 0 1 1 1 /dev/hd14 PD 1, whole FP 4 0 1 1 0 1 1 1 1 /dev/hd1a PD 1, whole active FP 0 1 1 0 1 0 0 0 /dev/u0 PD 1, active partition, DP 0* 0 1 1 0 1 0 0 1 /dev/u1 PD 1, active partition, DP 1* 0 1 1 0 1 0 1 0 /dev/u2 PD 1, active partition, DP 2* 1 0 0 0 1 1 1 1 /dev/dsk/2s1 PD 2, whole FP 1 1 0 0 1 0 1 1 1 /dev/dsk/2s2 PD 2, whole FP 2 1 0 0 1 1 1 1 1 /dev/dsk/2s3 PD 2, whole FP 3 1 0 1 0 0 1 1 1 /dev/dsk/2s4 PD 2, whole FP 4 1 0 1 0 1 1 1 1 /dev/dsk/2sa PD 2, whole active FP 1 1 0 0 1 1 1 1 /dev/dsk/3s1 PD 3, whole FP 1 1 1 0 1 0 1 1 1 /dev/dsk/3s2 PD 3, whole FP 2 1 1 0 1 1 1 1 1 /dev/dsk/3s3 PD 3, whole FP 3 1 1 1 0 0 1 1 1 /dev/dsk/3s4 PD 3, whole FP 4 1 1 1 0 1 1 1 1 /dev/dsk/3sa PD 3, whole active FP Key FP = fdisk partition PD = physical drive DP = division (divvy partition) * = user-defined name The device files u and u[0-2] are optional filesystem names; these nodes are not present unless created by the system administrator. DOS minor device bits _________________________________________________________________________ Disk Partition Division Device special Description 7 6 5 4 3 2 1 0 file name _________________________________________________________________________ 0 0 1 1 0 0 0 0 /dev/dsk/0sC PD 0, PDP, logical drive C 0 0 1 1 0 0 0 1 /dev/dsk/0sD PD 0, EDP, logical drive D 0 0 1 1 0 0 1 0 /dev/dsk/0sE PD 0, EDP, logical drive E 0 0 1 1 0 0 1 1 /dev/dsk/0sF PD 0, EDP, logical drive F 0 0 1 1 0 1 0 0 /dev/dsk/0sG PD 0, EDP, logical drive G 0 0 1 1 0 1 0 1 /dev/dsk/0sH PD 0, EDP, logical drive H 0 0 1 1 0 1 1 0 /dev/dsk/0sI PD 0, EDP, logical drive I 0 0 1 1 0 1 1 1 /dev/dsk/0sJ PD 0, EDP, logical drive J 0 1 1 1 0 0 0 0 /dev/dsk/1sC PD 1, PDP, logical drive C 0 1 1 1 0 0 0 1 /dev/dsk/1sD PD 1, EDP, logical drive D 0 1 1 1 0 0 1 0 /dev/dsk/1sE PD 1, EDP, logical drive E 0 1 1 1 0 0 1 1 /dev/dsk/1sF PD 1, EDP, logical drive F 0 1 1 1 0 1 0 0 /dev/dsk/1sG PD 1, EDP, logical drive G 0 1 1 1 0 1 0 1 /dev/dsk/1sH PD 1, EDP, logical drive H 0 1 1 1 0 1 1 0 /dev/dsk/1sI PD 1, EDP, logical drive I 0 1 1 1 0 1 1 1 /dev/dsk/1sJ PD 1, EDP, logical drive J 1 0 1 1 0 0 0 0 /dev/dsk/2sC PD 2, PDP, logical drive C 1 0 1 1 0 0 0 1 /dev/dsk/2sD PD 2, EDP, logical drive D 1 0 1 1 0 0 1 0 /dev/dsk/2sE PD 2, EDP, logical drive E 1 0 1 1 0 0 1 1 /dev/dsk/2sF PD 2, EDP, logical drive F 1 0 1 1 0 1 0 0 /dev/dsk/2sG PD 2, EDP, logical drive G 1 0 1 1 0 1 0 1 /dev/dsk/2sH PD 2, EDP, logical drive H 1 0 1 1 0 1 1 0 /dev/dsk/2sI PD 2, EDP, logical drive I 1 0 1 1 0 1 1 1 /dev/dsk/2sJ PD 2, EDP, logical drive J 1 1 1 1 0 0 0 0 /dev/dsk/3sC PD 3, PDP, logical drive C 1 1 1 1 0 0 0 1 /dev/dsk/3sD PD 3, EDP, logical drive D 1 1 1 1 0 0 1 0 /dev/dsk/3sE PD 3, EDP, logical drive E 1 1 1 1 0 0 1 1 /dev/dsk/3sF PD 3, EDP, logical drive F 1 1 1 1 0 1 0 0 /dev/dsk/3sG PD 3, EDP, logical drive G 1 1 1 1 0 1 0 1 /dev/dsk/3sH PD 3, EDP, logical drive H 1 1 1 1 0 1 1 0 /dev/dsk/3sI PD 3, EDP, logical drive I 1 1 1 1 0 1 1 1 /dev/dsk/3sJ PD 3, EDP, logical drive J Key PDP = primary DOS partition EDP = extended DOS partition Bits 5, 4, and 3 are set to ``110'' to signify that a partition is a DOS partition. The division number indexes the primary or extended logical DOS partitions in the order that they were created on the disk using fdisk(ADM). The device file /dev/hd0d (first DOS partition) is linked to /dev/dsk/0sC for backwards compatibility. To access DOS partitions, specify letters such as ``C:'' or ``D:'' to indicate first or second partitions. The file /etc/default/msdos con- tains lines that assign a letter abbreviation for the DOS device name. Refer to dos(C). An existing XENIX filesystem may be mounted on UNIX provided that a spe- cial device file is created in the /dev directory using the mknod(C) com- mand. The major and minor device numbers that must be specified for the XENIX device file are calculated in exactly the same way as for UNIX. Bits 7 and 6 of the minor device number specify the physical drive num- ber; bit 5 is set to 0 (zero); bits 4 and 3 specify the partition; and bits 2, 1, and 0 specify the division. For example, to create character and block special files for the XENIX /u filesystem (division 2) on par- tition 3 of physical drive 0, the minor device bit representation would be ``00011010'' corresponding to a minor number of 26. The commands to make the device files would then be: mknod /dev/dsk/0s3x b 1 26 mknod /dev/rdsk/0s3x c 1 26 Here the naming convention for hard disk device files has been adapted by adding ``x'' to mean ``XENIX filesystem''. The XENIX filesystem may now be mounted on a stub directory (here /x) using the mount(ADM) command: mount -f XENIX /dev/dsk/0s3x /x See also badtrk(ADM), divvy(ADM), dos(C), fdisk(ADM), mkdev(ADM) and mknod(C). Diagnostics The following messages are among those that may be printed on the con- sole: invalid fixed disk parameter table and: error on fixed disk (minor n), block = nnnnn, cmd=nnnnn, status=nnnn, Sector = nnnnn, Cylinder/head = nnnnn Possible reasons for the first error include: + The kernel is unable to get drive specifications, such as number of heads, cylinders, and sectors per track, from the disk controller ROM. + Improper configuration. + The disk is not turned on. + The disk is not supported. The second error specifies the following information: + block: The UNIX block number within the device. + cmd: The last command sent to the disk controller. + status: The error status from the disk controller. + Sector and Cylinder/head specify the location of a possible flaw. This information is used with badtrk(ADM). Notes On the first disk, hd00 denotes the entire disk and is used to access the master boot block which includes the fdisk partition table. For the second disk, hd10 denotes the entire disk and is used to access its fdisk partition table. Do not write to hd10 and hd00.