Boot Record Architecture

From EDM2
Jump to: navigation, search
Storage Device Driver Reference
  1. About This Book
  2. Introduction to DASD, SCSI, and CD-ROM Programming Interfaces
  3. Installation of OS/2, DASD, SCSI, and CD-ROM Device Drivers
  4. Adapter Device Driver Development Considerations
  5. DASD, SCSI, and CD-ROM Device Manager Interface Specification
  6. Error Handling
  7. Adapter Device Driver Command-Line Parameters
  8. DASD IOCtl Device Driver Test Tool
  9. Optical IOCtl Device Driver Test Tool
  10. Using Filter Device Drivers
  11. Library and Services
  12. CD-ROM Device Manager Interface Specification
  13. CD-ROM Device Driver Test Tool
  14. Building an OS/2 Virtual Disk Driver
  15. OS2DASD.DMD - Technical Reference
  16. Boot Record Architecture
  17. Extended Device Driver Interface Specification
  18. I/O Request Block - C Definitions
  19. OS/2 SCSI Device Driver Interface Specification
  20. Advanced SCSI Programming Interface (ASPI) OS/2 Specification
  21. Adapter Device Driver Interface Questions and Answers
  22. Device Driver Test Tool (DDTT)
  23. Glossary

Reprint Courtesy of International Business Machines Corporation, © International Business Machines Corporation

This appendix describes the details of the data that appear on a physical disk. It also describes the structures that are placed on the disk by various utilities.

Master Boot Record

The master boot record is always located on sector 1 of the first track (track 0) on the disk. The following table shows the layout of the various components inside the Master Boot Record. The various components are described below.

Offset Description Size
+0 Master Boot Record Program 446 bytes
+446 Partition Table 64 bytes
+510 Signature (55AAH) 2 bytes
Master Boot Record Program
This code is given control from BIOS during boot. Its function is to load the operating system's boot program from the partition that was marked as being startable and turn control over to the ( assumed) code that was loaded.

The Master Boot Record Program may be placed on the disk by individual operating systems. If the signature in the Master Boot Record is valid, then the Master Boot Record Program must not be modified. Operating systems must not place requirements on nor make assumptions about the Master Boot Record Program.

Partition Table
This is a vector of 4 structures that allows the disk to be divided up into four distinct areas or partitions. The following table shows how they are arranged in this vector.
Offset Description Size
0 Partition 1 16 bytes
16 Partition 2 16 bytes
32 Partition 3 16 bytes
48 Partition 4 16 bytes

It is up to an individual operating system if one of those parts is to be further sub-divided. For example, DOS Version 3.30 implemented a scheme where an "extended partition"; could be used to define logical disks to allow the use of larger hardfiles.

The following table shows the format of the individual entries in the partition table. A description of the individual fields follows.

