Phil Storrs PC Hardware book

DOS Computers and floppy disk drives

Floppy Disk Drive Mechanics.

The Floppy Disk is rotated at 300 RPM for normal disks (DD) and 360 RPM for high density disks (HD). The speed must be within 3%. A magnetic head assembly is moved back and forth across the surface of the disk by a stepper motor and must be aligned to very close tolerances in relation to the centre of rotation of the floppy disk. An alignment of the head assembly can be performed with the aid of digital alignment disk but is not usually cost effective. The image at the right shows a typical direct drive motor that rotates the floppy disk media.

Floppy Disk Drive Interface.

Floppy Disk Drives require an interface circuit to interface them to the computer bus and the "standard" interface uses a 34 wire ribbon cable. 5.25 inch drives use an edge connector on the drive and the 3.5 inch floppies use a 34 pin header (pin) plug.

The floppy drive interface can control two drives and the interface cable has two sets of control signals - one for each drive. Floppy Disk Drives have drive select jumpers on them that configure the drives as either first or second drive. In a PC computer the first drive is called A: drive and the second drive is called B: drive. The original way the drives were meant to be configured was to select one drive as the first drive and the other as the second drive, via the jumpers on the drive. Most PC Computers use a strange standard interface cable originally used by IBM, where each drive is selected as the second drive and a twist in the cable transposes the control signal between one drive and the next. This standard 34 wire Floppy Disk Drive Interface cable used in most PC computers has Drive A:, as the drive at the end of the cable, and drive B: further in, before the twist. Most cables suppled with modern hardware have four connectors on the floppy drive end of the cable with a 34 pin edge connector and a 34 pin header connector for each drive. It is easy to re-assign the A: and B: drives in modern PC computers.

The 5.25 inch Floppy Disk Drives require a +12 volt and a +5 volt supply. Most 3.5 inch Floppy Disk Drives only require a +5 volt supply.

Disk Nomenclature

The surface of a Floppy Disk is divided into Track's, Sector's and Side's. Tracks (also referred to as cylinders) are concentric circles around the disk, and each track is divided into sectors.

Over the years as Floppy Disk technology has improved, DOS has followed this evolution and quite a few disk formats have resulted. DOS and Windows operating systems can recognise a Floppy Disks format and will read from, and write to, almost any disk format. The one exception involves the 720K, 5.25 inch format. This is not an official DOS format and may not be recognised by DOS, and Windows.

SIZE
(in inches)
TRACKS
(per side)
SECTORS
(per track)
SIDES CAPACITY
(nominal)
5.25 40 8 1 160K
5.25 40 8 2 320K
5.25 40 9 1 180K
5.25 40 9 2 360K
5.25 80 9 2 720K (note 2)
5.25 80 15 2 1.2Meg
3.5 80 9 2 720K
3.5 80 18 2 1.44Meg
3.5 80 21 2 1.72Meg (DMF format)
3.5 80 36 2 2.88Meg

Notes on the various DOS Floppy Disk Formats

  1. The 360K was the most common PC/XT format.
  2. The 720K, 5.25 inch format was used by NEC and some other companies but was not used by IBM, they introduced the 3.5 inch, 720K disk in its first PS/2 computers in 1987, some Laptop computers also used it at that time.
  3. The 5.25 inch, 1.2Meg format introduced by IBM with the AT in 1984 was also used by NEC with 8" floppy disk drives on some if its early DOS computers.
  4. The 3.5 inch, 1.44Meg Disk is now the industry standard.
  5. The DMF format was introduced by Microsoft for the distribution of software and these disks cannot be copied by the DOS Diskcopy command - it is meant to be a Read-only format. DMF disks can be copied with after market copy utilities.
  6. The 3.5 inch, 2.88Meg format was introduced by IBM but has not been used much .

How big is a sector ?

DOS uses a Sector size of 512 Bytes. Each Sector can store 512 Bytes of data. In addition to the 512 bytes of data stored in a sector, each sector also has quite a few Bytes of Over Heads that identify the Sector, provide Error Checking Check Sums and provides Synchronisation data for the drive as its reads data from the sectors.

The sectors on a disk must be read and rewritten by different disk drives, usually with slight variations in the speed of rotation, and so Inter Sector Gaps of unused disk space are needed between the sectors to stop the data from one sector overlapping into the next.

In addition to the gaps between the sectors each sector must be supported by a sector Identifier called the Sector ID field. The Sector ID field is written only once when the disk is formatted and is never written again, only the 512 bytes of data in the data field are written to, in normal operation.

The structure of a single sector is as follows. (all numbers are in hexadecimal)

The capacity of Floppy Disks

The capacity of a Floppy Disk can be calculated by multiplying the number of Tracks by the number of Sides, by the number of Sectors per track by 512 bytes. For example, the actual capacity of a 360K Disk is: Tracks (40) times Sides (2) times Sectors (9) times 512 bytes = 368,648 bytes.

In addition to the overheads required for each sector, the start of each track also has it's own identification field consisting of ,

How is all this disk space used ?

