[comp.sys.ibm.pc] Wanted: format of disk partition table

ballou@brahms.Berkeley.EDU (Kenneth R. Ballou) (11/10/87)

Would anyone please be able to tell me the format and location of the disk
partition table for an AT hard disk?  Alternatively, could anyone please
suggest references for this information?  (I suspect such a reference might
also contain much other information that would also be very interesting!)

Please respond by e-mail; I will summarize whatever information I receive and
post accordingly.

Thanks!
Kenneth R. Ballou			ARPA:  ballou@brahms.berkeley.edu
Department of Mathematics		UUCP:  ...!ucbvax!brahms!ballou
University of California
Berkeley, California  94720

everett@hpcvlo.HP.COM (Everett Kaser) (11/13/87)

According to appendix B of the book "Writing MS-DOS Device Drivers" by
Robert S. Lai, published by Addison-Wesley Publishing Company at $24.95:

Copyright (c) 1987 by the Waite Group, Inc.
All rights reserved.

  The partition sector is the first sector of the hard disk....
  The partition sector contains three parts.  The first is the partition
  program code, which is responsible for determining the active partition.
  The second is the table of partition information.  Finally, the last part
  is a marker for the end of the partition secotr.  The marker is a hex
  AA55 that indicates that the partition sector is valid.
  When a PC with a hard disk is booted...the partition code is first brought
  into memory to dtermine whicgh of the partitions is active.  Then the 
  boot code from the active partition is read...and control is passed to the
  bootstrap code.
  The partition table contains four 16-byte entries and is located at offset
  446 from the beginning of the partition sector.  Each entry describes a
  particular partition.  The format for the partition table entry is described
  in table D-1.

     START        LENGTH          DESCRIPTION
       0            1         Active Partition Indicator
       1            1         Beginning head number
       2            1         Beginning sector number
       3            1         Beginning cylinder number
       4            1         DOS system indicator
       5            1         Ending head number
       6            1         Ending sector number
       7            1         Ending cylinder number
       8            4         Relative sector (from beginning of disk)
      12            4         Total size of partition in sectors

  The active partition indicator is a single byte that describes whether the
  partition is an active partition or not.  A value of 00h indicates that the
  partition is not active, and a value of 80h indicates that the partition is
  an active partition.  The DOS system indicator contains a value that
  determines whether the operating system for the partition is DOS or some
  other operating system.  A value of 80h indicates the partition is a DOS
  partition.  A value of 00h indicates the partition is a non-DOS partition.
  The relative sector is a double word that contains the number of sectors
  from the the beginning of the disk to the start of the partition.  For any
  partition this is the sum of the total disk space of all preceding partitions
  plus 1 for the partition sector.  This number is also known as the number
  of hidden sectors for a given partition.

This is a very good book on MS-DOS device drivers and I recommend it to anyone
interrested in writing such.

Everett Kaser
Hewlett-Packard Co.
Corvallis, OR