Alasir Enterprises
Main Page >  Motley >  MicroHouse PC Hardware Library Volume I: Hard Drives  

 
Previous Table of Contents Next

 
During partitioning, no matter what file system is specified, the partitioning software writes a special boot program and partition table to the first sector, called the Master Boot Sector (MBS). Because the term record sometimes is used to mean sector, this sector can also be called the Master Boot Record (MBR).

FDISK

The DOS FDISK program is the accepted standard for partitioning hard disks. Partitioning prepares the boot sector of the disk in such a way that the DOS FORMAT program can operate correctly. It also enables different operating systems to coexist on a single hard disk.

If a disk is set up with two or more partitions, FDISK shows only two total DOS partitions: the primary partition and the extended partition. The extended partition then is divided into logical DOS volumes, which are partitions themselves. FDISK gives a false impression of how the partitioning is done. FDISK reports that a disk divided as C, D, E, and F is set up as two partitions, with a primary partition having a volume designator of C and a single extended partition containing logical DOS volumes D, E, and F. But in the real structure of the disk, each logical DOS volume is a separate partition with an extended partition boot sector describing it. Each drive volume constitutes a separate partition on the disk, and the partitions point to one another in a daisy-chain arrangement.

The minimum size for a partition in any version of DOS is one cylinder; however, FDISK in DOS 4 and later versions allocates partitions in megabytes, meaning that the minimum-size partition is 1MB.

FDISK Undocumented Functions

FDISK is a very powerful program, and in DOS 5 and later versions, it gained some additional capabilities. Unfortunately, these capabilities were never documented in the DOS manual and remain undocumented even in DOS 7. The most important undocumented parameter in FDISK is the /MBR (Master Boot Record) parameter, which causes FDISK to rewrite the Master Boot Sector code area, leaving the partition tables intact.


Caution:
/MBR will overwrite the partition tables if the two signature bytes at the end of the sector (55AAh) are damaged. This situation is highly unlikely, however. In fact, if these signature bytes were damaged, you would know; the system would not boot and would act as though there were no partitions at all.

The /MBR parameter seems to be tailor-made for eliminating boot-sector virus programs that infect the Master Partition Boot Sector (Cylinder 0, Head 0, Sector 1) of a hard disk. To use this feature, you simply enter FDISK /MBR

FDISK then rewrites the boot sector code, leaving the partition tables intact. This should not cause any problems on a normally functioning system, but just in case, I recommend backing up the partition table information to floppy disk before trying it. You can do this with the following command:

   MIRROR /PARTN

This procedure uses the MIRROR command to store partition-table information in a file called PARTNSAV.FIL, which should be stored on a floppy disk for safekeeping. To restore the complete partition-table information, including all the master and extended partition boot sectors, you would use the UNFORMAT command as follows:

   UNFORMAT /PARTN

This procedure causes the UNFORMAT command to ask for the floppy disk containing the PARTNSAV.FIL file and then to restore that file to the hard disk. Note that if you are using Windows 95, the MIRROR and UNFORMAT programs have been eliminated, and you will have to purchase Norton Utilities instead.

FDISK also has three other undocumented parameters: /PRI, /EXT, and /LOG. These parameters can be used to have FDISK create master and extended partitions, as well as logical DOS volumes in the extended partition, directly from the command line rather than through the FDISK menus. This feature was designed so that you can run FDISK in a batch file to partition drives automatically. Some system vendors probably use these parameters (if they know about them, that is!) when setting up systems on the production line. Other than that, these parameters have little use for a normal user and, in fact, may be dangerous!

High-Level (Operating-System) Format

The final step in the software preparation of a hard disk is the DOS high-level format. The primary function of the high-level format is to create a FAT and a directory system on the disk so that DOS can manage files.

Usually, you perform the high-level format with the standard DOS FORMAT program, using the following syntax:

   FORMAT C: /S /V

This step high-level formats drive C (or volume C, in a multivolume drive), places the hidden operating-system files in the first part of this partition, and prompts for the entry of a volume label to be stored on the disk at completion.

The high-level format program performs the following functions and procedures:

1.  Scans the disk (read-only) for tracks and sectors marked as bad during the LLF, and notes these tracks as being unreadable.
 
2.  Returns the drive heads to the first cylinder of the partition and, at that Cylinder 1, Head 1, Sector 1, writes a DOS volume boot sector.
 
3.  Writes a FAT at Head 1, Sector 2. Immediately after this FAT, it writes a second copy of the FAT. These FATs essentially are blank except for bad-cluster marks noting areas of the disk that were found to be unreadable during the marked-defect scan.
 
4.  Writes a blank root directory.
 
5.  If the /S parameter is specified, copies the system files (IBMBIO.COM and IBMDOS.COM or IO.SYS and MSDOS.SYS, depending on which DOS you run) and COMMAND.COM files to the disk (in that order).
 
6.  If the /V parameter is specified, prompts the user for a volume label, which is written as the fourth file entry in the root directory.

Now DOS can use the disk for storing and retrieving files, and the disk is a bootable disk.


Note:
The FORMAT command can be run through the Windows Explorer within Windows 95 even on hard disks, as long as no files are open. You cannot format the drive where Windows 95 resides.

During the first phase of the high-level format, a marked defect scan is performed. Defects marked by the LLF operation show up during this scan as being unreadable tracks or sectors. When the high-level format encounters one of these areas, it automatically performs up to five retries to read these tracks or sectors. If the unreadable area was marked by the LLF, the read fails on all attempts.

Previous Table of Contents Next