A method and system for optimizing tape indexing
By writing data into tape storage without partitioning, and by using the methods of marking records and reserving index space, the problems of wasted space and low read efficiency in tape storage are solved, and the effect of fast index loading is achieved.
Patent Information
- Application Number
- CN202410305236.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-18
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2044-03-18
AI Technical Summary
Existing magnetic tape storage methods waste track space and have low read efficiency when storing indexes, partitioned storage methods are fast when reading indexes but waste a lot of space, and unpartitioned storage has low read efficiency.
Data is written in a non-partitioned manner. The end position of the record is marked and filled with random content. Index space is reserved and the index position is stored in the tape firmware. The next time the data is read, it is directly located at the beginning of the track to read the data.
While saving tape space, it achieves fast index loading and reduces waiting time.
Smart Images

Figure CN118312093B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of magnetic tape storage, in particular to a magnetic tape index optimization method and system. BACKGROUND
[0002] At present, the magnetic tape storage generally adopts the partition mode, and the index is stored in the first partition and the data is stored in the second partition. The magnetic track is stored in a shingle mode, and the first track will be covered when writing the first track, and the second and third tracks. Therefore, the first partition and the second partition need to waste two tracks. In this way, although the index can be quickly read next time, two track spaces are wasted.
[0003] If the partition mode is not used, the index is directly stored at the end, and the index may need to be rewound to a relatively rear position to be read at the first time, which is low in efficiency.
[0004] In order to overcome the defects of the above two existing magnetic tape storage modes, the present application provides a magnetic tape index optimization method and system. SUMMARY
[0005] In order to overcome the problems in the prior art, the purpose of the present application is to provide a magnetic tape index optimization method and system, which can realize fast loading of the index on the premise of saving the magnetic tape space.
[0006] The present application adopts the following scheme to realize:
[0007] A magnetic tape index optimization method, the method steps are as follows:
[0008] Step 1: The magnetic tape is not partitioned, and the data is written;
[0009] Step 2: After writing the data, if the magnetic tape is not full and there is a remaining empty track, the end position is recorded by marking, and random content is filled to the next track start position of the magnetic tape;
[0010] Step 3: The index is written at the next track start position;
[0011] Step 4: If the data is appended, the end position is rolled back according to the mark to continue writing the data;
[0012] Step 5: If the data has been written to the last track, the index space is reserved, the reserved space is filled with random numbers first, then the data is written at the rear, and after the writing is completed, the reserved index space is returned to save the index;
[0013] Step 6: When saving the index, the index position is saved to the magnetic tape firmware.
[0014] Furthermore, in step 2, the end position is recorded by marking it: a special end marker symbol is written at the end position and the end position is recorded.
[0015] Furthermore, the step 5 of filling the reserved space with random numbers specifically involves estimating the space occupied by the index based on the current size of the number of index files, wherein the size of the space is at least twice the size of the number of index files.
[0016] Furthermore, after saving the index position to the tape firmware in step 6, the next time the tape is read, the data is read from the beginning of the corresponding track using the index position recorded in the firmware.
[0017] A magnetic tape indexing optimization system, the system comprising: a data writing module, a record marking module, an index writing module, an append data module, an index space reservation module, and a storage module;
[0018] The data writing module is used to write data onto the magnetic tape without partitioning it.
[0019] The marking and recording module is used to mark the end position of the tape and fill it with random content to the beginning position of the next track after the data writing is completed, if the tape is not full and there are still empty tracks.
[0020] The index writing module is used to write the index at the beginning position of the next track;
[0021] The append data module is used to roll back to the end position according to the marker if append data is to be added and continue writing data.
[0022] The index space reservation module is used to reserve index space if the data being written has reached the last track. The reserved space is first filled with random numbers, and then the data is written from the end. After the writing is completed, the system returns to the reserved index space to save the index.
[0023] The storage module is used to save the index position to the tape firmware when saving the index.
[0024] Furthermore, the marking and recording module specifically marks the end position by writing a special end mark symbol at the end position and recording the end position.
[0025] Furthermore, the method of filling the reserved space with random numbers in the append data module specifically involves estimating the space occupied by the index based on the current size of the number of index files, wherein the size of the space is at least twice the size of the number of index files.
[0026] Further, after the index position is saved to the tape firmware in the saving module, the next time the tape is read, the index position recorded by the firmware is used to read data at the beginning of the corresponding track.
[0027] The present application has the following advantages:
[0028] The present application provides a tape index optimization method and system. By marking the end position, the next time data is written, the marker can be rolled back to the last position where data was written. By indexing, the next time the tape is read, the index position recorded by the firmware is used to read data at the beginning of the corresponding track, reducing waiting time and enabling fast loading of the index under the premise of saving tape space. BRIEF DESCRIPTION OF DRAWINGS
[0029] Figure 1 The flowchart of the method of the present application is shown in the figure.
[0030] Figure 2 The structure block diagram of the system of the present application is shown in the figure. DETAILED DESCRIPTION
[0031] The present application will be further described below with reference to the accompanying drawings.
[0032] Referring to Figure 1 A tape index optimization method, the steps of which are as follows:
[0033] Step 1: The tape is not partitioned, and data is written.
[0034] Step 2: After the data is written, if the tape is not full and there are remaining empty tracks, the end position is recorded by a marker, and random content is filled into the next track start position of the tape.
[0035] Step 3: An index is written at the next track start position.
[0036] Step 4: If data is appended, the marker is rolled back to the end position to continue writing data.
[0037] Step 5: If the data written has reached the last track, an index space is reserved, which is first filled with random numbers, and then data is written at the back, after which the reserved index space is returned to save the index.
[0038] Step 6: When the index is saved, the index position is saved to the tape firmware.
[0039] The present application will be further described below with reference to a specific embodiment.
[0040] A tape index optimization method, the steps of which are as follows:
[0041] Step 1. The magnetic tape is not partitioned and data is written, for example: file 1, file 2, file 3...file 1000 are written;
[0042] Step 2. If there are remaining empty tracks after the data is written, the end position is recorded by a marker and random content is filled to the next track start position of the magnetic tape, for example: after file 1000 is written, the current track occupancy is read, track 1 occupies 80% of the space and track 2 occupies 0% of the space, which indicates that the first track is written, the end file END1 is written with a marker, and the remaining 20% of the first track is filled with a random file 1;
[0043] Step 3. An index is written at the start position of the next track, for example: when the filling is to track 2, the occupancy is greater than 0%, the index is started to be written;
[0044] Step 4. If data is to be appended, it is rolled back to the last marked end position to continue writing, for example: if file 1001~file 2000 is to be written, it is rolled back to the end file END1 position to start writing file 1001~file 2000;
[0045] Step 5. If the data written has reached the last track, the index space needs to be reserved, the reserved space is filled with random numbers (then the index occupancy space is estimated according to the size of the current index file, and twice the size is reserved), and then the data is written at the back, after the writing is completed, the reserved index space is returned to save the index. For example: if file 1500 is written to the last track, the current index of 1500 files occupies 15M, and there are 500 files, then a space of 40M is reserved, which is twice the size of the reserved index space of 20M, after the random numbers are filled, file 1501~file 2000 is started to be written. After the writing is completed, the file content is recorded to the index, and is saved to the 40M area reserved in the track;
[0046] Step 6. In the previous step, when the index is saved, the index position is saved to the firmware of the magnetic tape. Next time when the magnetic tape is read, the index position recorded by the firmware is used to read the data at the corresponding track start position, so that the waiting time is reduced.
[0047] The index offset position A is saved in the firmware summary, and next time when the magnetic tape is read, the index at the start position of a certain track can be located according to the offset position A, so that the waiting time is reduced.
[0048] Referring to Figure 2 A magnetic tape index optimization system, the system comprising: a data writing module, a marker recording module, an index writing module, an appended data module, an index space reserving module and a saving module;
[0049] The data writing module is used for writing data without partitioning the magnetic tape;
[0050] The mark recording module is used for recording the end position and filling random content to the next track start position of the magnetic tape if the magnetic tape is not full and there is remaining empty track after writing data;
[0051] The index writing module is used for writing index at the next track start position;
[0052] The additional data module is used for rolling back to the end position to continue writing data according to the mark if additional data is added;
[0053] The index space reserving module is used for reserving index space if the writing data has reached the last track, filling the reserved space with random numbers first, then writing data at the rear, and returning to the reserved index space to save index after writing is completed;
[0054] The saving module is used for saving the index position to the magnetic tape firmware when saving index.
[0055] In an embodiment of the present application, the mark recording module records the end position by writing a special end mark symbol at the end position and recording the end position.
[0056] In an embodiment of the present application, the additional data module fills the reserved space with random numbers by estimating the space occupied by index according to the size of the current index file number, and the size of the space is at least twice the size of the index file number.
[0057] In summary, the present application provides a magnetic tape index optimization method and system, which can realize fast loading index under the premise of saving magnetic tape space.
[0058] The above only describes the preferred embodiments of the present application, and any changes and modifications made within the scope of the present application should be included in the scope of the present application.
Claims
1. A method for optimizing a magnetic tape index, the method comprising: The method steps are as follows: Step 1: the magnetic tape is not partitioned, and data is written; Step 2: after writing the data, if the magnetic tape is not full and there are remaining empty tracks, the end position is recorded by marking, and random content is filled to the next track start position of the magnetic tape; Step 3: an index is written at the next track start position; Step 4: if data is appended, the writing of data is continued according to the marking to the end position; Step 5: if the writing of data has reached the last track, an index space is reserved, the reserved space is first filled with random numbers, then data is written at the rear, and after the writing is completed, the index is saved at the reserved index space; Step 6: when the index is saved, the index position is saved to the magnetic tape firmware.
2. The method of claim 1, wherein, The end position is recorded by marking in Step 2, specifically, a special end marker symbol is written at the end position, and the end position is recorded.
3. The method of claim 1, wherein, The reserved space is filled with random numbers in Step 5, specifically, the space occupied by the index is estimated according to the size of the current index file number, and the size of the space is at least twice the size of the index file number.
4. The method of claim 1, wherein, After the index position is saved to the magnetic tape firmware in Step 6, the next time the magnetic tape is read, data is read at the corresponding track start position through the index position recorded by the firmware.
5. A magnetic tape indexing optimization system, characterized by, The system comprises a data writing module, a marking recording module, an index writing module, a data appending module, an index space reserving module, and a saving module; The data writing module is used for writing data without partitioning the magnetic tape; The marking recording module is used for recording the end position by marking after writing the data, and filling random content to the next track start position of the magnetic tape if the magnetic tape is not full and there are remaining empty tracks; The index writing module is used for writing an index at the next track start position; The data appending module is used for continuing to write data according to the marking to the end position if data is appended; The index space reserving module is used for reserving an index space if the writing of data has reached the last track, filling the reserved space with random numbers first, then writing data at the rear, and saving the index at the reserved index space after the writing is completed; The saving module is used for saving the index position to the magnetic tape firmware when the index is saved.
6. The magnetic tape indexing optimization system of claim 5, wherein, The end position is recorded by marking in the marking recording module, specifically, a special end marker symbol is written at the end position, and the end position is recorded.
7. The magnetic tape indexing optimization system of claim 5, wherein, The reserved space is filled with random numbers in the data appending module, specifically, the space occupied by the index is estimated according to the size of the current index file number, and the size of the space is at least twice the size of the index file number.
8. The magnetic tape indexing optimization system of claim 5, wherein, After the index position is saved to the magnetic tape firmware in the saving module, the next time the magnetic tape is read, data is read at the corresponding track start position through the index position recorded by the firmware.
Citation Information
Patent Citations
Data processing method and device based on large-scale storage system
CN115756334A
Increasing data storage capacity by reducing index entries
US10453485B1