[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ProDOS files vs. disk
In article <9212280139.AA10293@apple.com> ST2975@SIUCVMB.SIU.EDU writes:
>I seemed to have noticed that files on my disks aren't exactly
>contiguous. There seem to be 512 byte 'holes' on the disk that
>separate different files' data. Is this an optimization of
>ProDOS? Can I write a disk utility that can move the files'
>data closer together and change the directory structure to reflect
>the change using read_block/write_block and read/write?
>I'm using ProDOS v1.9 currently. Am I imagining things as usual?
>
>Andy Werner
>st2975@siucvmb.siu.edu
Andy, you are not imagining things at all. ProDOS uses this block
method of storage because it allows more files on a disk than would be
possible for sequential storage.
Example: If you have many small files on a disk which were written to
sequentially, deleting some of them randomly would free up sections of
the disk which do not fall into a consecutive pattern. Although the
total number of blocks free on the disk may be enough of a volume to
contain a file currently in memory, requiring that the file be written
sequentially might mean that it would not be possible to save it.
ProDOS has overcome this problem by allowing different blocks to be
linked via a pointer in the original directory entry for that file.
Depending on the file type, the pointer may point directly to the data
block of the file (as the case with a seedling file,) a block of
pointers which point to the data blocks of the file (as the case with
a sapling file,) or a block of handles which point to a block of
pointers which point to data blocks of the file (as the case with a
tree file.) There is also another file type (extended files) which
is available under GS/OS only (not ProDOS 8) which contain two logical
data segments (resource and data forks.)
The version of the ProDOS doesn't matter. It has been done this way
since the original version -- otherwise, ProDOS would not be backward
compatible because the structure on the disk would not be the same.
As for a utility to remedy you problem, you want a program called a
defragmenter. I'm sure that Glen Bredon has written something for
smaller disks in his ProSel 8 package as someone suggested (what kind
of utility hasn't he written!)
If you want to know more about the actual management of ProDOS and
GS/OS disk storage devices, I would recommend _Exploring Apple GS/OS
and ProDOS 8_ by Gary B. Little (Addison-Wesley Publishing Company --
copyright (c) 1988.)
sean
--
# internet: dockery@griffin.cuc.ab.ca | "alone. death can't hold a candle
# -or- dockery@pro-calgary.cts.com | to it, and hell is a poor synonym"
# pro-line: dockery@pro-calgary | -stephen king
# uucp: crash!pro-calgary!dockery | disclaimer: i am unemployed