Offset Description 0 1 2 3
+0 Partion Start Boot Indicator Head Sector Cylinder
+4 Partion End System Indicator Head Sector Cylinder
+8 Offset from start of disk (sectors) Low Word High Word
+12 Partion Length (sectors) Low Word High Word
Partition Start
This 4 byte field identifies the beginning of a partition. It also contains an indicator that flags the partition as being active or bootable. This field is composed of several bytes defined as follows.
Boot Indicator
This byte indicates if the partition is active. If the byte contains 00H, then the partition is not active and will not be considered as bootable by the Master Boot Record Boot Program. If the byte contains 80H, then the partition is considered active. The Master Boot Record Boot Program will then attempt to load the first sector described by this partition table entry and transfer control to it. The Master Boot Record Boot Program should only attempt to boot the first partition it finds that is marked active.
Head
This byte contains the number of the first head of the partition.
All partitions are allocated in cylinder multiples and begin on sector 1, head 0.
EXCEPTION: The partition that is allocated at the beginning of the disk should start at cylinder 0, head 1, sector 1, to leave room for the disk's master boot record and other information used to define the fixed disk type on that system. An operating system should not use any data space on cylinder 0 head 0 of a fixed disk.
Sector
This byte contains the sector number of the first sector of the partition. This value should always be 1 (sector numbers are 1 based) for the Partition Begin field because partitions are defined to start on cylinder boundaries. Note that the sector number byte also contains the high order 2 bits of the cylinder number in the high order 2 bits of this byte. Therefore, this byte can have values other than one, but the sector bits of this byte always contains the value 1.
Cylinder
This byte contains the low order 8 bits of the 10 bit cylinder number that indicates the starting cylinder of the partition.
Partition End
This 4 byte field identifies the end of the partition. It also contains an indicator as to which operating system owns the partition. This field is composed of several bytes that are defined as follows.
System Indicator
This byte indicates what operating system owns the particular partition. The values and what they represent are listed in Fixed Disk Partition ID Assignments. A value of 0 indicates an unused entry.
Head
This byte contains the last head number in the last cylinder occupied by this partition.
Sector
This byte contains the sector number of the last sector on the last cylinder occupied by this partition. It also contains the high order two bits of the cylinder number in the high two bits of this byte.
Cylinder
This byte contains the low order 8 bits of the 10-bit cylinder number that indicates the ending cylinder of this partition.
Offset from Start of Disk
This 4-byte field contains the number of sectors preceding each partition on the disk. The value is obtained by counting the sectors beginning with cylinder 0, sector 1, head 0 of the disk, and incrementing the sector, head, and then cylinder values up to the beginning of the partition. Thus, if the disk has 17 sectors per track and 4 heads, and the second partition begins at cylinder 1, sector 1, head 0, the partition's starting relative sector is 68 (decimal)-there were 17 sectors on each of 4 heads on 1 track allocated ahead of it. The field is stored with the least significant word first.
Partition Length
This 4 byte field contains the number of sectors allocated to the partition. This field is stored least significant word first.
Signature
The last 2 bytes of the boot record (55AAH) are used as a signature to identify a valid boot record containing code that is executable on Intel X86 processors. Both this record and the partition boot records are required to contain the signature at offset 01FEH (510).

Fixed Disk Technical Information

A fixed disk boot record must be written on the first sector of all fixed disks or logical drives within an extended partition and must contain:

  • Code to load and give control to the boot record for one of four possible operating systems.
  • A partition table at the specified offset into the boot record. Each table entry is 16 bytes long, and contains the starting and ending cylinder, sector, and head for each of four possible partitions, as well as the number of sectors preceding the partition and the number of sectors occupied by the partition. The "boot indicator" byte is used by the boot record to determine if one of the partitions contains a loadable operating system. FDISK (or equivalent) initialization utilities mark a user-selected partition as "startable" by placing a value of 80h in the corresponding partition's boot indicator (setting all other partition's indicators to 00h at the same time). The presence of the 80h tells the Master Boot Record Program to load the sector whose location is contained in the following 3 bytes. That sector is the actual boot record for the selected operating system, and it is responsible for the remainder of the system's loading process (as it is from diskette). All boot records are loaded at absolute address 0:7C00.
  • A Signature to indicate a valid Master Boot Record.

System Initialization

The System initialization (or system boot) sequence is as follows:

  1. System initialization first attempts to load an operating system from the first diskette drive. If the drive is not ready or a read error occurs, it then attempts to read the fixed disk master boot record from the first sector of the first fixed disk on the system. If unsuccessful, or if no fixed disk is present, it invokes a device, ROM BASIC or prompts for a startable diskette.
  2. If successful, the master boot record is given control. It examines the partition table imbedded within it. If one of the entries indicates a "startable" (active) partition, its boot record is read (from the partition's first sector) and give control.
  3. If none of the partitions is startable, a RIPL device or ROM BASIC is invoked or a prompt for a bootable diskette is displayed.
  4. If any of the boot indicators are invalid (values other than 00h or 80h) the message Invalid partition table is displayed and the system stops. You may then insert a system diskette in drive A and use system reset to restart from diskette.
  5. If the partition's boot record cannot be successfully read within five retries due to read errors, the message Error loading operating system appears and the system stops.
  6. If the partition's boot record does not contain a valid "signature", the message Missing operating system appears, and the system stops.

When a partition's boot record is given control, it has passed its partition table entry address in the DS:SI registers.

System programmers designing a utility to initialize/manage a fixed disk must provide the following functions at a minimum:

  1. Write the master disk boot record/partition table to the disk's first sector to initialize it if it is not already present.
  2. Perform partitioning of the disk-that is, create or update partition table information (all fields for the partition) when the user wishes to create, modify, or remove a partition. This may be limited to creating a partition for only one type of operating system, but must allow repartitioning the entire disk, or adding a partition without interfering with existing partitions (user's choice).

    Note: When changing the size or location of any partition, you must ensure that all existing data on that partition has been backed up (the partitioning process will "lose track" of the previous partition boundaries).
  3. Provide a means for marking a user-specified partition as startable, and resetting the startable indicator bytes for other partitions at the same time.
  4. Such utilities should not change or move any partition information that belongs to another operating system.

Fixed Disk Partition ID Assignments

Partition Description
00 Unused Partition
01 DOS, 12-bit FAT
03 XENIX User, includes SCO/XENIX
04 DOS, 16-bit FAT
05 DOS and OS/2, >32MB support; defines an Extended partition which may include other partition types.
06 DOS, >32MB support, up to 64K Allocation unit
07 OS/2, >32MB partition support (IFS)
08 OS/2 (thru Version 1.3 only)
08 DELL partition spanning multiple drives (array)
08 Commodore DOS Partition
09 AIX
0A OS/2 Boot Manager Partition
0B - 0D Available for assignment
0E - 0F Reserved
10 Reserved
11 OS/2 Boot Manager: DOS - Inactive type 1
12 Reserved
13 Available for assignment
14 OS/2 Boot Manager: DOS - Inactive type 4
15 Available for assignment
16 OS/2 Boot Manager: DOS - Inactive type 6
17 OS/2 Boot Manager: DOS - Inactive type 7
18 - 20 Available for assignment
21 Reserved
22 Available for assignment
23 - 24 Reserved
25 Available for assignment
26 Reserved
27 - 30 Available for assignment
31 Reserved
32 Available for assignment
33 - 34 Reserved
35 Available for assignment
36 Reserved
37 - 3F Available for assignment
41 Personal RISC Boot Partition
42 - 4F Available for assignment
50 OnTrack Disk Manager
51 OnTrack Disk Manager
52 Reserved
53 - 55 Available for assignment
56 Reserved
57 - 60 Available for assignment
61 Reserved
62 Available for assignment
64 Speedstore
65 Novell 286 Netware
66 Novell 386 Netware
67 Novell (future use)
68 Novell (future use)
69 Novell (future use)
6A - 70 Available for assignment
71 Reserved
72 Available for assignment
73 - 74 Reserved
75 PC/IX
76 Reserved
77 - 79 Available for assignment
80 - 81 Reserved
82 Prime
85 - 85 Available for assignment
86 Reserved
87 HPFS FT mirrored partition
88 - 92 Available for assignment
93 - 94 Reserved
95 - A0 Available for assignment
A1 Reserved
A2 Available for assignment
A3 - A4 Reserved
A5 Available for assignment
A6 Reserved
A7 - B0 Available for assignment
B1 Reserved
B2 Available for assignment
B3 - B4 Reserved
B5 Available for assignment
B6 - B8 Reserved
B9 - C0 Available for assignment
C1 Reserved
C2 - C3 Available for assignment
C4 Reserved
C5 Available for assignment
C6 Reserved
C7 HPFS FT disabled mirrored partition
C8 - D7 Available for assignment
D8 CP/M 86
D9 - DA Available for assignment
DB Reserved
DC - E0 Available for assignment
E1 Speedstore
E2 Available for assignment
E3 Storage Dimensions (Maxtor Retail Subsidiary)
E4 Speedstore
E5 - E6 Reserved
E7 - F0 Available for assignment
F1 Storage Dimensions (Maxtor Retail subsidiary)
F2 - F3 Reserved
F4 Storage Dimensions (Maxtor Retail subsidiary)
F5 Available for assignment
F6 Reserved
F7 - FD Available for assignment
FE IBM PS/2 IML
FF Bad Block Tables - Must be on cylinder 0

Extended DOS Partition

Fixed disks can be divided into primary partitions, and an extended partition that contains multiple logical block devices. The extended partition is indicated by a System ID byte of 05h in the partition table of the Master Boot Record. This partition cannot be started, and programs that can set startable partitions (such as OS/2 FDISK) do not allow the partition to be marked as able to start.

The extended DOS partition can be created only if a primary DOS partition already exists on a startable drive. A primary partition is a partition with a System ID byte of 01h, 04h, 06h, or 07h. If the drive cannot be started, then an extended DOS partition can be created without having a primary DOS partition.

Note:

  1. FDISK refers to extended volumes as logical drives.
  2. This extended partition support can be used on any fixed disk supported by the OS/2 operating system.

The extended DOS partition starts and ends on a cylinder boundary, and contains a collection of extended volumes that are linked together by a pointer in the extended volumes' extended boot record. An extended volume consists of an extended boot record and one logical block device. In OS/2 Version 1.0, an extended volume could not be larger than 32MB, due to the limitations of the FAT file system. However, in OS/2 2.0 and 2.1, this restriction has been removed. An extended volume created within the extended DOS partition can be any size, from one cylinder long through the maximum available contiguous space in the extended DOS partition. All extended volumes must start and end on a cylinder boundary. The extended boot record corresponds to the Master Boot Record at the beginning of an actual physical disk. The logical block device corresponds to the DOS partition that is pointed to by the Master Boot Record.

The logical block device begins with a normal DOS boot sector if it is a DOS logical block device (System ID=1, 4, or 6). Installable File System (IFS) logical block devices (System ID=7) need not start with a normal DOS boot sector. This logical block device must start on a cylinder and head boundary and must follow the extended boot record on the physical disk. The logical block device and the extended volume both end on the same cylinder boundary.

Each extended volume contains an extended boot record located in the first sector of the disk location assigned to it. This extended boot record contains the 55AAh signature ID byte. This allows programs that look at the Extended (Master) Boot Record to be compatible. This extended boot record also contains a partition table, which can contain only two types of entries. The boot code is not critical, as the devices are not considered startable. The boot code can simply report a message indicating an unstartable partition if it is executed.

The partition table portion of the extended boot record is the same as the partition table structure in the Master Boot Record. This structure has four partition entries of 16 bytes each. The System ID byte must be filled in for all four entries with one of the following values:

00h No space allocated in this entry.
01h DOS partition up to 16MB.
04h DOS partition with 32MB > SIZE > 16MB.
05h Maps out area assigned to the next extended volume. Serves as a pointer to the next extended boot record.
06h DOS partition size > 32MB.
07h Installable file system.

If the System ID byte is 0, then the values in that partition table entry are set to 0. If the operating system detects any values other than 01h, 04h, 06h, or 07h, it ignores that entry and does not attempt to install the logical block device. This allows future expansion of devices in this area without problems of compatibility with earlier systems.

The partition start and end fields Cylinder, Head, and Sector (C,H,S) are filled in for any of the four partition entries in an extended boot record that have one of the System ID bytes. This allows a program such as FDISK to determine the allocated space in the extended DOS partition, and allows the physical device drivers to determine the physical DASD area that belongs to it. The partition start and end fields (C,H,S) for the partition entry that points to the logical block device (System ID 01h, 04h , 06h, or 07h) map out the physical boundaries of the logical block device. They are offset relative to the beginning of the extended boot record that the entry resides in. The partition start and end fields for the partition entry that points to the next extended volume (System ID 05h) map out the physical boundaries of the next extended volume. They are relative to the beginning of the entire physical disk.

The relative sector and number of sector fields are set up differently depending on what System ID byte is used. If 01h, 04h, 06h, or 07h is in the System ID field for that extended partition entry (pointer to the logical block device), the relative sector field is set up as an offset from (and including) the start of the extended boot record for the associated extended volume. The number of sectors field is filled in with the size of the created logical block device area (that is, the number of sectors mapped out by the start and stop cylinder/track/sector fields). The size of the extended volume can be calculated by adding the relative sector field and the sector size field of the associated extended boot record.

If the System ID byte is 05h, then the relative sector field is the offset (of the next extended volume) in sectors from the start of the entire extended DOS partition The number of sectors field is not used in this field, and is filled with 00hs.

This architecture allows only one logical block device to be defined for each extended boot record. Therefore, a maximum of two partition entries at a time is used in each extended boot record - an entry with System ID byte of 01h, 04h, 06h, or 07h, and an entry with ID of 05h (which is the pointer to the next extended volume).

Although only two entries can be used, a program installing these devices does not assume that the first two entries will be the non-zero entries.

Installing Block Devices in the Extended DOS Partition

To install block devices, physical device drivers first install the primary DOS partitions on all physical drives, if any exist. This ensures that an existing drive letter, D:, on the 81h drive remains the same. After these devices are installed on the 80h drive, the drivers look for the existence of the extended DOS partition. If one exists, then the physical device drivers look at the first sector of the extended DOS partition for the first extended boot record. If there is a valid System ID (01h, 04h, 06h, or 07h) in any of the four partition entries, the device is installed and assigned the next available drive letter. This occurs before any CONFIG. SYS device drivers are loaded, so the FDISK will correctly display the drive letter when space is allocated for the drive.

The first extended boot record (in the extended DOS partition) is a special case, because it is possible there will not be a device to be installed defined in the partition table. The first device might have been created and then deleted at some time. However, the first extended boot record is needed to point to the next one, if one exists. Any other extended boot record will always have a device to be installed.

Once a device has been installed (or the special cases above occur), the physical device driver searches the other partition entries for a System ID byte of 05h, indicating that another device (extended volume) exists. If a 05h is not found, there are no more logical block devices (extended volumes) in the extended DOS partition.

If a 05h System ID is found, the start location in that partition entry is read in order to find the location of the next extended boot record. When located, it is read in, and then the process is repeated in order to install additional devices.

Once all the valid devices for a physical drive have been installed, the next physical drive is examined and the entire process is repeated.

A device driver does not assume any order dependency when searching for a particular System ID byte in an extended boot record. All four possible entries in an extended boot record partition table are searched, before a driver decides that a particular System ID byte does not exist.

The extended DOS partition can only be created if a primary DOS or IFS partition already exists on a bootable drive. A primary DOS partition has a System ID of 01h, 04h, or 06h. A primary IFS partition has a System ID of 07h. If the drive is not bootable, an extended DOS partition can be created without having a primary DOS partition. The extended DOS partition starts and ends on a cylinder boundary.

Creating Block Devices in the Extended DOS Partition

To create the structure for an extended volume in the extended DOS partition, FDISK determines if there is available space in the extended DOS partition and if less than 24 total devices are allocated in the system. The maximum number of block devices allowed is 26, and two are used by diskettes, A: and B:. The program then creates an extended boot record at the space located, with a partition entry filled in (with the size and location information) for that logical block device. If this is not the first extended boot record, the program backs up to the last extended boot record in the chain (as linked by the 05h entries), and creates a partition entry in that extended boot record that has the size and location data for the newly created record. This action creates the pointer required to locate the newly created boot record.

If this is the first extended boot record in the extended DOS partition only the size, type, and location of the logical block device needs to be put into a partition entry. The start of the extended DOS partition in the Master Boot Record serves as a pointer to this extended volume.

Deleting Block Devices in the Extended DOS Partition

To delete a block device, the program sets the 16-byte partition entry that contained the System ID byte, to 0. If in the same extended boot record there exists a partition entry with System ID of 05h, indicating that another extended volume exists, this information is copied to the 05h partition entry of the previous extended boot record. (See the following figure for further information.)

Note: There is one exception to this rule. If the deleted logical block device is at the beginning of the extended DOS partition, only the partition entry indicating the device type is set to 0. The 05h pointer information is to be left in place.

          /-------------------------------------\
          |  Master Boot Record......Note 1.... |
          |..................../----------------|
          |............Note 2 �|4 |2 |5 |0 |55AA|  Note 3
          |-------------------------------------|
          | Primary DOS Partition Note 4        |
          |    DOS C: drive  32MB � Size        |
          |-------------------------------------|
          |   Other Operating System Partition  |
          |            (XENIX)    Note 5        |     E
 E   /--  |-------------------------------------| --\ x
 x   |    | Extended Boot Record..Note 6........|   | t
 t   |    |..................../----------------|   |
     |    |............Note 7 �|4 |5 |0 |0 |55AA|   | V
 D   |    |-------------------------------------|   | o
 O   |    | LOGICAL Block Device D:      Note 8 |   | l
 S   |    | 32MB � Size � 16MB or IFS           |   | u
     |    |-------------------------------------| --/ m
 P   |    | Extended Boot Record..Note 9........|     e
 a   |    |..................../----------------|
 r   |    |...........Note 10 �|1 |5 |0 |0 |55AA|
 t   |    |-------------------------------------|
 i   |    | LOGICAL Block Device E:             |
 t   |    | Size � 16MB                         |
 i   |    |-------------------------------------|
 o   |    | Extended Boot Record................|
 n   |    |..................../----------------|
     |    |...........Note 11 �|6 |5 |0 |0 |55AA|
     |    |-------------------------------------|
     |    | Area reserved for future CP/DOS use |
     |    |           Note 12                   |
     |    |-------------------------------------|
     |    | Extended Boot Record................|
     |    |..................../----------------|
     |    |...........Note 13 �|4 |0 |0 |0 |55AA|
     |    |-------------------------------------|
     |    | LOGICAL Block Device G:             |
     |    | 32MB � Size � 16MB                  |
     |    |-------------------------------------|
     |    | Free Space in Extended Partition    |
     \--  |-------------------------------------|
          | Free Space not allocated to any     |
          | partition                           |
          \-------------------------------------/
Note 1
Master Boot Record code, starting at Track 000, Head 00, Sector 01 of disk 80h or 81h.
Note 2
Partition table for Master Boot Record. See BPB and Get Device Parameters for Extended Volumes for the layout. The 4 is the System ID byte in the partition table that indicates a DOS partition greater than 16MB and less than or equal to 32MB. The 2 is a XENIX XENIX** partition, and the 05h maps the extended DOS partition.
Note 3
55AAh is the signature to validate the Master Boot Record.
Note 4
Primary DOS area, which must reside entirely in first 32MB of the disk. C: is block device 80h. D: is block device 81h, if it exists. This partition has a maximum size of 32MB.
Note 5
Other operating system on disk.
Note 6
Extended boot record for extended volume that corresponds to logical block device D:. (This assumes only the 80h block device exists.) If the 81h block device exists, this would be block device E:.
Note 7
Logical block device D: partition table entry. This has a maximum size of 32MB, which is indicated by the System ID of 4. This must set the logical DOS block device as starting at the next track boundary. The 05h System ID byte in the second partition entry maps out the space allocated to the next extended volume. The starting cylinder/sector/head in the partition entry with an ID of 05h is the location of the next extended boot record of the next extended volume.
Note 8
Logical block device D:. Logical DOS devices and the primary DOS partition always begin with a DOS boot record.
Note 9
Extended boot record for logical block device E:.
Note 10
Partition table entry for logical block device E:. This logical DOS block device is less than or equal to 16MB, as indicated by the System ID of 01h. The entry with System ID of 05h maps out the space allocated to the next extended volume.
Note 11
The System ID byte of 06h indicates a logical block device greater than 32MB. This block device is indicated by a block device letter of F. Note also that a pointer to the next extended volume exists.
Note 12
The greater than 32MB FAT partition.
Note 13
Partition table entry for final DOS logical block device. Note that the absence of the 05h ID byte means that there are no other extended volumes allocated in the extended DOS partition. This would have a block device letter of G:, if the previous logical block device was recognized. Otherwise, it would be F:.
Offs Purpose                             Head  Sector  Cylinder
                             /---------------------------------\
1BE Partition 1 begin        | boot ind |  H  |  S  |   CYL    |
                             |----------+-----+-----+----------|
1C2 Partition 1 end          | syst ind |  H  |  S  |   CYL    |
                             |----------------+----------------|
1C6 Partition 1 rel sect     | Low word       | High word      | 
                             |----------------+----------------|
1CA Partition 1 #sects       | Low word       | High word      |
                             |----------------+----------------|
1CE Partition 2 begin        | boot ind |  H  |  S  |   CYL    |
                             |----------+-----+-----+----------|
1D2 Partition 2 end          | syst ind |  H  |  S  |   CYL    |
                             |----------------+----------------|
1D6 Partition 2 rel sect     | Low word       | High word      | 
                             |----------------+----------------| 
1DA Partition 2 #sects       | Low word       | High word      | 
                             |----------------+----------------|
1DE Partition 3 begin        | boot ind |  H  |  S  |   CYL    |
                             |----------+-----+-----+----------| 
1E2 Partition 3 end          | syst ind |  H  |  S  |   CYL    | 
                             |----------------+----------------|
1E6 Partition 3 rel sect     | Low word       | High word      |
                             |----------------+----------------|
1EA Partition 3 #sects       | Low word       | High word      | 
                             |----------------+----------------|
1EE Partition 4 begin        | boot ind |  H  |  S  |   CYL    |
                             |----------+-----+-----+----------|
1F2 Partition 4 end          | syst ind |  H  |  S  |   CYL    |
                             |----------------+----------------|
1F6 Partition 4 rel sect     | Low word       | High word      |
                             |----------------+----------------|
1FA Partition 4 #sects       | Low word       | High word      |
                             |----------------+----------------/
1FE Signature                |                | 
                             \----------------/

BPB and Get Device Parameters for Extended Volumes

For purposes of the BIOS Parameter Block (BPB) and Get Device Parameters (generic IOCtl), an extended volume appears to the system as a fixed disk. The extended boot record corresponds to the Master Boot Record of a real fixed disk and the logical block device corresponds to the primary DOS partition.

This means the BPB of the logical DOS block device of the extended volume describes the environment in the extended volume. This consists of the extended boot record and the logical block device. The meaning of the fields is consistent with the meaning of the fields for the primary DOS partition; they relate to the entire physical disk, the primary DOS partition, and the Master Boot Record. For example, the number of hidden sectors is the distance from the beginning of the extended boot record (of the extended volume in question) to the start of the logical DOS block device (the DOS Boot Record). The number of sectors field describes only the logical block device, just as it normally only describes the primary DOS partition.

Category 08h Generic IOCtl Commands

The philosophy described above also applies to the disk generic IOCtl commands. For any logical block device of an associated extended volume, physical cylinder, head, and sector I/O is mapped to within the extended volume - Cylinder 0, Head 0, Sector 1 is mapped to the extended boot record. An error condition is generated for any attempt to do C,H,S I/O beyond the size of the extended volume in question.

Category 09h Generic IOCtl Commands

Category 09h generic IOCtl commands are used to access the entire physical fixed disk without consideration of logical volumes. Physical cylinder, head, and sector begin at the start of the physical drive, instead of at the beginning of an extended volume.

Type 6 Partition

A 12-bit or 16-bit type FAT can be used to map a Type 6 partition because the type of FAT is based strictly on the number of allocation units ( clusters), and is the same algorithm used to define the type of FAT in the OS/2 Version 1.0 operating system. FAT cluster sizes are based on powers of 2. Assuming usage of the OS/2 FORMAT utility, the minimum cluster size for a hard file is 2KB. Cluster size and the type of FAT (12-bit verses 16 -bit) are determined by the media partition size. The OS/2 FORMAT algorithm is:

If partition size =<16MB
then;
     use 12-bit FAT;               /* max 4084 entries    */
     max cluster size = 4KB;
end;
else;                             /* partition size >16MB */
     use 16-bit FAT;              /* max 64KB entries     */
     min cluster size = 2KB;
end;

The actual determination of the partition type is made based on the number of clusters on that partition. OS/2 FORMAT makes sure that this is true for the <16MB and >16MB partitions.

If number of clusters <= 4084
     use 12-bit FAT;              /* max 4084 entries  */
else
     use 16-bit FAT;              /* max 64KB entries  */

A partition size of 128MB requires a 2KB cluster size, based on a maximum of 64KB allocation units (clusters). A partition size in the range of 129MB and 256MB requires a 4KB cluster size, based on 64KB allocation units. A partition size in the range of 257MB and 512MB requires an 8KB cluster size, based on 64KB allocation units.

The configuration table used by OS/2 FORMAT is show in the following table:

Total # of Sectors Size of Partition Sector Cluster # of Root DIR Entries
32K 16MB 8 512
64K 32MB 4 512
256K 128MB 4 512
512K 256MB 8 512
1M 512MB 16 512
2M 1GB 32 512
4M 2GB 64 512
8M 4GB 128 512

Note: For Type 6 partitions, it is safe to use a non-default configuration, but this might be unsafe for other partition types.

The partition can reside anywhere on the media, as the primary DOS partition, or as an extended volume within the extended DOS partition. The BPB parameter number of sectors per FAT field width has been extended from a byte to a WORD, in order to define a full 128KB FAT structure. This change affects all DOS partition types.

Layout of Block Devices with a Type 6 Partition Using XENIX

 |  Master Startup Record...Note 1.... |
 |..................../----------------|
 |...........Note 2 � |2 |6 |0 |0 |55AA|  Note 3
 |-------------------------------------|
 |   Other Operating System Partition  |
 |          (XENIX)                    |
 |     Size � 32MB  Note 4             |
 |-------------------------------------|
 | Primary DOS Partition Note 5        |
 |    DOS C: drive  32MB � Size        |
 |-------------------------------------|
 |             Free Space              |
 |  (not allocated to any partition)   |
Note 1
Master Startup (Boot) Record code, starting at Track 000, Head 00, Sector 01 of disk 80h or 81h.
Note 2
Partition table for Master Startup (Boot) Record. The 2 is the System ID byte in the partition table that indicates a XENIX partition, and the 06h map indicates a primary DOS Type 6 partition.
Note 3
55AAH is the signature to validate the Master Startup (Boot) Record.
Note 4
Other operating system (XENIX) on disk.
Note 5
Primary DOS partition. C: is block device 80h. The partition type in this example is a 6, because it ends beyond the first 32MB of the disk. Within the scope of this definition, though the size of a primary DOS partition can be less than 32MB (because it ends beyond the first 32MB of the disk), it is defined as a Type 6.

Layout of Block Devices with a Type 6 Partition

 |  Master Startup Record...Note 1.... |
 |..................../----------------|
 |...........Note 2 � |6 |0 |0 |0 |55AA|  Note 3
 |-------------------------------------|
 | Primary DOS Partition Note 4
 |    DOS C: drive  Size � 32MB
Note 1
Master Startup (Boot) Record code, starting at Track 000, Head 00, Sector 01 of disk 80h or 81h.
Note 2
Partition table for Master Boot Record. The 6 is the System ID byte in the partition table that indicates a DOS partition where SIZE > 32MB.
Note 3
55AAh is the signature to validate the Master Startup (Boot) Record.
Note 4
Primary DOS area. Owns the entire media and exceeds 32MB in size. C: is block device 80h.

Type 7 Partition

Partition Type 7 is used for Installable File Systems only. The internal FAT file system should not use this partition type because older versions of the DOS and OS/2 operating systems will not be able to access the partition.