Path: utzoo!attcan!uunet!cs.utexas.edu!usc!apple!uokmax!d.cs.okstate.edu!minich From: minich@d.cs.okstate.edu (Robert Minich) Newsgroups: comp.sys.mac.hardware Subject: Re: Disk optimization Message-ID: <1990Sep21.021427.26233@d.cs.okstate.edu> Date: 21 Sep 90 02:14:27 GMT References: <1990Sep20.163033@miguel.llnl.gov> Organization: Oklahoma State University Lines: 64 by macq@miguel.llnl.gov (Don MacQueen): | Ads and documentation for disk optimization software (defragmenting, | etc) speak as if the best thing to do is first defragment and then | 'optimize' which means put all the files together and all the free space | together each in one big block. But if this is done then the next time | a file is made bigger it is necessarily fragmented. Wouldn't it be | better to take the free space and divide it up proportionally to the | file sizes and stick a bit of free space after each file? Then files | would have a better chance of not becoming fragmented. | | Any comments? Sure, why not... First, I don't claim to have tested any of these ideas out, but I do claim to have a certain curiosity about file systems. (I understand/know a bit about MFS, HFS, SysV, and OS/2 HPFS, although I don't know too much about HPFS.) It seems most opsys's don't care too much about fragmentation. I assume it encourages third party developers. :-) Anyway, back to the subject. The "optimal" setup for a file system is heavily dependent on how the files change over time. (Grow, shrink, wiggle, delete and create.) On the Mac, you tend to have a few files that are basically static. These are your apps and to a large extent the system file. The sys file may go through convulsions internally but still take up the same space on disk.) These files you probably want somewhere apart from data files with and with minimal padding for the files to grow. Your data files that are always there -- the accounting, phonebook, and many spreadsheets -- will usually grow but not shrink. Other files come and go, like that letter to Mom and the daily memos. I guess an "optimal" disk would put all the repeatedly accessed files (the sys and apps) in the middle of a disk where the heads are in a good position to either be on top of the next-requested data or only half a disk away. Other things that are accessed like mad are the catalog files and these should ideally be around the disk blocks they represent. (The only file sys I know that does this is HPFS, which places catalog info on 32mb boundaries.) Back to reallity... the most a Mac defragger can probably do for you is put the static files in a large block (preferably near the middle), put the always-around files together with plenty of padding, and put the volatile files wherever is left. As far as putting all the allocated blocks in one place, I think that would be dumb since a file that would grow, even a little, would all of a sudden be scattered from somewhere in the middle of a hunk of allocated space to somewhere distant where there's some free blocks. As a last note, the Mac HFS does a bit to help fragmentation all on it's own. First of all, it uses "allocation blocks" that are multiple disk blocks. Second, it tries to allocate contiguous blocks. (Someone from Apple please clarify this: how does the MacOS decide what blocks to add to an allocation? Does it look for a suitable run in the volume bitmap or what? I assume allocContig() does look for big runs.) A nice thing for an application to do when it completely rewrites a file (I assume most word processors act this way. A DBase app probably wouldn't.), it can first shrink the file to nothingness then allocate all the necessary space in one swoop, giving the file system a chance to defragment at least that file. That's enough from me BUT... if you know of any documentation on file systems (of any flavor) that I can get my hands on, ESPECIALLY in machine-readable form, please let me know. I'd like to explore this area a bunch more... heck, maybe I can get some credits for it. :-) -- |_ /| | Robert Minich | |\'o.O' | Oklahoma State University| A fanatic is one who sticks to |=(___)= | minich@a.cs.okstate.edu | his guns -- whether they are | U | - Ackphtth | loaded or not.