Not all of the sectors on a disk are available for the storage of data. The sectors on a Floppy Disk are assigned into four areas.
  1. Boot Sector. On a Floppy Disk, his occupies the first sector, Sector one of Track zero, Side zero contains a description of the disks format and Boot Strap Loader to load the DOS operating system.
  2. File Allocation Table (FAT). This is a record of the status of each sector of the data space it contains an "ENTRY" for each Sector and this entry indicates:
  3. Directory The Directory consists of 32 Byte entries that keep track of the files that are saved of the disk.
  4. Data Space This is were the files are kept.

How much disk space is used by the Boot Record, FAT and Directory ?

The Boot record on a Floppy Disk requires only one sector and this occupies the first sector on the disk. The amount of disk space (the number of sectors) allocated to the FAT and the Directory on a DOS disk depends on the disks Logical Format. Here is a table for the various Floppy Disk formats in use with DOS and Windows operating systems.
FORMAT CLUSTER SIZE FAT TYPE FAT DIRECTORY
160K 1 = 512 byte 12 bit 1 sector 4 sectors = 64 entries
180K 1 = 512 byte 12 bit 2 sector 4 sectors = 64 entries
320K 2 = 1024 byte 12 bit 1 sector 7 sectors = 112 entries
360K 2 = 1024 byte 12 bit 2 sector 7 sectors = 112 entries
720K 2 = 1024 byte 12 bit 3 sector 7 sectors = 112 entries
1.2Meg 1 = 512 byte 12 bit 7 sector 14 sectors = 224 entries
1.44Meg 1 = 512 byte 12 bit 9 sector 14 sectors = 224 entries
2.88Meg 2 = 1024 byte 12 bit 9 sector 15 sectors = 240 entries

Two copies of the FAT are stored on the disk just in case one gets damaged.

The File System Overheads

The sectors allocated to the first three sections of the disk can be looked at as overheads, they are required to support the Data Space. A 360K Floppy Disk has twelve sectors allocated to the DOS file system overheads and they are used like this.

Boot Sector
1 sector (the very first sector on Track Zero, Side Zero)
FAT
4 sectors (the next four sectors on Track Zero, Side zero)
Two sectors for each copy of the FAT
Directory
7 sectors (the next seven sectors on Track Zero, Side zero)

This leaves this disk format with 708 sectors available, and as the cluster size is two sectors this gives a total of 354 clusters in the Data Space to store files in. The cluster size of two sectors, 1024 bytes, means the smallest amount of disk space that can be allocated to a file is 1024 bytes, even if that file is only ten bytes long.

1. The BOOT SECTOR

On a floppy disk, the Boot Sector is the very first sector of that disk. It is Sector One of Track Zero, Side Zero. The Boot Sector is 512 Bytes long and contains:

When the computer is booted the Boot Strap Loader in the BIOS ROM, loads the Boot Sector from the Boot disk into the memory, and then the Boot Strap Loader from the Boot Sector, loads the Operating System. NOTE: Both Bootable and non-bootable disks have identical Boot Sectors. When you try to boot a PC Computer from a non system disk, the error message is coming from the simple Boot Strap Loader, loaded into RAM, from the Boot Sector. When it cant find the DOS System Files, it gives an error message.

2. The File Allocation Table (FAT)

This is the area of a disk that is used to keep track of how the storage space in the Data Space is being used. Entries in this table indicate Bad Clusters, Free Clusters, Clusters In USE by a file, or the End of a File. The smallest unit of space that can allocated to a file is not necessarily a Sector.

Clusters

Storage space on any DOS formatted disk is allocate in units called CLUSTERS. The number of Sectors in each Cluster depends on the actual capacity (the Format) of the disk in question. This was done to reduce the Overheads in the system by combining sectors into Clusters, thus making the size of the table needed to keep track of Cluster usage smaller.

The old single sided 40 track disk formats had a Cluster size of one sector (512 bytes), double sided 40 track formats used two sectors per Cluster (1024 bytes) and all High Density Floppy Disk formats use Cluster sizes of one sector (512 bytes). Hard Disk Drives can have Clusters of up to 64 sectors per Cluster. What this means is that the smallest amount of disk space that can be allocated to a file when it is written to a disk is the size of the cluster. This size is number of sectors per cluster times 512 bytes per sector.

You can see the Cluster size of a Disk Drive by using the CHKDSK command from the DOS prompt, either under DOS 6.xx or under Windows 95 DOS. CHKDSK reports on the bytes in each allocation unit, this is talking about the Cluster size.

When a very small file is saved onto a Disk Drive, the amount of disk space taken up by that file is the size of the Cluster. The rest of that Cluster cannot be allocated to another file and is wasted space on the disk. For example, if we save a file that is only 10 bytes long on a 1.44Meg Floppy Disk, the rest of the 512 byte Cluster will be wasted. This is a BIG problem when we look at high capacity Hard Disk Drives where the cluster size can be as high as 64 Sectors, 32,758 bytes.

The File Allocation table takes three forms, the FAT can be constructed of either 12 bit, 16 bit or 32 bit numbers. The 12 bit FAT is made up of one and a half bytes per entry, and is only used on Floppy Disks. Until the recent introduction of OSR2 release of Windows 95 with the option of using a 32 bit FAT, Hard Disk Drive Partitions were limited, by the 16 bit FAT, to a maximum size of 2.1 GByte. At present the 32 bit FAT is only available when you format a Hard Disk Drive with the OSR2 release of windows 95, it cannot be put on a systems that is already formatted with the older Windows 95. This problem will be overcome by Windows 98 when it is released, it will have provision to convert Hard Disk Drives from 16 bit FAT to 32 bit FAT.

3. The Directory

Each entry in the Directory requires 32 bytes and these bytes are used like this :-

Use Number of bytes
File Name 8 (this is why the file name be a max. of 8 characters)
File Name Extension 3 (this is why the extension is limited to 3 characters)
Attribute Byte 1 (see table below for how the bis are used)
not used by the DOS file system 10 (Oh what a waste)
Time the file was written 2
Date the file was written 2
The number of the first Cluster used by that file 2
The file size 4

The "bits" of the Attribute Byte are used like this

Bit Use
0 File is read-only
1 File is hidden from view
2 File is a System file
3 This directory entry is a Volume Label rather than a file name
4 This entry is a Subdirectory name rather than a file name
5 Archive bit - used to control Data Backup
6 not used
7 not used

Volume Label - A Volume Label, a name that can be put on the top of a disk's directory listing, is stored in the Directory like a file name and it can have a maximum of 11 characters.

Subdirectory - When a Subdirectory is created its name is recorded in the directory and one cluster of the data space is allocated to it for storage of file names. When that space is used up by file names additional clusters are allocated to that Subdirectory for it to store file names. The first two entries in a sub-directories structure is occupied by entries that indicate the parent of the sub directory. Look at in a subdirectory and you will see two entries, one with one dot, the other with two dots.

The Directory entry for each file stored on a disk indicates to DOS which Cluster is the first cluster used to store that file and the FAT then forms an Allocation Chain that tells DOS which other Clusters contain the rest of the file. The last cluster used by each file has the hex code FFF in its FAT entry to tell DOS this is the last Cluster. The hex code FFF is used to indicate "end of file".

Putting it all together

  1. The directory entry for each file has a number that points to the first cluster used by that file.
  2. Each Cluster of the Data Space on the disk has a corresponding FAT entry.
  3. The FAT entry for each cluster is used to indicate one of four things.
  4. The first two entries in the FAT are DOS overheads and do not represent any cluster. This means the first cluster is called Cluster Two.

Important: A cluster is the smallest unit of disk space that can be assigned to a file. When a file is saved on a disk the file system allocates space to the files in "clusters" rather than in sectors. A cluster can be from one sector long (512 bytes) to 64 sectors (32,768 bytes), and this depends on the format of the disk. The use of clusters was an attempt at reducing the size of the File Allocation Table by cutting down the number of units that had to be accounted for by the FAT.

Changing over Drive A: and Drive B:

Many older PC computer systems have both 5.25 and 3.5 inch floppy drives fitted and the it was more common some years ago to have the 5.25 inch drive assigned as the A: drive. Today it is difficult to obtain original software on 5.25 inch disks and it is better to change the disk drives over so drive A: is the 3.5 inch drive.

All you have to do to achieve this is to swap the interface plugs over on the back of the drives and then to go into the CMOS setup and reconfigure drive A: and drive B:.

High capacity removable magnetic disk technology

Floppy disks have provided a convenient way of storing files on a removable magnetic media and over the years there has been quite a few attempts at marketing higher capacity removable magnetic disk devices. One of the first of these was a 10 Meg device from Verbatum, and one of the most recent is the 1000 Meg Jaz drive from Iomega corporation. Along the way we have had various drives from Syquest, the latest of which provides 230 Meg of storage space.

The 100 Meg Zip drive from Iomega is gaining popularity at present and Compaq and 3M have developed LS-120 technology, a 120 Meg device, that will be marketed during 1996, and will be standard fitting to some Compaq models. Until now, the high capacity magnetic devices have been interfaced via a SCSI interface, or via the Parallel port, and have mostly been used as backup and transport devices. Each brand and model has been unique in the technology used.

LS-120 has the advantage of being able to read and write 1.44 Meg high density, 3.5 inch, floppy disks. We will look at these technologies in PC Servicing Two.

The difference between Floppy Disks and Hard Disk Drives

On a Floppy Disk Drive the Boot Record is on Sector One of Side Zero, Track Zero and the other two sections of overheads follow on from there - the first sector of the FAT is on Sector Two of Side Zero, Track Zero.

A Hard Drive Drive has an extra area of overhead. This is the Partition Table and is in the first sector on a hard drive - on Sector One of Side Zero, Track Zero. The Boot Sector on a hard drive is on Sector One of Side One, Track Zero and the rest of the DOS file system overheads follow on from there.


Back to the opening index Book four index


Copyright © Phil. Storr 4th December 1998