BACKUP COPYING OF DATA TO A TAPE UNIT WITH A CACHE MEMORY

Abstract: A problem with tape units (TU) arises when writing of data onto a tape is not successful. The computer does not know which blocks (1-25) have been stored successfully. Data blocks are buffered in a ring buffer for so long that one can be sure that the storing on the tape (TA) is successful. The ring buffer can be implemented as buffer areas (BA1, BA2) in disk units (W1, W2). Data blocks are stored not only in the tape unit but also in the first buffer (BA1), until it is filled. Then blocks are stored in the second buffer (BA2), until this too is filled, and the first buffer (BA1) is used again. When there is a problem with the tape unit, the tape unit is re-initialized, whereby the data in the tape memory (TM) is lost. Loss of data is prevented by reading the data from the ring buffer.

Description: Backup copying of data to a tape unit with a cache memory The invention relates to a method for storing data in a tape unit provided with a cache memory. The invention also relates to an apparatus implementing the method concerned. Further, the invention relates to a method and apparatus for reading data that has been stored in accordance with the invention from the tape unit. Fig. 1 shows the parts of a computer system that are essential to the invention. A central processing unit CPU is here considered to contain all necessary parts that have not been specifically mentioned, such as a main memory, display unit, keyboard, etc. For the duration of a power failure, the programs and other information are stored in Winchester disk units Wl and W2, two of which are shown in fig. 1 by way of an example. A disk controller, or interface IF, of the computer of fig. 1 comprises two buses for disk units, one for each disk unit Wl and W2. Tape units are often used in computer systems to back up storing of data in a disk unit. Data may be stored either for backup copying or for transmission of data to some other place, e.g. from an exchange to an billing centre. Block TU (Tape Unit) in fig. 1 shows this kind of a tape unit, or tape recorder. In distributed computer systems, often only one computer is provided with a tape unit. The data of the other computers (CPU') can be stored in the common tape unit via a junction cable C. Tape units are usually divided into two groups on the basis of the way the tape moves: start/stop tape units and streamer tape units. In the former, the tape is started for writing a data block and stopped after the writing. In streamer tape units, the tape moves basically during the entire backup copying process. In order that the tape could be kept moving even when the computer doing the backup copying performs some other functions, tape units are usually provided with cache memories. Such a cache memory is indicated in fig. 1 by block TM (Tape Memory) . When the tape unit TU has received a data block from the computer CPU, it supplies a signal to the computer CPU, acknowledging the reception of the block. The computer may then search a disk unit Wl, W2 for the next block. The computer, however, cannot be absolutely certain that the block has really been written onto the tape. A problem arises when for some reason or other the transfer of data from the tape memory TM onto the tape TA has not been successful. There may a weak point in the tape, or some other temporary malfunction may interfere with the storing process. In that case, the tape unit TU will notice after a period of time that the storing has failed. Even if the tape unit TU then sent the computer CPU an appropriate error message, the computer CPU would not know which blocks have been stored successfully and which have not. In prior art solutions, the whole storing process must then be repeated, which means a corresponding waste of time. In addition, it should be possible to tell the data transmitting applications in computers CPU and CPU' that the storing will have to be re-started from the beginning. This may sometimes require a change in the applications of different computers. In backup copying, for example, the whole content of the disk units is not always copied but only the areas that have changed since the last backup copy. A problem that may then arise is that a data-transmitting application has marked the areas as backup copied areas. If such a partial backup copying process were repeated, it would no longer be possible to know which areas have changed since the last backup copy. Correspondingly, when a tape unit is used, for example, for transferring billing information, the data-transmitting program may have marked the information as having been sent, and so it may not be possible to send the same information again. European Patent Application 0,096,456 teaches a tape unit comprising a cache memory. If the unit malfunctions, the data contained in the cache memory can be rewritten onto the tape. In real time systems, the art disclosed in the citation does not provide sufficient protection, for example, in a situation where the tape unit itself or the cache memory of the unit is damaged. The object of the invention is thus to provide a method and an apparatus for implementing the method in which the above problems concerning reliability and wasted time are eliminated. The object of the invention is achieved by methods and systems which are characterized by what is stated in the independent claims. Preferred embodiments are presented in the dependent claims. The basic idea of the invention is that so much data to be stored is buffered in a ring buffer external to the tape unit for so long that one can be sure that the storing on the tape has been successfully completed. The advantage of the method and system according to the invention is that the storing becomes more reliable and less time is wasted. Another advantage is that the process according to the invention is largely transparent to the data- transmitting computers and the applications operating in them. Few or no changes at all are thus needed in the applications. In the following the invention will be described in greater detail with reference to preferred embodiments illustrated in the accompanying drawings, in which fig. 1 shows the parts of the invention that are essential to a computer system, and fig. 2 illustrates data blocks stored on a tape. With reference to fig. 1, loss of data is avoided in the invention by also copying the data stored in a tape unit TU to a ring buffer that is external to the tape unit. The ring buffer could be implemented, for example, as a memory block (not shown) formed e.g. of a part of the main memory of a computer CPU. The memory block is preferably of the same size as the tape memory TM of the tape unit TU. Two pointers are arranged in the memory block that serves as a ring buffer: one pointer for writing to the memory and one for reading from the memory. The pointers are incremented after a reading function and a writing function, respectively. When one of the pointers grows bigger than the maximum address in the memory block that serves as a ring buffer, the pointer concerned is returned to the minimum address of the memory block. If a temporary malfunction is detected in the tape unit TU, the copying can be interrupted until the information has been successfully transferred from the ring buffer to the tape TA. If a new attempt fails as well, the tape can be changed and the entire content of the ring buffer copied onto the new tape. If for some reason the ring buffer is bigger than the tape memory TM of the tape unit TU, it is sufficient to copy so much data from the ring buffer as the tape memory TM can hold. A ring buffer formed of the main memory would be quick and technically simple to implement. A problem, however, is that it does not safeguard against power failure, and it would become unduly expensive to provide such a safeguard. Less investments are needed if the invention is implemented by simulating the ring buffer in disk units Wl and W2, which may be disks that are used in the computer for other purposes. With regard to the invention, disk units Wl and W2 can also be one and the same disk unit. The simulation of the ring buffer in disk units Wl and W2 can be implemented, for example, by reserving predetermined buffer areas BA1 and BA2 in disk units Wl and W2. The size of the buffer area is optimally identical to that of the tape memory TM of the tape unit TU. The buffer areas can be processed as disk files, but they can also be implemented in other ways, for example by directly pointing at certain absolute storage addresses of disk units Wl and W2. The storage addresses are called blocks in SCSI disks and usually sectors in other types of disk units. Each data block that is stored in the tape unit TU is also stored in buffer area BA1 until the buffer area is filled. After this, the data blocks to be stored in the tape unit TU are stored in buffer area BA2, until this area too is filled, and then buffer area BA1 is used again, etc. The program responsible for storing naturally contains information, e.g. in the form of a parameter, indicating which buffer area BA1, BA2 has been used last. In addition, the information can be stored e.g. as a certain kind of data record as the first record of the buffer area, whereby the first record is used only as a time stamp. Alternatively, the disk control software of the computer can mark the time when the record was last changed in the directory. If the storing has to be continued after a re-start, it is possible to conclude from the time stamps of the buffer areas which buffer area has been used last. With regard to the invention, it is not essential whether the two buffer areas BA are located in the same disk unit or two different disk units Wl and W2. Even a single buffer area is often sufficient. Two separate buffer areas must be used, for example, when the opening of a file in the writing mode erases the earlier content of the file. Referring to fig. 1, we shall now describe how the buffer areas BA1, BA2 are used in problematic situations. For illustrative purposes, let us simply assume that the size of the tape memory TM of the tape unit is 10 data blocks. Let us also assume that the first 25 data blocks have been transferred to the tape unit TU (but not necessarily onto the tape) without an error message. After this, an error message is received from the tape unit TU, and the unit is re-initialized. The situation in the buffer areas BA1 and BA2 is the following. The first 10 data blocks 1-10 were stored in buffer area BA1. The next 10 data blocks 11-20 were stored in buffer area BA2. The last 5 data blocks 21- 25, in turn, have been stored at the beginning of buffer area BA1, in the area corresponding to the first five blocks. From fig. 2 it may seem that data blocks 6-10 are still stored at the end of buffer area BA1. This is not necessarily the case, at least not in all operating systems. When buffer area BA1 was last opened for writing, e.g. as a file, the disk control software may have reset the size of the file. It is then no longer possible to use that part of buffer area BA1 which was written to in the previous round. Since the error message was received at block 25 and the size of the tape memory is 10 data blocks, one can assume that at least the first 15 blocks have been successfully stored on the tape. The question marks at blocks 16-25 indicate that the fate of these blocks is not certain. If the tape unit TU is here re¬ initialized, the data located in its tape memory TM will probably be lost. Since the size of buffer areas BA1 and BA2 corresponds to the size of the tape memory TM, the data located in the tape memory can also be read from buffer areas BA1 and BA2. The operation now continues such that the data-transmitting application is commanded to temporarily interrupt the transmission of data. The filling of the active buffer area (here BA1) is simultaneously stopped, for example, by closing the file concerned. The cause of the problem is then eliminated, for example, by re-initializing the tape unit TU . Data blocks 16-20 are then copied from buffer area BA2 onto the tape TA. After this, data blocks 21-25 are copied from buffer area BA1 to the tape TA. Both buffer areas BA1 and BA2 can now be closed, and they can be re-filled starting e.g. from the beginning of the first buffer area BA1, and the data-transmitting application can be informed that the transmission of data can be continued. The data can be copied onto the tape TA, for example, by transferring the data to the tape memory TM of the tape unit TU, commanding the tape unit to empty the tape memory TM onto the tape TA and observing the status of the tape unit TU. If the tape unit TU sends an error message, the cause of the error must be found and eliminated, for example, by changing the tape TA. 789 PC17FI96/00588 Fig. 2 shows a possible order of the data blocks of the tape produced in the process. From the error message sent by the tape unit TU it was possible to conclude that the error occurred at one of blocks 16-25. Let us assume, by way of an example, that the error occurred at block 19. The first 18 data blocks were thus successfully stored on the tape. Subsequently, data blocks 16-25 were stored on it to be on the safe side. Blocks 16-18 are thus on the tape twice. It is also possible that the first set of blocks 16-18 are on a different tape from the second set of blocks 16-18. Since the data blocks to be stored on the tape also contain the identifier of the block, the identifiers can be used for preventing one and the same block from being returned to the application twice. The duplication could also be prevented e.g. by keeping account of the biggest block identifier that has been read. When during the reading process a block is found in the material that has an identifier that is smaller than or equal to an identifier that has already been read, the block can be rejected. It is obvious to a person skilled in the art that as the art develops, it will be possible to implement the basic idea of the invention in many different ways. The invention and its embodiments are not limited to the examples described above but they can vary freely within the scope of the claims .

Claims: Claims 1. A method for storing data on a tape (TA) of a tape unit (TU) provided with a tape memory (TM) , in which method the data to be stored is divided into blocks (1-25) and the blocks are written to the tape unit (TU) , the method being c h a r a c t e r i z e d in that - the blocks (1-25) to be stored are also written to a ring buffer (BA1, BA2) that is external to the tape unit and is at least as big as the tape memory (TM) of the tape unit, and - when the tape unit malfunctions, the blocks contained in the ring buffer are written to the tape unit as soon as the tape unit is again ready to operate, whereby each block (1-25) is written onto the tape at least once. 2. A method according to claim 1, c h a r a c t e r i z e d in that when the blocks have been written from the ring buffer (BA1, BA2) to the tape unit (TU) , the tape unit is commanded to write the blocks from the tape memory (TM) to the tape (TA) . 3. A method according to claim 1 or 2, c h a r a c t e r i z e d in that the buffer memory (BA1, BA2) is formed of a random access memory (RAM) . 4. A method according to claim 3, further c h a r a c t e r i z e d in that the random access memory (RAM) forming the ring buffer (BA1, BA2 ) is safeguarded against power failure. 5. A method according to claim 1 or 2, c h a r a c t e r i z e d in that the buffer memory (BA1, BA2) is formed as at least one predetermined area (BA1) in at least one disk unit (Wl) . 6. A method according to claim 5, c h a r a c t e r i z e d in that the ring buffer (BAl, BA2) is formed as at least two predetermined areas (BAl, BA2) in at least one disk unit (Wl) . 7. A method for reading data from a tape (TA) of a tape unit (TU) when data has been stored as blocks that comprise the identifier of the block (1-25) , in which method the data is read from the tape unit (TU) as blocks (1-25), the method being further c h a r a c t e r i z e d by keeping account of and maintaining the biggest block identifier that has been read, and - in response to the block (1-25) identifier being smaller than or equal to the block identifier already read, rejecting the block concerned. 8. A computer system comprising at least one computer (CPU) having a disk unit (Wl) and a tape unit (TU) provided with a tape memory (TM) for storing data as blocks (1-25) , c h a r a c t e r i z e d by - the computer system also comprising a ring buffer (BAl, BA2) that is external to the tape unit and is at least as big as the tape memory (TM) of the tape unit, - the computer (CPU) being arranged to store the data blocks (1-25) not only in the tape unit (TU) but also in the ring buffer (BAl, BA2) and, when the tape unit malfunctions, to write the blocks contained in the ring buffer (BAl, BA2) to the tape unit (1-25) as soon as the tape unit is again ready to operate, whereby each block (1-25) is written onto the tape at least once. 9. A computer system according to claim 8, c h a r a c t e r i z e d in that the ring buffer (BAl, BA2) is formed of a random access memory (RAM) . 10. A computer system according to claim 9, c h a r a c t e r i z e d in that the random access memory (RAM) forming the ring buffer (BAl, BA2) is safeguarded against power failure. 11. A computer system according to claim 8, c h a r a c t e r i z e d in that the ring buffer (BAl, BA2) is formed as at least one predetermined area (BAl) in at least one disk unit (Wl) . 12. A computer system according to claim 11, c h a r a c t e r i z e d in that the ring buffer (BAl, BA2) is formed as at least two predetermined areas in at least one disk unit (Wl, W2) . 13. A computer system comprising at least one computer (CPU) that contains a tape unit (TU) on a tape (TA) of which data is stored as blocks (1-25) that comprise the identifier of the block, c h a r a c ¬ t e r i z e d in that upon reading data blocks (1-25) from the tape unit (TU) , the computer (CPU) is arranged to - keep account of and maintain the biggest block identifier that has been read, and compare the last read block (1-25) identifier with the biggest block identifier that has been read, and in response to the last read block (1- 25) identifier being bigger than the biggest block identifier so far read, transferring the block (1-25) to the address indicated by the identifier, and in other case rejecting the block.

Inventors: HYYTIAEINEN HARRI, HYYTIAEINEN, HARRI
Applicants: HYYTIAEINEN HARRI, NOKIA TELECOMMUNICATIONS OY, HYYTIAEINEN, HARRI
Application year: 1996
Main classification: G06F13
IPC codes: G06F3