Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ disk(4) — AOS 4.3

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

fd(4)

hd(4)

sc(4)

fdisk(8R)

format(8R)

minidisk(8R)

sautil(8R)

DISK(4)  —  

NAME

disk − format of reserved areas of the hard disk

SYNOPSIS

#include <machineio/hdconfig.h>
#include <machine/dkio.h>

DESCRIPTION

On the IBM 6152 Academic System, the first sector of all fixed disks must have a master fixed disk boot record.  The first sector also contains the boot record partition table. This partition table defines how the disk is divided among up to four partitions.  We will refer to each of these partitions as physical partitions, because they are contiguous disk space, aligned on cylinder boundaries and are dedicated to a specific operating system. 

Logical blocks are numbered beginning at zero and continuing across track and cylinder boundaries to the last block on the disk.  Sectors on each track are numbered beginning at 1.  The notation “(cylinder,track,sector)” denotes the physical location of a block.  Thus, block 0 corresponds to sector (0,0,1). 

Cylinder zero of the “c” partition is reserved by IBM for information describing the disk itself, including its geometry and the location of bad sectors.  Since building a file system at cylinder zero would destroy this information, the default “a” partition begins at cylinder 1.  The “c” partition may be used to access this information, but it is inadvisable to build a file system on a “c” partition.  On the IBM RT PC, a portion of cylinder zero, beginning at (0,2,9), is reserved for use by hardware test routines during service procedures. 

The last few cylinders of the “c” partition are also reserved; on the IBM RT PC, hardware test routines use the last one, and the preceding few cylinders provide the replacement pool for up to 1000 bad sectors.  On the IBM 6152 Academic System, these cylinders provide replacement for up to 100 load sectors. 

In the following structure definitions, Block n refers to the nth block of the “c ” partition.  It should be noted that not all of the following structures make sense in the IBM 6152 Academic System environment. 

The following structures are included from <machineio/hdconfig.h>. 

Block 0

Block 0 is the hard disk IPL record.  It is described by the following structure:

 struct boothdr {
charboot_ibma[4];/∗ 0: IBMA in EBCDIC ∗/
longboot_check;/∗ 4: reserved ∗/
shortboot_lastcyl;/∗ 8: last available cyl number ∗/
charboot_lasttrack;/∗ 10: last track number ∗/
charboot_lastsect;/∗ 11: last sector number ∗/
shortboot_sectorsize;/∗ 12-13: block/sector size (bytes) ∗/
charboot_reserved1[4];/∗ 14-18: reserved ∗/
charboot_interleave;/∗ 19: interleave factor ∗/
charboot_reserved2[3];/∗ 20-23: reserved ∗/
intboot_sectorcount;/∗ 24-27: disk size ∗/
longboot_formatdate;/∗ 28-31: reserved ∗/
shortboot_cyl;/∗ 32-33: cyl number of boot ∗/
charboot_track;/∗ 34: track number of boot ∗/
charboot_sector;/∗ 35: sector to boot ∗/
longboot_length;/∗ 36-39: length in sectors ∗/
longboot_entry;/∗ 40-43: entry point ∗/
longboot_vrmminidisk;/∗ 44-47: block # of vrm minidisk ∗/
longboot_llp;/∗ 48-51: Loadlist processor block # ∗/
longboot_vrmlength;/∗ 52-55: length of VRM minidisk ∗/
charboot_fill[512-56];/∗ reserved ∗/
} ;
 

Block 1

Block 1 is the manufacturer’s configuration sector.  It is described by the following structure:

 struct hdconfig {/∗∗ manufacturers configuration record ∗/
intconf_magic;/∗ 0: always 0xF8E9DACB ∗/
intconf_sectorcount;/∗ 4: number of sectors on device ∗/
shortconf_landing;/∗ 8: reserved ∗/
charconf_interleave;/∗ 10: interleave ∗/
charconf_sectsize;/∗ 11: sectors size 02 = 512 ∗/
shortconf_lastcyl;/∗ 12: last data cylinder ∗/
charconf_lasttrack;/∗ 14: last head number ∗/
charconf_lastsect;/∗ 15: last sector number ∗/
charconf_precomp;/∗ 16: precomp or 0xff ∗/
#define NOPCMP0xff
charconf_status;/∗ 17: used by loadable post ∗/
shortconf_maxcyl;/∗ 18: last physical cyl ∗/
#define conf_ce_cyl conf_maxcyl
shortconf_end_of_life;/∗ 20: max number of defects ∗/
struct seek_curve {
short seek_x;/∗ x position (cylinders?) ∗/
short seek_y;/∗ y position (milliseconds?) ∗/
short seek_slope;/∗ slope millseconds/cylinder?) ∗/
} conf_seek[5];/∗ 22-51: seek curve characteristics ∗/
shortconf_size;/∗ 52-53: approximate # megabytes ∗/
charconf_mfr;/∗ 54: mfr code ∗/
charconf_adapter;/∗ 55: adapter type ∗/
#define HD_ADAPTER_AT0x00
#define HD_ADAPTER_ESDI0x01
#define HD_ADAPTER_HESDI0x02
shortconf_srn;/∗ 56-57: service request num ∗/
charconf_label;/∗ 58: ascii drive type id ∗/
charconf_skew;/∗ 59: head switch sector skewing ∗/
shortconf_hidmax;/∗ 60-61: max # hidden defects ∗/
charconf_fill1[256-62];/∗ fill up to halfway ∗/
charconf_name[8];/∗ 256-263: name of disk (ACIS) ∗/
charconf_fill2[512-264];/∗ fill up to the end ∗/
/∗ 512: total size ∗/
};

Block 8

Block 8 (0,0,9) is the beginning of the bad-block table.  The first 6 bytes contain the word “DEFECT” in ASCII.  This is followed by a short integer containing the number of entries in the table.  Each entry consists of two longs; the first is the logical block number for the bad block and the second is the logical block number for the replacement block.  The following structure may be used to map the bad-block table:

 struct hdbad {
charhddefect[6];/∗ “DEFECT” ∗/
shorthdcount;/∗ count of entries in table ∗/
struct hdmap {
unsigned hdreason:8,/∗ the reason block was unusable ∗/
hdbad:24;/∗ the bad block number ∗/
inthdgood;/∗ the good block number ∗/
} hdmap[ ];/∗ the table of bad to good blocks ∗/
};

Blocks 3-5, (0, 1, 15-17)

These blocks contain the primary and secondary copies of the VRM minidisk table which can be used to define non-standard IBM/4.3 disk partitions.  Any minidisk that has a name of the form “hdxy” where “y” is a letter between “a” and “h”, will be taken as IBM/4.3 partition “y”. 

In addition, a VRM paging minidisk is always taken as a “b” partition.  On the IBM RT PC, if the minidisk table is not valid or if no valid IBM/4.3 partitions are found, then the default partitions as given in disktab(5) are used.  Because of variable size physical partitions on the IBM 6152 Academic System, minidisk information must be initialized and configured before a disk can be used for IBM/4.3.  The minidisk directory has the following format:

 /∗
 ∗ the following defines and structures relate to the VRM
 ∗ minidisk directory
 ∗/
 #define ENDLIST -1/∗ end of list marker ∗/
#define START_BLOCK(sectors)((sectors)∗4)/∗ start of allocatable space ∗/
 struct miniheader {
long number;/∗ number of entries ∗/
long level;/∗ revision level ∗/
short unused;/∗ index of next unused entry ∗/
short lastused;/∗ index of entry most recently used ∗/
short first;/∗ first entry ∗/
short last;/∗ last entry index ∗/
long bad_block;/∗ first bad block ∗/
long bad_size;/∗ number of bad blocks ∗/
long unused2;/∗ reserved ∗/
long unused3;/∗ reserved ∗/
};
 struct minidisk {
short previous;/∗ 0 link to previous entry ∗/
short next;/∗ 2 line to next entry ∗/
char name[4];/∗ 4 name of minidisk ∗/
unsigned :32;/∗ 8 ∗/
long date;/∗ 12 the date of creation ∗/
short iodn;/∗ 16 the IODN used ∗/
#define nextfree iodn/∗ hokey way of doing it! ∗/
char blocksize;/∗ 18 filesystem block size (bits 0-3) ∗/
#define BLOCK_5120
#define BLOCK_10241
#define BLOCK_20483
char type;/∗ 19 type flags ∗/
#define TYPE_WRITEVERIFY0x80/∗ verify writes ∗/
#define TYPE_NOBADBLOCK0x40/∗ no bad block forwarding on this disk ∗/
#define TYPE_PAGE0x20/∗ paging space ∗/
#define TYPE_FILE0x10/∗ AIX file system ∗/
#define TYPE_AIX0x08/∗ AIX system minidisk ∗/
#define TYPE_PC0x04/∗ coprocessor disk ∗/
#define TYPE_VRM0x02/∗ VRM ∗/
#define TYPE_IPL0x01/∗ IPL’able ∗/
long unused;/∗ 20 ∗/
long start;/∗ 24 start block of partition ∗/
long size;/∗ 28 size of partition ∗/
/∗ 32 total length ∗/
};
#define ISFREE(disk) ((disk)->iodn == 0)
 #ifdef KERNEL
