page@ulowell.cs.ulowell.edu (Bob Page) (01/06/88)
peter@sugar.UUCP (Peter da Silva) writes: >Anyone interested in doing an "Undelete" program? haitex@pnet01.cts.com (Wade Bickel) responds: >Got a spec. for how you think this program should function? I need >to learn about the file system and this seems like a short project, so >I might be interested. [rolling up his sleeves...] The first thing to do is have the AmigaDOS Technical Ref Manual. The second thing to do is learn how the DOS name hashing works. Get Fish Disk 20 (the one with DiskSalv) for an example program that does DOS hashing. OK, now. Two methods for writing UNDELETE... First. The easy, fast way to 'undelete' is to scan the disk, block by block, looking for a file header block that: a. Has the right file name (it's a BCPL string in the block) b. Has a 'parent pointer' that points to the right parent (you want file proj/src/readme, not proj/doc/readme, right?) Found it? Good, remember the block number. Now go to the parent directory (or what will be the parent directory when you undelete it), hash the filename, and put the file's block number in the longword that you just computed. If the existing longword is not zero, you have to add the block number to the hash chain. See the AmigaDOS TRM for info. There! You've just done an UNDELETE. Pretty easy, eh? Second. Maybe you're not sure all the data is intact. If you've done any writing to the disk, this might be the case. In that case, here's two ways to get the data back. You should probably do both, since one of them might not work. 1. Find the first data block, save the data (the first 24 bytes or six longwords are not data), and look at the 'next data block' longword to get the next one. Follow the chain until it ends. Each data block has a serial number, you could check that if you think it would be useful. 2. Look at the block list in the file header block, and get each data block by its block number (contained in the block list). If there is an extension block (also called file list block), read that block for another list of blocks to read. That's all there is to it! This method of data recovery is what DiskSalv/DiskDoctor does, except they do it for the whole disk, know about directories, and other FS gobbly-gook. Do it for just one file and you have FileSalv. <poof> Sanity checks when looking at data blocks: a. Make sure it's a data block! The first longword should be T_DATA (something like decimal 8 ... see disksalv.c for the right value, or Leo's bm.c, or something similar). b. Each data block has a pointer to the file header block. If the number doesn't match, something's wrong. c. Make sure you don't automatically save 488 bytes per block, some locks (like the last one) might not have that much data. Check the longword that tells you how much data there is in the block. Two disclaimers: 1. This is off the top of my head. No flames if I've forgotten something. 2. These techniques may not work with new versions of the file system. FileSalv method 1 (follow the data block chain) will NOT WORK with the new (aka fast or HD) file system, since data blocks are always 512 bytes. You also have to worry about the new features... :-) ..Bob (still working on the Amiga FS handbook) -- Bob Page, U of Lowell CS Dept. page@ulowell.edu ulowell!page "I've never liked reality all that much, but I haven't found a better solution." --Dave Haynie, Commodore-Amiga
rap@dana.UUCP (Rob Peck) (01/07/88)
In article <2339@ulowell.cs.ulowell.edu>, page@ulowell.cs.ulowell.edu (Bob Page) writes: > peter@sugar.UUCP (Peter da Silva) writes: > >Anyone interested in doing an "Undelete" program? An UNDELETE for the Amiga already exists, available on PeopleLink. I haven't downloaded it yet, but I know it is there, right Harv? (Harv Laser, Sysop, Amiga Forum on People Link). Rob Peck ...ihnp4!hplabs!dana!rap
hrlaser@pnet02.cts.com (Harv Laser) (01/10/88)
rap@dana.UUCP (Rob Peck) writes: >In article <2339@ulowell.cs.ulowell.edu>, page@ulowell.cs.ulowell.edu (Bob Page) writes: >> peter@sugar.UUCP (Peter da Silva) writes: >> >Anyone interested in doing an "Undelete" program? > >An UNDELETE for the Amiga already exists, available on PeopleLink. >I haven't downloaded it yet, but I know it is there, right Harv? >(Harv Laser, Sysop, Amiga Forum on People Link). > >Rob Peck ...ihnp4!hplabs!dana!rap Hey! Dat's me! [blush] And...um...excuse me Mr. Peck, sir but it's AmigaZONE ^^^^ which in a moment of sentimentality in the Summer of '86, I chose as the name for the Amiga club on People/Link as a form of fond dedication to my favorite teevee show of all time. And 'sides, no one objected! :) Yeah, we have a really old UNDELETE program in our library there... I remember using it a long time ago. It requires you to know the name of the file(s) you wish to undelete, and hopefully you haven't written anything to your disk since you deleted the file you want to get back. When I tried it, long ago, it worked. DiskSalv (hi Dave!) seems to perform the same feat quite well. Now excuse the sacrelige but what we Amigoids really need is a Norton Utilities type of gizmo that will gently guide folks through a system of menus letting them choose which files they wish to ATTEMPT to undelete... not a Hex editor, not a funky quick hack, like Undelete, but a nice full featured utility that non-programmers can deal with and use. UUCP: {ihnp4!scgvaxd!cadovax, rutgers!marque}!gryphon!pnet02!hrlaser INET: hrlaser@pnet02.cts.com
schein@cbmvax.UUCP (Dan Schein CATS) (01/11/88)
In article <2080@gryphon.CTS.COM> hrlaser@pnet02.cts.com (Harv Laser) writes: > >I remember using it a long time ago. It requires you to know the >name of the file(s) you wish to undelete, and hopefully you haven't True you should know the name of the file, but if you dont - just enter any bogus name. UnDelete will display the name(s) of the files it finds, as it finds them. This way you can have your memory refreshed as to the files name or exact spelling. (Plus you can look for other files you were not supposed to find :-) -- Dan Schein uucp: {ihnp4|allegra|burdvax|rutgers}!cbmvax!schein Commodore AMIGA ARPANET: cbmvax!schein@uunet.uu.net 1200 Wilson Drive Bix: dschein Plink: Dan*CATS West Chester PA 19380 phone: (215) 431-9100 ext. 9542 +----------------------------------------------------------------------------+ All spelling mistakes are a result of my efforts to avoid education :-) +----------------------------------------------------------------------------+ I help Commodore by supporting the AMIGA. Commodore supports me by allowing me to form my own suggestions and comments.
daveh@cbmvax.UUCP (Dave Haynie) (01/13/88)
In article <2080@gryphon.CTS.COM>, hrlaser@pnet02.cts.com (Harv Laser) says: > Now excuse the sacrelige but what we Amigoids really need is a Norton > Utilities type of gizmo that will gently guide folks through a system > of menus letting them choose which files they wish to ATTEMPT to > undelete... not a Hex editor, not a funky quick hack, like Undelete, > but a nice full featured utility that non-programmers can deal with > and use. Sounds like DiskSalv 2.0 to me. And I should know. Can you wait a few more months? Pleeezzzeeee. -- Dave Haynie "The B2000 Guy" Commodore-Amiga "The Crew That Never Rests" {ihnp4|uunet|rutgers}!cbmvax!daveh PLINK: D-DAVE H BIX: hazy "I can't relax, 'cause I'm a Boinger!"