[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Looking for Low level non-HFS XCMD/XFCN's




On Mon, 2 Dec 1996, Danny Thomas wrote:

> >I don't think these would be useful in a situation where HFS is
> >absent, or where the file system is damaged.
>
> if HFS is absent, wouldn't be easier to let the Finder do a
> high-level format?

A high-level format is (essentially) what I'm trying to recover from.

> If the file system is damaged, are you sure you want to write you own "fix"
> routines? 

At present I have very little choice in this regard.  The data that I
have on the disk is important to me, and this disk was my on backup.

> You'll have to look at volume bitmaps, MDBs, btrees, etc. I can
> understand wanting to use routines to add extra information from what
> Norton reports (eg with a bitmap error was that a free sector marked as in
> use, or the more serious complementary situation), but I doubt it's
> worthwhile writing a routine to fix problems - except you could implement
> something Norton should provide in the form of a roll-back log of fixes
> made to file-system. 

Very true.  Norton's "undo" facility leaves a lot to be desired, I've
found.  Here is the whole dirty story of what happened to me.  

My System Volume (an Iomega Zip drive) dismounted during a read/write
operation (something my System did not like at all), and become
unreadable, and unrecognizable.  I tried to use Disk First Aid, but it
reported damaged binary trees.  Then I tried MacTools 5.4 (Central
Point Software) to fix the trouble.

Mactools "mounted" the Volume (I believe by re-writing the MDB).  Then
I ran Norton's Disk Doctor which (I think) "fixed" me for good.  It
erased my Catalog and Extents and trued-up the backup MDB to reflect
the first.

> If you experiencing a lot of directory problems I
> think you should focus on why they're happening and eliminating the causes.

Yes.  This is a Driver problem, I believe (on Iomega's part).  A Zip
disk that is a boot volume shouldn't eject/dismount.  

But there will be time enough for focusing on that once I've recovered
my (lost) data.

> >What I'm looking to do is to read/write individual sectors on a SCSI
> >device.  Any help in directing me to my options for for 68K machines
> >is appreciated.
> some of the FS routines allow access to individual sectors, but I think
> that's only for a particular HFS volume. 

I'm not quite sure about all of this.  I'm new to Perl and to Mac
programming.  

What I'm hoping to do is write a series of subroutines that will help
me to manually recover and reassemble my data (building catalogs,
extents, etc.).

The first step (for me) was to start by mapping out which sectors
contained "known" data (within the confines of the allocation blocks
and clumps).  Essentially, I want to build up a preliminary volume bit
map, and assign sectors which are the same across all media, to files.
(Things like Applications and System files will have the same blocks
no matter where they are written.)

At first I tried to use Norton's "Find" Function to do this... to
select and find an arbitrary sector which I could "know" belonged to a
file, but using that function on my Mac Plus, under System 7.0+ is
incredibly slow, ( a single pass across ONE disk takes more than
twenty minutes.)

So I thought I could write a "sector compare" and matching script in
MacPerl -- reading in all the sectors from a disk in a single pass,
compute a probably unique hash for it, and then write it out to a file
as a hash index of the disk.

Then I could do this with each other disk I have, followed by sorting
and matching the computed hashes (after a sort) rather than comparing
using Norton's "Find" feature.

> As you suggest, it's probably not a good idea using them unless
> you're sure they work even in the presence of a damaged
> directory. Access to sector in a mac volume is probably all you
> need,

Yes, as long as I can read and write a Sector, I should be able to
code the algorithms to recognize "known sector regions" and create the
subroutines that allow me to fix this stuff.  (write nodes, indexes,
etc.)

> but I think you have to make direct SCSI Manager calls to access
> arbitrary sectors, eg the partition map, driver partitions, etc. or to
> interact with the SCSI drive to read device geometry, defect sector lists,
> etc. I've got some C code to do these, but you'd have to wrap these within
> XS to access from perl. An interesting and enriching experience.

I'm new to Mac programming, and don't know any C, and am just starting
to read the Inside Macintosh series.  (I did use some other high level
languages though, CICS, NCR, etc.), and my System is a Mac Plus,
connected to two Iomega Zip drives -- essentially a two floppy based
system, similar to the Apple ][, except that I have a 68000 processer,
and "floppies" that hold 94Meg each.  Pretty clearly I have heavy
software, hardware, and wetware constraints.

I do have access to some workstations though that have gcc, on them.
If I have to compile, and link up some stuff, and create my resources,
can I do it on a Sun, Dec or HP workstation??

Thanks for any help.



Istvan.