text: fig1 is a block diagram of a controller 10 for a peripheral device , such as an optical disk drive 12 , interconnected with a host processor 14 . the controller 10 includes target interface logic 16 , an optical disk controller 18 and a microprocessor 20 . read only memory ( rom ) 22 and random access memory ( ram ) 24 are associated with the microprocessor 20 . a run length limited ( rll ) circuit 26 passes data to and from the drive 12 . a buffer 28 provides storage for data and an error correcting code ( ecc ) logic circuit 30 provides corrections to the data contained in buffer 28 . an optical disk 32 is loaded into drive 12 for data access . the microprocessor 20 is the system manager for the controller 10 . it controls the optical disk controller 18 , interprets commands and monitors the ecc logic 30 through the optical disk controller 18 . the optical disk controller 18 controls the ecc encoding / decoding and the data buffering process . rom 22 provides for local control storage for the microprocessor 20 while ram 24 provides working storage to the microprocessor 20 . the target interface logic 16 receives commands and data from the host processor 14 . the controller 10 and drive 12 can be interconnected directly with the host 14 or , as illustrated in fig1 can be incorporated into an automated storage and retrieval library system . in addition to the controller 10 and drive 12 , the library includes one or more additional controller and drive units 34 and 36 interconnected with the host 14 through a library controller 38 . the library controller 38 processes data access instructions from the host 14 and directs a disk accessor 40 to retrieve a desired disk from an array of stored disks 42 and mount the disk in a selected drive in the bank 36 . upon completion of the data access , the library controller 38 directs the accessor 40 to remove the disk from the selected drive 36 and replace it in the array 42 . fig2 illustrates an optical disk cartridge for use in the disk drive 12 interconnected with the controller 10 shown in fig1 . a cartridge housing 44 contains the optical disk 32 mounted on a hub 48 . a shutter door 50 on the cartridge 44 is shown in an open position so as to reveal the disk 32 . when the shutter door 50 is in its closed position , dust cannot enter the cartridge 44 and light on the disk 32 , but when the shutter door 50 is open , as it must be for a read / write head to access data on the disk 32 , dust can infiltrate the cartridge 44 and contaminate the surface of the disk 32 . fig3 is a schematic illustration of a track and sector configuration of the optical disk 32 . track t0 is shown as the innermost track on the disk 32 and is located close to the disk hub 48 . track numbering proceeds outwardly from the innermost track t0 to an outermost track tn . in optical disk technology , it is common to provide tracks in a continuous spiral but tracks may alternatively be concentric to each other . the disk 32 is logically divided into sectors such as sectors s0 and s1 . it is common practice to provide seventeen equal angularly spaced sectors around each track . fig4 a and 4b illustrate a diagrammatic layout of tracks and sectors on disk 32 . marks written or read on the disk 32 are typically about one micron in size and are separated from adjacent marks by about one micron . there are typically thousands of marks in a sector along each track . fig4 a shows a temporary defect 60 at sector s2 on track t1 , and a permanent defect 62 at sector 4 on track t2 . when data is written to the disk 32 , the data is verified with a high criteria to assure that over time , the data can be reliably retrieved . data integrity is similarly verified during a read operation .. if the data does not meet the test criteria , as can occur if a defect 60 or 62 is large enough , the data on the defective sectors , or intended for these sectors , are moved to a spare sector . fig4 b is similar to fig4 a and illustrates what frequently happens with the two types of defects over the course of time . note that the temporary defect 60 is no longer at sector s2 , track t1 , but rather has moved to a different sector s2 on track t3 . a moving defect , such as defect 60 , is due to a dust particle moving across the surface of the disk 32 . the other defect 62 at s4 , t2 , is a small permanent defect in fig4 a , perhaps too small to cause the loss of any data at the time of initial format . however , as fig4 b shows , the defect 62 has grown in size over the course of time and can create a problem in adjacent track t1 in sector s4 . growth of the defect 62 is typical of defects in the reactive layer of the disk 32 . because optical disks are used for mass storage , they are often expected to last for many years , creating ample opportunity for the growth of permanent defects . as previously noted , dust particles on an optical lens inside the drive 12 and hardware faults can also cause unreliable sectors . the present invention identifies sectors that are contaminated by dust and sectors that are affected by reactive defects . to make that determination for mo media , defects initially are detected when the mo disk is inserted for the first time into a drive and formatted . in the formatting operation , test data is written to , then read from , each data sector on the disk . thus , it can be ascertained during the initial mo mount which sectors are defective . it is assumed that these defective sectors are due to defects in the active material of the disk rather than dust , because the disk cartridge remained sealed prior to first use . it is also assumed that some of these defects will probably grow over a time . such growth occurs in all directions , that is , a defect can expand along the original track from bit position to bit position , and can also expand onto sectors on adjacent tracks . when worm media is formatted , areas on the disk containing the spare sectors are identified but , because of the non - rewritable nature of worm , no test data are written . therefore , defects are not detected during formatting . defects are , however , detected during actual write operations . if a sector is found to be bad during verification following a write , the data is rewritten in the first available spare sector in the spare sector area . fig5 shows the surface analysis procedure for use in the original formatting process of a new mo disk . in step 500 , the format command is received by the controller 10 from the host 14 and in step 502 a variable m is set equal to the number of sectors to be formatted per disk side . in step 504 , all of the sectors on the disk side are erased and in step 506 a specific pattern is written to each of the sectors . in step 508 a variable n is set equal to zero and in step 510 sector n is read . in step 512 a query is answered as to whether the pattern data which had been written to sector n was read back correctly . if so , a determination is made in step 514 as to whether all sectors have been read . if not , the variable n is incremented to n + 1 in step 516 and a return is made to read and verify the sector in step 510 . when a defective sector is found in step 512 , the address of that sector is stored in ram 24 in step 518 before a return is made to step 510 to inspect the next sector . the surface analysis is complete in step 514 when the patterns have been written to all of the sectors and inspected . the disk 32 , if mo , includes a disk management area ( dma ) containing a disk definition structure ( dds ), a primary defect list ( pdl ) and a secondary defect list ( sdl ). it is assumed that the cartridge has remained sealed prior to the initial formatting of the disk , that there has been no dust contamination and that any errors found during the initial formatting were caused by permanent media defects . upon completion of the surface analysis in step 514 , defective sectors are assigned spare sectors as replacements . the addresses of the defective sectors and the corresponding assigned spare sectors are stored in the pdl area of the dma structure in step 520 . ( alternatively , spare sectors can be assigned , and addresses stored in the pdl , as defects are detected during the certification portion of the formatting process .) in step 522 , an error table is compiled in ram 24 for the particular optical drive used to format the disk 32 as illustrated by the following table 1 : table 1______________________________________drive # 23451 error statisticsfor this mounttime sectors disk temp . perm . sparesstamp operation proc &# 39 ; d . volid errors errors used______________________________________6 / 5 / 92 format 318 , 767 xxxx 0 16 48______________________________________ in this example , all 318 , 767 writable data and spare sectors of an optical mo disk with the volume identification xxxx were formatted in drive # 23451 . ( the 318 , 767 writable sectors of an mo disk comprise 316 , 719 data sectors and 2048 spare sectors .) sixteen permanent errors ( media defects ) were detected and assigned to 48 spare sectors . if the disk is only to be formatted at this time , such as in a process to format all of the disks in a new optical library system , and is to be demounted as determined in step 524 , the data from table 1 is transferred in step 526 to a separate table which maintains error statistics for all of the disks and all of the drives ( as in a library environment ). the table 1 data can then be deleted and new data added when another disk is mounted in the drive . the following table 2 exemplifies a newly established table having only the single entry resulting from formatting disk xxxx on drive # 23451 : table 2______________________________________drive error statisticstime sectors disk temp . perm . spares drivestamp written volid errors errors used ser . # ______________________________________6 / 5 / 92 318 , 767 xxxx 0 16 48 23451______________________________________ tables 1 and 2 can be maintained in non - volatile storage , such as a hard disk , associated with either the library controller 38 or the host 14 . following the establishment or update of table 2 with data from table 1 , additional disks can be formatted , the process ended or actual data recorded to the disk 32 . for mo or worm media , if actual data is now to be recorded to the disk 32 , no demount of the disk 32 is desired in step 524 . for recording data to the disk 32 , or for recording to or reading from a previously formatted disk , a new procedure is invoked , indicated by the arrow to a in fig5 and set forth in the flow chart of fig6 . the disk type and volume identification code are obtained in step 600 and a spare threshold limit is calculated . if the disk is worm , as determined in step 602 , a maximum acceptable rate of usage of secondary spare sectors ( msr ) is calculated in step 603 . this rate relates to the maximum number of secondary spare sectors ( after the sixteen primary spare sectors per track have been used in each of 1156 groups of 256 sectors on each disk side ) to which defective sectors will be allowed to be mapped , relative to the total number of data sectors available , before overusage is flagged . for worm media : ## equ1 ## if it is desired , for example , that overusage of secondary spare sectors is indicated when one - half of the available secondary spares have been used ( that is , k = 50 %), and the media has about 305k data sectors and 340 secondary spare sectors , then : if the disk is mo , as determined in step 602 , an erasable acceptable limit of usage of spare sectors ( eal ) is calculated in step 604 . this limit is the maximum number of secondary spare sectors to which defective sectors will be allowed to be mapped before overusage is flagged . for mo : again , if it is desired that overusage of secondary spare sectors be indicated when one - half of the available spares have been used ( that is , k = 50 %), and the media has a maximum of 2048 spare sectors , then eal =. 5 * 2048 = 1024 . following the calculation of acceptable spare usage in steps 603 or 604 , a determination is made in step 605 whether the disk is &# 34 ; foreign &# 34 ; and not yet listed in table 2 . if the disk is foreign , the number of sectors already written sw to the disk and the number of spare sectors already used ss are obtained in steps 606 and 608 by performing a medium scan of the disk . if the disk is not foreign , the error statistics sw and ss for the volume are obtained from table 2 in step 610 . upon receipt of sw and ss in either step 608 or 610 , the desired read or write operation is performed in step 612 and the number of sectors written w during the operation is obtained and stored in table 1 in steps 614 - 616 . a determination is also made in step 618 of whether a read or write error e occurred during the operation . as a disk is used over a significant period of time , the number of defective sectors can increase significantly . not only can permanent errors from media defects expand and affect adjacent sectors , but dust particles which infiltrate the cartridge during use can cause temporary errors in areas not physically associated with the permanent errors . if no new ( or newly expanded ) errors are detected in step 618 , it is determined in step 620 whether the disk is now to be demounted . if so , table 2 is updated in step 622 with any new statistics from table 1 and the process ends . if the disk is not to be demounted but is to undergo further read or write operations , then the process returns to step 612 . on the other hand , if new errors are detected in mo media in step 618 , the addresses of defective sector locations are stored in the sdl area in the dma structure together with the address of their respective associated replacement sectors . additionally , the number of spare sectors used s is calculated and stored in table 1 , along with the number of errors e , in steps 624 and 626 . a separate table 1 is created for each drive unit in a library environment each time a disk is mounted in the drive unit and an entry is made each time a new error is detected . an updated table 1 for drive # 23451 might resemble the following after formatting and several read / write operations of the disk volume xxxx : table 1______________________________________drive # 23451 error statisticsfor this mounttime sectors disk temp . perm . sparesstamp operation proc &# 39 ; d . volid errors errors used______________________________________6 / 5 / 92 format 318 , 767 xxxx 0 16 486 / 5 / 92 write 1 , 000 xxxx 0 1 36 / 5 / 92 read 50 xxxx 0 0 06 / 5 / 92 read 200 xxxx 1 0 1______________________________________ the total number of spares used ss and sectors written sw are calculated from accumulated data in tables 1 and 2 in step 627 . if the media is worm ( step 628 ), the actual rate of spare usage asr is calculated in step 630 : optionally , if a large number of sectors are written in one operation , asr can be calculated using only the latest entries to table 1 : this can trigger an alert to overusage of spare sectors attributed to a particular drive sooner than if an asr is calculated from accumulated data from tables 1 and 2 ( eq . 3 ). then , in step 632 , it is determined whether the actual rate asr exceeds the maximum acceptable rate msr . if asr exceeds msr in step 632 , the procedure of fig6 jumps to a diagnostic procedure indicated by the arrow to b in fig6 and set forth in the flow chart of fig7 . if asr is less than msr , the procedure returns to step 620 for a demount determination . if the disk is to be demounted , table 2 is updated with table 1 information in step 622 . an updated table 2 might resemble the following after transferring disk volume xxxx / drive # 23451 data from table 1 as well as after read / write operations of other disks and drives ( including an operation in which disk xxxx was mounted in drive # 33246 ): table 2______________________________________drive error statisticstime sectors disk temp . perm . spares drivestamp written volid errors errors used ser . # ______________________________________1 / 9 / 92 50 aaaa 0 0 0 554672 / 2 / 92 200 bbbb 1 0 1 332466 / 5 / 92 318 , 767 xxxx 0 16 48 234516 / 5 / 92 1 , 250 xxxx 1 1 4 234516 / 5 / 92 1 , 000 xxxx 0 1 3 33246______________________________________ if the media is mo and not worm in step 628 , it is determined in step 634 whether the total number of spares used ss exceeds the limit eal . again , optionally , if a large number of sectors are written , the number of spares used s with respect to the sectors written during only the latest operation can be compared with eal . if the limit eal is exceeded , the procedure of fig6 jumps to the diagnostic procedure of fig7 . otherwise , the procedure returns to step 620 for a demount determination as before . referring now to fig7 when the number of spare sectors used exceeds the acceptable limit in step 632 or step 634 , the host 14 is notified in step 700 and drive diagnostics are executed in step 702 . if it is determined in step 704 that the cause of the overusage is a hardware failure , the failed component is identified in step 706 . if a majority of the errors occur across multiple disks on one drive in a library ( step 707 ), then the host is notified in step 708 for appropriate repairs to be initiated . if the problem is not a hardware failure , it is initially assumed that the disk or the drive lens , or both , need cleaning and the host is notified to initiate lens and disk cleaning in steps 710 and 712 . the next set of steps depends on which type of media is involved . if the disk is mo ( step 714 ), an attempt is made in step 716 to reclaim defective data sectors and associated spare sectors . there are several techniques for reclaiming the sectors , three of which are suggested here . one is to consider the reclaimed data sectors as new spares ; the second is to move customer data from the spare sectors back to the original , reclaimed , sectors on the disk ; and the third is to restore the reclaimed sector to the user area for future write operations while leaving the user data in the spare area .. when , during a reclamation process , data is to be written back from a spare sector to the associated data sector , as in the second suggested technique , the rewritten data verified and , if valid , the sdl is corrected and table 1 updated . if the data written to any associated data sector is invalid , that reclamation is considered unsuccessful , the cause assumed to be defective media , and no change to the sdl or table 1 is made . after reclaiming as many spares as possible in step 716 , table 2 is updated in step 718 . after cleaning and reclamation ( if mo media ), a determination is made in step 720 whether the problem still exists by again determining whether ss ≧ eal . if the problem has been corrected and the spare sector usage is below the allowable limit , the process restarts in step 726 for further operations . if the problem remains , the host is notified in step 722 of possible media deterioration ( probably caused by growth in permanent defects ). to preserve the data on the disk , it is copied onto a new disk in step 724 ( after formatting , if necessary ) and the process begins again in step 726 . if the disk is worm ( step 714 ), then defective data sectors and associated spare sectors cannot be reclaimed and reused . instead , a determination is made in step 715 whether the disk had previously been cleaned . if the disk was cleaned before and if , after reading or writing , there continues to be a problem with the media , it is recommended that the disk be copied . therefore , the host is notified , the disk copied and the procedure restatted in steps 722 - 726 . if the disk had not been previously cleaned , the procedure is restarted in step 726 . while the invention has been particularly shown and described with reference to preferred embodiments thereof , it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention :