knudsen@ihwpt.ATT.COM (mike knudsen) (01/21/88)
I'd like to find, or get help to write, a simple (?) utility that would read thru an entire diskette and find all the bad (as in unreadable) sectors and mark them as in-use on the sector allocation bitmap so that they would never be assigned to any future files. Options from the command line would control: *what to do if a bad sector is already allocated (at least type warning; better to find what file it belongs to; maybe unlink it from that file); *whether to try and re-format just each bad sector (write some pattern on it and try to re-read it. If this works, then media itself is not [quite as] faulty.) *whether to create a single file in the root directory, named BAD.SECTORS, which would contain all the baddies. (I dislike this, since now a user could DEL that file and have all those bad sectors "loose" again.) I know that FORMAT is supposed to identify bad sectors when a disk is first formatted and set their allocation bits. However, I often find bad sectors showing up later, especially on DS80-track disks. I know how to read thru all the sectors (open /Dn@), but need some serious study of the allocation bitmap area. Also I assume it's very hard to find what file a given sector belongs to -- must search every file in every directory. Or is there a faster way? I know DCHECK can identify files with duplicate sectors, but I assume it starts with a recursive descent thru the directory tree anyway. -- Mike J Knudsen ...ihnp4!ihwpt!knudsen Bell Labs(AT&T) Delphi: RAGTIMER CIS: <memory failure, too many digits> "Just say NO to MS-DOS!" "OS/2 == 1/2 of an OS"
pete@wlbr.EATON.COM (Pete Lyall) (01/22/88)
In article <2265@ihwpt.ATT.COM> knudsen@ihwpt.ATT.COM (mike knudsen) writes: >I'd like to find, or get help to write, a simple (?) >utility that would read thru an entire diskette and >find all the bad (as in unreadable) sectors and mark >them as in-use on the sector allocation bitmap so that >they would never be assigned to any future files. Mike - I wrote a little nasty tool several years back in B09 to do something similar. It reads all the sectors on the media (number is determined from LSN0), and barks at errors (optionally to a disk_error_log). In the event of a CRC error, it'll attempt to rewrite the sector to itself.. usually a recovery. It did not deallocate a sector from the free map, although bitmap operations aren't as tough as they look, and could semi-easily be retrofitted with 'syscall'. This is especially simplified by the fact that most everyone uses a clustersize of 1 bit = 1 sector. The code really needs to be cleaned up and rewritten, best probably if in C. I keep meaning to, but you know the drill... If you're volunteering to do just that, I'll be happy to mail you the code. Some other tips are that you get a *lot* better throughput if you read a track at a time: (i.e. read(diskpath, trakbuff, tracksize_in_bytes)) If you get an error, *then* identify which sector of the track was offensive. BTW - what inroads are you making into OS9, Midi, and music? We (os9 forum) have a group of active MIDI junkies (self included) that are about to christen a MIDI driver, and some other stuff. Also, be advised that Lester Hands (Musica, Lyra, etc.) has been seduced by Level II (with a little gentle prodding *8^}), and is working on a windowfied version of OS9 Lyra. -- Pete Lyall (OS9 Users Group V.P.) Eaton Corporation (818)-706-5693 Compuserve: 76703,4230 (OS9 Sysop) OS9 (home): (805)-985-0632 (24hr./1200 baud) Internet: pete@wlbr.eaton.com UUCP: {ihnp4,scgvax,jplgodo,voder}!wlbr!pete