CASE HISTORY # 10   (PART 2)
       by the Disk Doctor


--------------------------------------------
Copyright (C) 1988,  the Disk Doctor.

First published in the Rochester (PC)^3 News:
   Picture City PC Programming Club
   PO BOX 20342
   Rochester, NY 14602
The Disk Doctor may be contacted at this
address, or via CIS [73147,414].

This material may be reproduced for internal
use by other not-for-profit groups, provided
this copyright notice is included.
----------------------------------------------

 
 
11:35am  (the next day)
I returned to my office to find N. waiting
for me.  She was still complaining about
her hard disk being slow.  When we talked
yesterday, I had suggested she use BUFFERS
as a disk cache.


11:37am
"I'm surprised you didn't see a more
noticeable improvement with BUFFERS,"  I
told her.  "Maybe there is something else
we can do.  You have a XT with a 10
Megabyte drive, right?"  She nodded
affirmatively. "How old is your system?"

"Oh I don't know.  It was bought sometime
in 1984, I think."

"It's possible your problem is
fragmentation."

"Fragmentation?  Good Heavens!  That
sounds serious."

"No, not serious.  I just think your files
are spread out all over the place."

"Oh, no, Doctor, I never had that problem.
I'm always careful with my files.  All my
database files are in the \dBASE
directory, all my..."

"Wait a minute.  I'm not talking about the
logical organization of your files, I'm
referring to how the sectors are
physically located on the disk.  Whether
your files are contiguous."

"Contiguous?  Is that a word?"

"It's a technical term used by us disk
doctors.  Let me explain."



11:41am
I invited my chubby friend to sit down and
called up a disk utility. "Here, look at
this.  This is called a disk map."

"Hey.  That's neat.  Is that what my disk
looks like?"

"More or less.  These symbols here
represent the sectors in use by a file." I
selected a file to display.  "Now here is
an example of a contiguous file.  See how
all the sectors are grouped together?  Now
let me find a fragmented file...  Here's
one.  Can you see the difference?"

"Yeah, it's all broken up.  But how does
fragmentation make my disk run slower?"

"Picture this,"  I said, as I held my hand
out flat.  "Your hard disk consists of a
stack of 2 platters, constantly spinning.
There are 4 magnetic heads mounted on a
fork, which move radially in and out, like
this:"  I illustrated with the fingers of
the other hand.  "As the disk spins, each
head traces a 'track' on one of the four
surfaces. Now, DOS can access data
anywhere on the four tracks, almost
instanteously.  What slows you down is the
mechanical motion of the fork moving over
the platters."

N. glanced at her watch and squirmed in
her seat.  "Well, that's real interesting,
Doc, but all this talk about forks and
platters is making me hungry."

"Let me finish.  When all the data is
stored on adjacent tracks, the heads have
to move only once or twice, and only for a
short distance. But when your disk is
highly fragmented, the heads must travel
back and forth many times."

"But how did my disk get fragmented in the
first place?"

"Normally the disk fills from the outside
in."  I traced an arc on the back of the
hand representing her disk.  "But when any
one file grows in size and requires
additional sectors, the immediately
following sector might be in use by
another file.  DOS grabs the first
available sector, which might be way at
the beginning or the middle or wherever.
It could be a sector that's never been
used before, or one from a file that has
been recently deleted."

N. nodded her understooding, so I
continued.  "Now, if you have a hundred
files all growing and shrinking at the
same time, they soon become entwisted,
like spaghetti.  As soon as you delete
one, it leaves open spaces like swiss
cheese..."

"Hey.  I told you to cut the talk about
food...  "

"...It doesn't take long before your disk
is full of fragmented files. It takes time
to move the heads.  So the more fragmented
your disk, the slower it runs.  It's
especially noticeable on a random access
file, like a database."

"So how come other people don't have this
problem?"

"It's a condition that develops over
time," I explained.  "It depends on how
many files you have, how much they grow
and shrink in size, and other factors.  If
you were to backup all your files, erase
your disk and copy all your files back,
your disk would be just like new."

"How long would that take?  To backup and
restore everything like that?"

"Oh, let's see.  To backup your entire
disk would take roughly 30 floppies, so
you'd need 30 minutes to format them all,
a half hour to backup, 10 minutes to
format drive C:, and another half hour to
restore...  you're talking about 2 hours.

"Well, that sounds like a pretty radical
procedure," N. said as she struggled to
lift heself out of the chair.  "I think
I'd better get a second opinion, doctor."


11:48am
"Wait.  I have a much better solution.  We
can optimize."

N. looked perplexed.  "Fragmentize...
Optimize...  Now, you've got me
mystifized."

"I'm talking about a disk optimizer.  It's
a utility which rearranges all the sectors
on your disk, and does it automatically."

"Oh come on,"  N. said, incredulously.
"You said the files have to be copied to
floppies.  What, does it come with a
little robot arm to change diskettes?"

"No.  The whole process is performed just
on one disk.  It swaps sectors on the
disk, using whatever free space there is
left."  She seemed interested, so I added,
"I'd be happy to run it for you."

"Great,"  N. glanced at her watch again.
"How about right after lunch.  I dying of
hunger."

"How about right after lunch, you get
ready first.  There are a couple
preparation steps you should take before
running an optimizer:

1) erase all the files you don't need
   anymore,
2) uninstall any copy-protected
   software, and
3) run CHKDSK /F to clean up any lost
   chains. "

I continued, "The optimizer can take
several hours, especially if your disk is
nearly full and your files are highly
fragmented.  So why don't I stop by late
this afternoon, and we'll let it run
overnight."

(to be continued...)