#define MAXDISKS 23/∗ keep size down for kernel use ∗/
#else
#define MAXDISKS 47/∗ actual minidisk size ∗/
#endif KERNEL
 #define MINIDISK_BLOCK3/∗ starting block number of minidisk ∗/
#define MINIDISK_BLOCK2(sectors)((sectors)+14)/∗ starting block number of minidisk copy ∗/
#define BLOCK_SIZE512
#define ROUND(a,b) (a+b-1)/b∗b/∗ round up to next unit of b ∗/
 struct minidirectory {
struct miniheader header;
struct minidisk minidisk[MAXDISKS];
};
 

(0,1,18-21)(IBM RT PC EESDI only)

The hidden defect table starts with sector (0,1,18).  This table exists only on "e" disks and on the 310 (hd70e, hd114e, and hd310h.)  Such disks have been formatted so that all but one of their sectors on each track are available for general use.  The last sector is used as a replacement block for the last bad block (if any) on the track.  This organization means that bad blocks no longer cause time consuming seeks over to the high cylinders of the disk and back again.  (Note that more than 1 bad block on a track is a rare event.) 

The first 6 bytes of the table contain the word “HIDDEN” in ASCII.  This is followed by a short integer containing the number of entries in the table.  Each entry consists of the physical cylinder, track, and sector of the hidden bad block.  The implied replacement block is the last sector of the same track as the bad block.  The following structure may be used to map the hidden-defect table:

 struct hdhid {
char hidden[6];/∗ “HIDDEN” ∗/
short count;/∗ # entries in table ∗/
struct hidmap {
unsigned cyl : 16;/∗ hidden bad block cylinder # ∗/
unsigned trk : 8;/∗ hidden bad block track # (head #) ∗/
unsigned sec : 8;/∗ hidden bad block sector # ∗/
} hidmap[510];
} ;
#define IGNORE_HID 0xffffffff/∗ deleted hidmap entry ∗/

The hd(4), sc(4), fd(4), and vd(4) disk drivers support the DKIOCGPART ioctl(2) which returns the partition size and other optional information.  The following structures are included from <machineio/dkio.h>:

 
/∗
 ∗ Structures and definitions for disk io control commands
 ∗
 ∗/
 /∗ disk io partition (and geometry) information format ∗/
 /∗
 ∗ Notes:
 ∗ 1.  dk_size may be less than dk_cyl ∗ dk_track ∗ dk_sector
 ∗since dk_size is the usable size (e.g. what you would specify
 ∗to newfs/mkfs)
 ∗ 2.  everything except dk_size and dk_blocksize are optional - if the
 ∗information isn’t known then zero is returned.
 ∗ 3.  name should be in domain of types in /etc/disktab.
 ∗ 4.  start is starting block of this partition (0=start of disk)
 ∗this could be used by a program to display current disk
 ∗partitioning in a portable fashion.
 ∗/
 #define DK_MAXNAME 16/∗ size of name field ∗/
 struct dkpart {
u_longdk_size;/∗ disk partition size in blocksize units ∗/
/∗  see following word ∗/
u_longdk_blocksize;/∗ block/sector size (in bytes) ∗/
u_longdk_start;/∗ starting block (in blocksize units) ∗/
u_longdk_ncyl;/∗ number of cylinders (if known) ∗/
u_longdk_ntrack;/∗ number of tracks per cylinder (if known) ∗/
u_longdk_nsector;/∗ number of sectors per track (if known) ∗/
chardk_name[DK_MAXNAME];/∗ name of device (if known) (e.g. "hd40r") ∗/
};
 #define DKIOCGPART_IOR(d, 2, struct dkpart)/∗ get partition information ∗/

The minidisk(8R) utility of sautil(8R) may be used to create and modify the minidisk directory and IBM/4.3 partition table.  On the IBM 6152 Academic System, the fdisk(8R) utility of sautil(8R) may be used to create and modify the master fixed disk boot record partition table. 

SEE ALSO

fd(4), hd(4), sc(4), fdisk(8R), format(8R), minidisk(8R), sautil(8R)

“Chapter 12.  IBM Predefined Device Driver--Reserved Cylinders on the Fixed Disk” in IBM RT PC Virtual Resource Manager Technical Reference, SV21-8013

“Chapter 3.  Preparing Your Fixed Disk” in Disk Operating System Version 3.30, 80X0667, First Edition (April 1987). 

PRPQs 5799-WZQ/5799-PFF: IBM/4.3  —  Sept 1988

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026