ST(4)

NAME
st*, rst* - Winchester disc driver.

DESCRIPTION
The files /dev/st* and /dev/rst* are block and character devices respectively which refer to winchester discs on the ST506 controller. Currently supported drives are the Tandon 20Mb drive, and the Rodime 3065 53Mb drive, but details of the disc geometry (tracks per cylinder, sectors per track) are read from the drive at boot time, hence any ST506-compatible disc may be used, provided it is correctly formatted under RISC OS.

Controllers may be located internally, or in any podule slot.

Different bits in the minor device number select the controller, the drive (out of 1 or 2 per controller) and a partition number from 0 to 7 which subdivides the drive, permitting use of the drive by RISC OS in addition to UNIX. The controller may be selected in one of two ways: logical or physical order. Logical order is the order in which controllers are scanned for at boot time: first an internal controller is checked for, then podule slots 0 to 3 are scanned looking for podule controllers. The controllers are numbered logically from 0 up to a maximum of 4, as each is found. Physical ordering numbers controllers as 0 for the internal controller and 4..7 for controllers in podule slots 0..3 respectively. Physical controllers 1..3 never exist.

The minor device number is composed of the following bits:

    partition number	0 to 7
    +(drive no.) * 8	0 and 1 supported
    +(contr. no.) * 16	0 to 7
    +128	for physical controller ordering

The partition table is soft and is initialised for each drive when the drive is formatted using the appropriate disc formatter running under RISC OS, and is read from the drive, together with the disc geometry parameters, when UNIX first accesses the drive, in addition to the bad sector table, which is used to transparently replace defective sectors on the disc. Some of the partitions may not be defined, and the overall sizes are variable, however there are some standard partitions as follows:

    0	root	Root partition
    1	swap	Swap partition (not always allocated)
    2	usr	Balance of disc (not always allocated)
    6	boot	RISC OS, plus bad block replacements
    7	whole	Entire disc

Each partition is a whole number of disc cylinders. The last cylinder of the RISC OS partition contains the partition table (2 copies in 256-byte sectors) followed by the bad sector map, in 4 256-byte sectors, and finally by the bad sector replacement sectors.

The partition table has the following structure, defined in <sys/partition.h>.

    struct	partition_table	{
    	unsigned  part_magic;	/*  Magic number  */
    	struct	{
    		unsigned  long  part_start;	/*  Abs cyl number  */
    		unsigned  long  part_size;	/*  No of cyls  */
    		unsigned  int  part_flags;	/*  Status  */
    		char  part_desc[16];	/*  Descriptive text  */
    	}  part_tab[8];
    };

A check is made on the consistency of this structure before proceeding.

The field part_start contains the absolute cylinder number of the start of the partition.

The field part_size contains the number of cylinders.

The field part_flags has bit 31 defined to denote that the partition has been changed, and the balance of the bits are currently reserved.

The bad sector map has the following format, defined in <sys/badblk.h>.

    typedef	unsigned  short	track_address;
    typedef	struct	{
    	unsigned  short	cylinder;
    	track_address	block;
    }  disc_address;
    struct	badblk_hdr	{
    	unsigned  	bb_magic;	/*  Magic number  */
    	unsigned  	bb_number;	/*  No of bad blocks  */
    	disc_address	bb_blocks[BB_MAX];
    	track_address	bb_replacement[BB_MAX];
    };

The replacement blocks are relative to the start of the bad block replacement cylinder, and start following the partition table and bad sector replacement map. Any change (using partitions 6 or 7) will not be felt until the system is rebooted. Great care should be exercised. It is very easy to destroy the file system if this cylinder is corrupted.

FILES
/dev/st*
/dev/rst*

SEE ALSO
bbutil(8)

DIAGNOSTICS
Various error conditions are noted, and appropriate messages are output on the console.