home *** CD-ROM | disk | FTP | other *** search
- An Introduction to PC Diskettes
-
- Howard White
- Boston Computer Society
- IBM PC Users Group
-
- Introduction
-
- When you buy double-density
- soft-sector disks for your PC, or
- choose between DISKCOPY and COPY, you
- are making decisions affected by the
- relationship between DOS, your PC's
- Disk Operating System, and the type
- of disk drives installed in your
- computer. While it is not necessary
- to have a technical understanding of
- the way DOS maintains information on
- your disks, it's useful to understand
- the general principles so that you'll
- be a better informed user.
-
- This article will introduce you to
- "tracks" and "sectors", explain in
- disk terms what a file is, describe
- the common DOS utilities for
- formatting, copying, and testing
- disks, and explain the concepts of
- density.
-
- Looking at Diskettes
-
- We start our exploration of diskettes
- by looking at one. With the permanent
- label in the upper left hand corner,
- we see:
-
- o The large round hole in the
- center. When you close the disk
- drive's "door", the drive clamps
- onto the disk here. Many disks
- come with "hub ring
- reinforcements", thin plastic
- rings like those used to
- reinforce three-ring notebook
- paper, intended to help the disk
- withstand the mechanical forces
- of sudden starts and stops.
-
- o On the right side just below the
- center of the hub hole, is a
- smaller round hole called the
- "index hole". If you very
- carefully turn the disk within
- its protective jacket, you will
- see that at one one point is a
- small hole in the disk hole in
- the disk itself visible.
-
- o Below the hub hole is a slot
- shaped rather like a long
- race-track, through which you can
- see the disk surface itself. It
- is through this slot that the
- disk drive heads read and write
- information to the disk surface.
-
- o At the right side, about one inch
- from the top, is a rectangular
- punch from the side of the disk
- cover. This is the "write-protect
- slot". It may not be present on
- all disks, particularly those you
- have purchased with programs on
- them. If the slot is absent, or
- if it is covered with tape, the
- drive can read data from the disk
- but not write on it.
-
- o Two very small oval notches at
- the bottom of the disk, flanking
- the head slot. The drive uses
- these notches to assist in
- keeping the diskette in position.
-
- o As you have almost certainly been
- advised, disks can be damaged or
- destroyed by:
-
- o Touching the recording
- surface (though the head
- hole) with your fingers or
- anything else;
- o Writing on a disk label with
- a ball-point pen or pencil.
- Use a felt-tip marker;
- o Bending the disk;
- o Spilling coffee, etc. on the
- disk;
- o Overheating a disk (e.g. by
- leaving it in the hot sun in
- your car);
- o Exposing your disk to stray
- magnetic fields.
-
- Information is read from and placed
- on your disk by one or two "heads"
- (depending on whether you have single
- or double-sided drives). Heads used
- with "hard disks", including the
- "Winchester" drives available for
- PC's, "float" above the disk surface
- on a microscopic cushion of air. But
- the mini-floppy drive heads actually
- touch the disk surface. Thus both the
- disks themselves and the heads should
- be kept clean - head cleaning kits
- are available - so that precious
- information will not be scraped off
- the disk surface by abrasion.
-
- Tracks and Sectors
-
- From the point of view of DOS, data
- on your PC diskettes is organized in
- "tracks" and "sectors".
-
- Tracks are narrow concentric circles
- going around the disk. Sectors are
- pie-shaped slices of the disk. DOS
- 1.0 and DOS 1.1 read and write 40
- tracks (numbered 0..39) and eight
- sectors (numbered 1..8) on disks. If
- you have double-sided drives, DOS 1.1
- automatically formats and deals with
- disks containing information on both
- sides of a disk. The distance between
- tracks - and therefore, the number of
- tracks on a disk - is a built-in
- mechanical and electronic function of
- the drive.
-
- When you buy new disks, they are like
- blank sheets of paper, containing no
- information at all. Formatting the
- disk puts onto it the information DOS
- needs to maintain a directory and
- files. Normally, you also put onto
- the disk certain parts of DOS (using
- the /S option after the FORMAT
- command).
-
- The track nearest the outside edge of
- a disk - track 0 - is almost entirely
- reserved by DOS for its purposes.
- Track 0, Sector 1, contains the "boot
- record" which the system sometimes
- needs to begin operation. Sectors 2
- and 3 contain the "file allocation
- table", or FAT, which is the disk
- "reservation clerk", keeping records
- of which portions of the disk have
- information and which have empty
- space. Finally, sectors 4-7 contain
- the directory - information about the
- files, a part of which you see when
- you type the "DIR" or "FILES"
- command.
-
- In addition, assuming you have
- formatted the disk using the /S
- (system) option, two "hidden" files
- called IBMBIO.COM and IBMDOS.COM are
- placed on the disk (in different
- location, depending on whether you
- have single or double sided drives).
- They are called "hidden" because the
- normal directory command will not
- reveal their presence on a disk.
-
- In computer jargon, all of this is
- "transparent to the user", meaning
- you don't have to (and generally
- can't) decide where information will
- go on your disks. But just because
- it's "transparent" doesn't
- necessarily mean you shouldn't be
- aware of the decisions DOS makes for
- you.
-
- PC DOS 1.1 puts 512 bytes of
- information on each sector of a disk.
- As a broad generality, a byte is
- equal to a character, but BASIC
- normally saves programs in a
- compacted format, so you can't make
- an automatic judgement about the
- amount of disk space a BASIC program
- will use.
-
- But for purposes of illustration,
- let's assume you have a
- newly-formatted disk in your drive
- and have created a BASIC program of
- 2000 characters, or 2K bytes. You
- type SAVE "FILE1", and DOS begins
- putting your program onto disk.
-
- On the outermost track, sectors 1..7
- already are taken up with system
- stuff, as mentioned previously, so
- the first available sector is track
- 0, sector 8. The first 512 bytes of
- your program go there. Then, because
- DOS always tries to keep things
- together, the remaining roughly 1500
- bytes go onto track 1, sectors 1, 2
- and 3.
-
- Now, you write another, entirely
- different, 2000-byte BASIC program
- and SAVE it as FILE2. Again, DOS
- puts it on the first available spots,
- so it goes to track 1, sectors 4, 5,
- 6 and 7.
-
- Going back to your first program, add
- a few hundred characters, and SAVE it
- again under the same filename, FILE1.
- The first four sectors (even if
- changed) go back to the same spots as
- the old first four sectors. But now
- your second file is in the way of
- keeping things orderly. The next
- available free sector is track 1,
- sector 8, so that's where the rest of
- your revised first file goes.
-
- Next, you decide to delete your
- second program, FILE2, using DELETE
- or ERASE commands in DOS or the KILL
- command in BASIC. These commands
- don't actually erase any information
- from the disk (therefore making it
- possible, using a utility program ,
- to "unerase" a program you've just
- accidentally wiped out). What the
- DELETE family of commands does is
- tell DOS that the sectors formerly
- occupied by, say, FILE2.BAS, are now
- available for recycling.
-
- Now you create and save a new
- program, FILE.BAS, which takes up
- five sectors. The first four go into
- the spots vacated by the now obsolete
- FILE2.BAS. The last one has to go
- into the first available spot, after
- the newly-added part of FILE1.BAS. We
- now begin to have a patchwork quilt.
-
- We're still not in bad shape. But
- suppose our disk gets fuller. We're
- deleting old files to make room, and
- creating vacant areas defined solely
- by the needs of DOS at the time the
- disk was younger. It shouldn't be
- hard to see that a full disk can
- become a real crazy quilt, with any
- sector of any file occupying any of
- the 320 (single sided) or 640 (double
- sided) sectors not otherwise used by
- DOS, system files, other user files.
-
- Since all of this is, as we said,
- transparent to the user, what
- difference does it make? Not very
- much, if all you are doing with disks
- is storing programs. But as soon as
- you start using disk data in your
- programs, you can affect the
- performance of those programs,
- perhaps substantially, by proper disk
- management.
-
- To understand why, consider what
- happens when you ask for disk access,
- either reading or writing. First, the
- disk is told to start rotating at 300
- rpm - it only spins when needed, and
- the red light goes on to tell you
- that's happening. Next, DOS figures
- out which track the data is to be
- read from or written to. A "stepper
- motor" moves the heads toward or away
- from the center of the disk,
- positioning them exactly over the
- right track (if you have double sided
- drives, the top and bottom head move
- together). This movement of heads
- from track to track is the slowest
- operation your disk drives performs,
- and disk access, in general, is the
- slowest thing your computer does
- (excluding things governed by
- external forces like slow printers
- and telephone lines). Once the heads
- are over the right track, access to
- the desired sector is relatively fast
- - the drive "sees" the index hole
- open up as that one hole punched in
- the disk passes over the openings in
- the disk jacket, and then the
- drive/controller combination just has
- to wait the right amount of time
- before reading or writing to a
- sector.
-
- The message here is that moving from
- one track to another is the slowest
- of the slow things a disk drive does.
- DOS tries to keep sectors of a
- program together, but as the
- patchwork quilt pattern develops, it
- can't help much. In an extreme case,
- the heads may read a sector on track
- 0, then pick up another from track
- 39, then move back to track 1 to pick
- up a third, then to track 39 again...
- and so forth. The slowest part of
- disk access is in control.
-
- What can be done? COPY.
-
- The DOS manual lists two different
- ways of copying information from one
- disk to another: COPY and DISKCOPY.
-
- DISKCOPY makes an exact copy of one
- disk to another. So if one disk is a
- patchwork quilt, a DISKCOPY of it
- will look the same. But there's an
- alternative:
-
- COPY *.*
-
- In this case, asterisks are
- "wildcards", meaning "whatever would
- legally be here". So *.* means any
- legal filename followed by any legal
- filename extension. Therefore, if you
- type COPY A: *.* B: , you direct DOS
- to copy all files on drive A to the
- disk on B. There are some assumptions
- here. First, the "target" drive - in
- this case, B, must have enough room
- for the files copied to it. Second,
- unlike more sophisticated schemes on
- larger computers, DOS presently
- provides no protection scheme. So if
- there is a FILE1.BAS on A and a
- FILE1.BAS on B, COPY A version. COPY
- *.* is best done TO a disk whose
- contents are expendable.
-
- The advantage, however, is what
- happens on COPYing. If the target
- disk is clean (containing nothing but
- what FORMAT /S put there), COPY *.*
- to this disk will reorganize data.
- Thus if FILE1.BAS on the source drive
- was scattered from track 39, sector
- 4, to track 3, sector 2, with random
- stops in between, after a copy it
- will be placed in consecutive sector
- order on the new disk. The result is
- that the next time you try to read
- FILE1.BAS, the heads won't have to
- jump all over the place looking for
- pieces of the file, and should
- therefore be able to read it faster.
-
- The message is: generally COPY x
- procedure IF the target disk, y in
- this case, is clean. If it is not
- clean, COPY will work around the
- files on the disk, putting the files
- from x in the best possible
- positions. DISKCOPY x: y: will make
- disk y an exact clone of the x,
- wiping out any files that may have
- been on y and reproducing the
- patchwork quilt of x.
-
- There are utility programs in DOS to
- check the accuracy of copying.
- DISKCOMP is analogous to DISKCOPY;
- that is, it starts with the
- assumption that the compared disk is
- supposed to be a snapshot of the
- original, and reports differences.
- Even if each file on the second disk
- is an exact copy of the corresponding
- file on the first, DISKCOMP will
- report differences if they're in
- different sector/track positions.
-
- On the other hand, COMP compares the
- accuracy of the copy of individual
- files. You can say COMP A:FILE1.BAS
- B:FILE1.BAS and get a report as to
- whether the two files (in this case,
- on different disks) are identical.
- But you cannot say COMP A B on B:).
- The reason for this, of course, is
- vagueness - you can't compare
- something-or-other here with
- something-or-other there and get
- (except by chance) any valid
- information.
-
- Let us now consider some practical
- implications for PC owners of what
- has been covered in this article.
-
- Diskette Types
-
- There are three separate choices
- offered to the purchaser of 5 1/4"
- diskettes (aside from the questions
- of quality, price, etc.).
-
- Soft-sectored or hard-sectored: For
- the PC, soft-sectored disks have only
- one index hole on the disk surface
- itself. Once per revolution this hole
- is visible through the hole in the
- protective jacket, and
- drive/controller/DOS uses this hole
- to establish the location of the
- first sector on any track.
- Hard-sectored disks have a hole for
- each sector, and thus each hole marks
- the beginning of a new sector. If you
- tried to use a hard-sectored disk in
- a PC, the machine would get very
- confused. Sometimes hard-sectored
- disks are not specifically labelled
- as such, but specify "10 sectors" or
- "16 sectors". Don't buy them.
-
- Single-sided or double-sided. At
- first blush, this would seem to be an
- obvious choice. If you have
- single-sided drives, you buy
- single-sided disks, and if you have
- double-sided drives, you buy
- double-sided disks. Not so easy. If
- you have double-sided drives, you
- can, of course, make the extra
- investment in double-sided disks, but
- you probably don't need to. It is
- economically impractical for disk
- manufacturers to make some disks with
- recording surfaces on one side and
- other disks with recording surfaces
- on both sides. Today's "single-sided"
- diskettes look, and usually behave,
- exactly the same as double-sided
- diskettes.
-
- The result of this is that -
- depending on the brand of disks you
- buy - you can generally successfully
- format and use "single-sided" disks
- in double-sided drives, at
- substantial savings in disk costs.
- There is no real danger in this
- practice. When you format a disk, one
- of the things DOS does is determine
- whether there are bad sectors (ones
- which can't reliably hold
- information). If it finds any, it
- tells you "xxx bytes in bad sectors"
- and it seals them off against any
- future attempts to put data there.
- The net result is that you have a
- double-sided disk with slightly less
- than full storage capacity at the
- price of a single-sided disk.
-
- Recommendation: Unless you have money
- to burn, buy single-sided disks even
- if you have double-sided drives. If a
- particular brand seems to produce
- "bad sectors", consider switching
- brands.
-
- Density (single, double, quad).
- "Density", in simplest terms, is a
- measure of the amount of information
- that can reliably be packed into a
- given area of a recording surface.
- The keyword here is "reliably", for
- as in the question of single vs
- double sided, the matter may be
- settled by how well sample disks
- measure up to manufacturing tests.
- However, the question of density also
- raises the question of how many
- tracks are written on your disks.
-
- The drive or drives that came with
- your PC - whether single or double
- sided, are almost certainly "double
- density" drives, also referred to as
- "48TPI" (tracks per inch) drives.
- This means that when the disk
- controller tells the drive "move one
- track closer to the center", the
- drive will respond by moving the
- heads exactly 1/48" closer to the
- center. It is possible to buy "single
- density" and "quad density" drives
- which look exactly like the drives in
- your PC. When a single-density drive
- is told to move one track closer to
- the center, its heads move 1/24:.
- When a quad-density drive is given
- the same instruction, it moves the
- heads only 1/96". The result is that
- a quad-density drive puts two tracks
- in the same amount of space a
- double-density drive uses for one
- track, and so the disk holds twice as
- much information. There is, at least
- potentially, a tradeoff here. As you
- squeeze more and more information
- onto a 5 1/4" disk, you place
- increasing demands on the ability of
- the drive to locate information
- accurately, and on the ability of the
- drive to locate information with the
- increasing precision required.
-
- I started this discussion by
- mentioning density as one of the
- factors involved in buying diskettes.
- As with single- vs. double-sided,
- manufacturing quality control is a
- major part of what distinguishes one
- density from another. Generally, you
- will buy double-density drives for
- your PC.
-
- DOS 2.0 and DOS 2.1 have the ability
- to increase disk capacity by 12 1/2
- per cent by changing the formatting
- scheme. Thus double-sided disks,
- which now hold 320K bytes, will hold
- 360K without any other changes in
- software or hardware.
-
- This is done by increasing the number
- of sectors per track from 8 to 9. In
- turn, it can do so because PC disks
- are soft-sectored, their sector
- organization is determined by the
- operating system, not the number of
- holes punched in the disk. In doing
- so, DOS 2.0 is increasing the density
- of disk storage, putting more
- information into each sector than
- earlier versions of DOS. (Note that
- it is not increasing density in the
- way quad-density drives do - by
- squeezing tracks closer together.) It
- takes more than a DOS change to do
- that; the disk drives themselves must
- be configured for the changed track
- pattern.