[go: up one dir, main page]

CN102117623B - Method and device for recovering magnetic tape metadata - Google Patents

Method and device for recovering magnetic tape metadata Download PDF

Info

Publication number
CN102117623B
CN102117623B CN2009102445403A CN200910244540A CN102117623B CN 102117623 B CN102117623 B CN 102117623B CN 2009102445403 A CN2009102445403 A CN 2009102445403A CN 200910244540 A CN200910244540 A CN 200910244540A CN 102117623 B CN102117623 B CN 102117623B
Authority
CN
China
Prior art keywords
file
tape
current
metadata
information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN2009102445403A
Other languages
Chinese (zh)
Other versions
CN102117623A (en
Inventor
闫宁
冯波
杨群
董全武
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Peking University
Peking University Founder Group Co Ltd
Beijing Founder Electronics Co Ltd
Original Assignee
Peking University
Peking University Founder Group Co Ltd
Beijing Founder Electronics Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Peking University, Peking University Founder Group Co Ltd, Beijing Founder Electronics Co Ltd filed Critical Peking University
Priority to CN2009102445403A priority Critical patent/CN102117623B/en
Publication of CN102117623A publication Critical patent/CN102117623A/en
Application granted granted Critical
Publication of CN102117623B publication Critical patent/CN102117623B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Signal Processing For Digital Recording And Reproducing (AREA)
  • Management Or Editing Of Information On Record Carriers (AREA)

Abstract

本发明公开了一种磁带元数据的恢复方法及装置,用以解决现有技术中磁带的元数据存储不安全,导致磁带无法正常使用的问题。该方法确定当前文件的文件头的位置,根据确定的所述文件的文件头位置,读取所述文件头位置存储的所述文件的元数据信息,并保存读取的所述文件的元数据信息。由于在本发明实施例中将每个文件的元数据信息保存在文件的文件头位置,通过读取保存文件头位置的元数据实现对该磁带元数据的恢复,只要磁带未损坏,就可以采用恢复磁带元数据的方法恢复磁带中保存的元数据,从而提高了元数据存储的安全性。

Figure 200910244540

The invention discloses a magnetic tape metadata recovery method and device, which are used to solve the problem in the prior art that the magnetic tape cannot be used normally due to the unsafe storage of the magnetic tape metadata. The method determines the position of the file header of the current file, reads the metadata information of the file stored at the file header position according to the determined file header position of the file, and saves the read metadata of the file information. Because in the embodiment of the present invention, the metadata information of each file is stored in the file header position of the file, the recovery of the tape metadata is realized by reading the metadata stored in the file header position, as long as the tape is not damaged, it can be used The method for restoring tape metadata restores the metadata saved in the tape, thereby improving the security of metadata storage.

Figure 200910244540

Description

一种磁带元数据的恢复方法及装置Method and device for restoring magnetic tape metadata

技术领域 technical field

本发明涉及磁带存储技术领域,尤其涉及一种磁带元数据的恢复方法及装置。The invention relates to the technical field of magnetic tape storage, in particular to a method and device for restoring magnetic tape metadata.

背景技术 Background technique

在广播电视系统中需要管理海量的媒体资源,对于媒体资源中的音视频资源,由于数据量太大,如果采用磁盘将无法满足存储该大量数据的需求,并且由于磁盘的成本较高,因此其经济实用性也不高。所以在广播电视系统中一般都采用磁带存储音视频资源。Massive media resources need to be managed in broadcasting and television systems. For the audio and video resources in the media resources, due to the large amount of data, if the disk is used, it will not be able to meet the demand for storing this large amount of data, and because the cost of the disk is high, so its Economical and practical is also not high. Therefore, tapes are generally used to store audio and video resources in broadcast television systems.

在读写磁带上的音视频资源时,采用线性读写方式,读写的速度较快,但是定位速度较慢。每个音视频资源的文件在磁带中存储时,采用在磁带尾追加的方式。当读取磁带中的文件时,只有移动到磁带中的相应读取点的位置时,才能从该相应读取点位置开始读取该文件内的数据,而移动到该磁带中相应读取点的时间是不固定的,移动的时间与该文件在磁带中的存储位置相关,当该文件在磁带中较靠前的位置存储时,移动到该文件的读取点的时间较短,反之,时间较长。When reading and writing audio and video resources on the tape, the linear reading and writing method is adopted, and the reading and writing speed is fast, but the positioning speed is slow. When the file of each audio and video resource is stored in the tape, it adopts the method of appending at the end of the tape. When reading a file in the tape, only when moving to the position of the corresponding read point in the tape, can the data in the file be read from the position of the corresponding read point, and move to the corresponding read point in the tape The time is not fixed, and the moving time is related to the storage position of the file on the tape. When the file is stored at an earlier position on the tape, the time to move to the reading point of the file is shorter. On the contrary, A long time.

因此,为了准确的确定每个文件读取点的位置,一般将磁带中存储的每个文件的属性信息在管理该磁带的存储软件中采用元数据的形式记录,该元数据中记录了每个文件的大小,以及该文件在哪个磁带上的标识信息。读写磁带中的文件时,通过元数据中记录的信息,确定该文件所在的磁带,以及在磁带中的位置,从而可以根据相应磁带,相应位置存储的文件,获得该文件中的正确的数据。因此元数据对于磁带相当的重要,当元数据丢失时,磁带的记录结构将丢失,整个磁带将无法正常使用。Therefore, in order to accurately determine the position of the reading point of each file, the attribute information of each file stored in the tape is generally recorded in the form of metadata in the storage software that manages the tape, and the metadata records each The size of the file, and information identifying which tape the file is on. When reading and writing a file on a tape, the information recorded in the metadata is used to determine the tape where the file is located and the location in the tape, so that the correct data in the file can be obtained according to the corresponding tape and the file stored in the corresponding location . Therefore, metadata is very important for tapes. When metadata is lost, the recording structure of the tape will be lost, and the entire tape will not be used normally.

由于元数据的重要性,在现有技术中可以通过备份元数据的形式,提高该磁带存储的可靠性,但是相对于磁带,只要该元数据及备份的元数据丢失,该磁带将不可用。因此现有技术中元数据的存储并不安全,无法保证磁带的正常使用。Due to the importance of metadata, the reliability of tape storage can be improved by backing up metadata in the prior art, but compared with tape, as long as the metadata and the backup metadata are lost, the tape will be unusable. Therefore, the storage of metadata in the prior art is not safe, and the normal use of the magnetic tape cannot be guaranteed.

发明内容 Contents of the invention

有鉴于此,本发明实施例提供一种磁带元数据的恢复方法及装置,用以解决现有技术中磁带的元数据存储不安全,导致磁带无法正常使用的问题。In view of this, the embodiments of the present invention provide a method and device for recovering tape metadata to solve the problem in the prior art that the tape metadata cannot be used normally due to insecure storage of the tape metadata.

本发明实施例提供的一种磁带元数据的恢复方法,针对磁带中的每个文件执行下列步骤:A method for recovering tape metadata provided in an embodiment of the present invention performs the following steps for each file in the tape:

确定当前文件的文件头的位置,其中:Determines the location of the file header of the current file, where:

当所述当前文件为所述磁带的第一个文件时,根据所述磁带中存储的所述第一个文件的格式信息,所述格式信息用于标识所述第一个文件位于所述磁带的第几个磁带块,移动对应数量的磁带块,将移动后的位置作为所述第一个文件的文件头位置;When the current file is the first file of the tape, according to the format information of the first file stored in the tape, the format information is used to identify that the first file is located on the tape The number of tape blocks, move the corresponding number of tape blocks, and use the moved position as the file header position of the first file;

当所述当前文件非所述磁带的第一个文件时,根据读取的所述当前文件的上一个文件的元数据信息中记录的所述上一个文件的属性信息,确定由所述上一个文件移动到所述当前文件需移动的磁带块的数量,移动对应数量的磁带块,将移动到的位置作为所述当前文件的文件头位置,其中所述当前文件的文件头位置为所述上一个文件的文件尾位置;When the current file is not the first file of the magnetic tape, according to the attribute information of the previous file recorded in the metadata information of the previous file of the current file read, it is determined that the previous The number of tape blocks that need to be moved when the file is moved to the current file, move the corresponding number of tape blocks, and use the moved position as the file header position of the current file, wherein the file header position of the current file is the above The end-of-file position of a file;

根据确定的所述当前文件的文件头位置,读取所述文件头位置存储的所述当前文件的元数据信息,并保存读取的所述当前文件的元数据信息。According to the determined file header position of the current file, read the metadata information of the current file stored at the file header position, and save the read metadata information of the current file.

本发明实施例提供的一种磁带元数据的恢复装置,针对磁带中存储的每个文件执行元数据恢复,所述装置包括:A tape metadata recovery device provided in an embodiment of the present invention performs metadata recovery for each file stored in the tape, and the device includes:

确定模块,用于确定当前文件的文件头位置;所述确定模块包括第一确定单元和第二确定单元,其中:A determining module, configured to determine the file header position of the current file; the determining module includes a first determining unit and a second determining unit, wherein:

第一确定单元,用于确定所述当前文件为所述磁带的第一个文件时,根据所述磁带中存储的所述第一个文件的格式信息,所述格式信息用于标识所述第一个文件位于所述磁带的第几个磁带块,移动对应数量的磁带块,将移动后的位置作为所述第一个文件的文件头位置;The first determining unit is configured to, when determining that the current file is the first file of the magnetic tape, according to the format information of the first file stored in the magnetic tape, the format information is used to identify the first file A file is located in which tape block of the tape, move the corresponding number of tape blocks, and use the moved position as the file header position of the first file;

第二确定单元,用于确定所述当前文件非所述磁带的第一个文件时,根据读取的所述当前文件的上一个文件的元数据信息中记录的所述上一个文件的属性信息,确定由所述上一个文件移动到所述当前文件需移动的磁带块的数量,移动对应数量的磁带块,将移动到的位置作为所述当前文件的文件头位置,其中所述当前文件的文件头位置为所述上一个文件的文件尾位置;The second determination unit is configured to determine that the current file is not the first file of the magnetic tape, according to the attribute information of the previous file recorded in the metadata information of the previous file of the current file read. , determine the number of tape blocks that need to be moved from the previous file to the current file, move the corresponding number of tape blocks, and use the moved position as the file header position of the current file, wherein the current file’s The file header position is the file tail position of the previous file;

恢复模块,用于根据确定的所述当前文件的文件头位置,读取所述文件头位置存储的所述当前文件的元数据信息,并保存读取的所述当前文件的元数据信息。The recovery module is configured to read the metadata information of the current file stored at the file header position according to the determined file header position of the current file, and save the read metadata information of the current file.

本发明实施例提供了一种磁带元数据的恢复方法及装置,该方法包括:确定当前文件的文件头的位置,根据确定的所述文件的文件头位置,读取所述文件头位置存储的所述文件的元数据信息,并保存读取的所述文件的元数据信息。由于在本发明实施例中将每个文件的元数据信息保存在文件的文件头位置,通过读取保存文件头位置的元数据实现对该磁带元数据的恢复,只要磁带未损坏,就可以采用恢复磁带元数据的方法恢复磁带中保存的元数据,从而提高了元数据存储的安全性。The embodiment of the present invention provides a method and device for recovering tape metadata. The method includes: determining the position of the file header of the current file, and reading the file stored at the file header position according to the determined file header position of the file. metadata information of the file, and save the read metadata information of the file. Because in the embodiment of the present invention, the metadata information of each file is stored in the file header position of the file, the recovery of the tape metadata is realized by reading the metadata stored in the file header position, as long as the tape is not damaged, it can be used The method for restoring tape metadata restores the metadata saved in the tape, thereby improving the security of metadata storage.

附图说明 Description of drawings

图1为本发明实施例提供的磁带元数据的恢复过程;Fig. 1 is the recovery process of the magnetic tape metadata that the embodiment of the present invention provides;

图2为本发明实施例提供的磁带元数据恢复的详细过程;Fig. 2 is the detailed process of tape metadata recovery provided by the embodiment of the present invention;

图3为本发明实施例提供的磁带元数据的恢复装置结构示意图。FIG. 3 is a schematic structural diagram of an apparatus for recovering tape metadata provided by an embodiment of the present invention.

具体实施方式Detailed ways

本发明实施例为了有效的提高磁带元数据信息存储的安全性,提供了一种磁带元数据的恢复方法,该方法针对磁带中的每个文件,执行下列步骤,确定当前文件的文件头的位置,根据确定的所述文件的文件头位置,读取所述文件头位置存储的所述文件的元数据信息,并保存读取的所述文件的元数据信息。由于在本发明实施例中将每个文件的元数据信息保存在文件的文件头位置,通过读取保存文件头位置的元数据实现对该磁带元数据的恢复,只要磁带未损坏,就可以采用恢复磁带元数据的方法恢复磁带中保存的元数据,从而提高了元数据存储的安全性。In order to effectively improve the security of tape metadata information storage, the embodiment of the present invention provides a tape metadata recovery method, the method performs the following steps for each file in the tape to determine the position of the file header of the current file , according to the determined file header position of the file, read the metadata information of the file stored at the file header position, and store the read metadata information of the file. Because in the embodiment of the present invention, the metadata information of each file is stored in the file header position of the file, the recovery of the tape metadata is realized by reading the metadata stored in the file header position, as long as the tape is not damaged, it can be used The method for restoring tape metadata restores the metadata saved in the tape, thereby improving the security of metadata storage.

下面结合说明书附图,对本发明实施例进行详细说明。Embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings.

图1为本发明实施例提供的磁带元数据的恢复过程,该过程包括:Fig. 1 is the recovery process of the magnetic tape metadata that the embodiment of the present invention provides, and this process comprises:

S101:确定当前文件的文件头的位置。S101: Determine the position of the file header of the current file.

其中确定当前文件的文件头的为位置包括:当所述当前文件为所述磁带的第一个文件时,根据所述磁带中存储所述第一个文件的格式信息,所述格式信息用于标识所述第一个文件位于所述磁带的第几个磁带块,移动对应数量的磁带块将移动后的位置作为所述第一个文件的文件头位置;Wherein determining the position of the file header of the current file includes: when the current file is the first file of the tape, according to the format information of the first file stored in the tape, the format information is used for Identify the number of tape blocks where the first file is located on the tape, and move the corresponding number of tape blocks to use the moved position as the file header position of the first file;

当所述文件非所述磁带的第一个文件时,根据读取的所述当前文件的上一个文件的元数据信息中记录的所述上一个文件的属性信息,确定由所述上一个文件移动到所述当前文件需移动的磁带块的数量,移动对应数量的磁带块,将移动到的位置作为所述当前文件的文件头位置,其中所述当前文件的文件头位置为所述上一个文件的文件尾位置。When the file is not the first file of the magnetic tape, according to the attribute information of the previous file recorded in the metadata information of the previous file of the current file read, it is determined that the previous file is Move to the number of tape blocks that need to be moved to the current file, move the corresponding number of tape blocks, and use the moved position as the file header position of the current file, wherein the file header position of the current file is the previous The end-of-file position of the file.

当所述当前文件为所述磁带的第一个文件时,所述方法在确定当前文件的文件头的位置之前还包括:读取所述磁带中磁带头信息,获取所述磁带的属性信息,其中所述磁带的属性信息包括磁带的标识信息,以及该磁带中每个磁带块的容量信息。When the current file is the first file of the tape, before determining the position of the file header of the current file, the method further includes: reading the tape header information in the tape, obtaining the attribute information of the tape, The attribute information of the tape includes identification information of the tape and capacity information of each tape block in the tape.

S102:根据确定的所述文件的文件头位置,读取所述文件头位置存储的所述文件的元数据信息,并保存读取的所述文件的元数据信息。S102: According to the determined file header position of the file, read metadata information of the file stored at the file header location, and save the read metadata information of the file.

所述方法还包括:The method also includes:

判断所述当前文件是否为所述磁带的磁带尾,当确定所述当前文件为所述磁带的磁带尾时,所述磁带元数据的恢复过程结束;judging whether the current file is the tail of the tape, and when it is determined that the current file is the tail of the tape, the restoration process of the tape metadata ends;

当确定所述当前文件非所述磁带的磁带尾时,根据读取的所述当前文件的的元数据信息中记录的所述当前文件的属性信息,确定由所述当前文件移动到所述当前文件的下一个文件的文件头需移动的磁带块的数量,根据确定的所述磁带块的数量,移动到所述当前文件的下一个文件的文件头位置。When it is determined that the current file is not the end of the magnetic tape, according to the attribute information of the current file recorded in the read metadata information of the current file, it is determined to move from the current file to the current The number of tape blocks that the file header of the next file of the file needs to move is moved to the file header position of the next file of the current file according to the determined number of tape blocks.

由于在本发明实施例中在磁带中将每个文件的文件头中保存该文件的元数据信息,因此可以在该磁带的元数据丢失时,通过读取该磁带中每个文件的文件头,获取该磁带的元数据信息,因此,只要该磁带未损坏,或未全部损坏,即可获取该磁带中未损坏部分的文件中保存的元数据信息,对该磁带的元数据进行恢复。Since the metadata information of each file is stored in the file header of each file in the tape in the embodiment of the present invention, when the metadata of the tape is lost, by reading the file header of each file in the tape, Obtain the metadata information of the tape. Therefore, as long as the tape is not damaged, or not completely damaged, the metadata information stored in the files of the undamaged part of the tape can be obtained, and the metadata of the tape can be restored.

在磁带中磁带头及文件的格式固定,一般磁带中第一个磁带块记录的为磁带头信息,该磁带头信息含有磁带标识信息,即磁带卷标信息,磁带块的容量信息等。磁带中存储第一个文件的也具有一定的格式信息,该格式信息用于标识第一个文件位于磁带的第几个磁带块,一般磁带中第三个磁带块用于存储磁带中第一个文件的信息。由于磁带的格式固定,因此根据磁带中存储第一个文件的格式信息,即第三个磁带块为该磁带中存储第一个文件的存储位置,移动两个磁带块的距离到达第三个磁带块位置,将该位置作为该磁带中存储的第一个文件的文件头位置。The format of the tape header and the file in the tape is fixed. Generally, the first tape block in the tape records the tape header information. The tape header information contains the tape identification information, that is, the tape volume label information, the capacity information of the tape block, and so on. The first file stored on the tape also has certain format information. The format information is used to identify the tape block where the first file is located on the tape. Generally, the third tape block in the tape is used to store the first file in the tape. file information. Since the format of the tape is fixed, according to the format information of the first file stored in the tape, that is, the third tape block is the storage location of the first file stored in the tape, move the distance of two tape blocks to reach the third tape The block position as the header position of the first file stored on this tape.

磁带中以磁带块为计量单位,每个磁带块占有固定的容量,并且磁带中每个磁带块的容量的信息也包含在磁带中,并且每个磁带的磁带块的容量可以相同也可以不同。当对磁带的元数据进行恢复时,获取磁带中每个磁带块的容量信息,以便根据该磁带块的容量信息。Tape blocks are used as the unit of measurement in tapes, and each tape block occupies a fixed capacity, and information on the capacity of each tape block in the tape is also included in the tape, and the capacity of each tape block can be the same or different. When restoring the metadata of the tape, the capacity information of each tape block in the tape is obtained, so as to be based on the capacity information of the tape block.

针对保存失效较长的存储介质磁带,在本发明实施例中采用不同的元数据存储方式。采用本发明实施例的元数据的恢复方法,在每个磁带中写入数据时,针对磁带中的每个文件,在磁带中写入该文件时,在该文件的文件头部分根据该文件的属性信息,确定元数据中记录的信息,并将该记录了该文件属性信息的元数据存储在该文件的文件头,其中,该元数据中记录的该文件的属性信息包括:该文件的标识信息,及该文件包含的字节数量信息等,并且该属性信息中还包括:文件所属的节目ID,节目名称等和业务相关的信息。其中该文件的标识信息用于区别该文件,每个文件具有唯一的标识信息,其中该包含的字节的数量为该文件的大小占用的字节数信息。由于文件的属性信息中包括文件包含的字节数量信息,即文件占用的字节数,当已知磁带块的容量及文件占用的字节数时,可以计算该文件占用的磁带块的数量。For storage medium tapes with long storage failures, different metadata storage methods are adopted in the embodiments of the present invention. Using the metadata recovery method of the embodiment of the present invention, when writing data in each tape, for each file in the tape, when writing the file in the tape, in the file header part of the file according to the Attribute information, determine the information recorded in the metadata, and store the metadata recording the attribute information of the file in the file header of the file, wherein the attribute information of the file recorded in the metadata includes: the identification of the file information, and the number of bytes contained in the file, etc., and the attribute information also includes: the program ID to which the file belongs, the program name, and other business-related information. The identification information of the file is used to distinguish the file, and each file has unique identification information, wherein the number of contained bytes is information on the number of bytes occupied by the size of the file. Since the attribute information of the file includes the number of bytes contained in the file, that is, the number of bytes occupied by the file, when the capacity of the tape block and the number of bytes occupied by the file are known, the number of tape blocks occupied by the file can be calculated.

当在每个文件的文件头中保存了该文件的元数据信息时,磁带中即包含了每个文件的元数据信息,因此,只要磁带安全,未受损坏,或未全部损坏,该磁带中的未损坏部分保存的元数据信息即可使用,即可被恢复。When the metadata information of the file is saved in the file header of each file, the metadata information of each file is contained in the tape. Therefore, as long as the tape is safe, not damaged, or not completely damaged, the tape in the The metadata information saved in the undamaged part of the file can be used and can be restored.

当存储该磁带元数据的文件或数据库可以使用时,或该文件或数据库中保存的磁带的元数据信息未丢失时,可以根据该文件或数据库中保存的该磁带的元数据信息进行磁带中每个文件的读写操作,当该文件或数据库中保存的磁带的元数据信息丢失时,可以采用本发明实施例提供的磁带元数据的恢复方法进行磁带元数据的恢复。When the file or database storing the metadata of the tape is available, or the metadata information of the tape saved in the file or database is not lost, each step in the tape can be performed according to the metadata information of the tape saved in the file or database. Read and write operations of a file, when the metadata information of the tape stored in the file or database is lost, the tape metadata recovery method provided by the embodiment of the present invention can be used to restore the tape metadata.

在本发明实施例中当进行磁带元数据恢复时,可以通过启动磁带元数据恢复装置内的磁带元数据恢复进程,创建用于存储恢复的磁带元数据信息的数据库,并启动该终端内的驱动磁带驱动器设备,完成该磁带元数据的恢复。图2为本发明实施例提供的磁带元数据恢复的详细过程,该过程包括以下步骤:In the embodiment of the present invention, when the tape metadata is restored, the tape metadata restoration process in the tape metadata restoration device can be started to create a database for storing the restored tape metadata information, and start the drive in the terminal. Tape drive device to complete the recovery of the tape metadata. Fig. 2 is the detailed process of tape metadata recovery that the embodiment of the present invention provides, and this process comprises the following steps:

S201:启动装置内的磁带元数据恢复进程,创建用于存储恢复的磁带元数据信息的数据库。S201: Start a tape metadata restoration process in the device, and create a database for storing restored tape metadata information.

S202:定位在磁带的磁带头,获取所述磁带的属性信息,其中该磁带的属性信息包括磁带的标识信息以及磁带中每个磁带块的容量信息。S202: Locate the tape head of the tape, and acquire attribute information of the tape, where the attribute information of the tape includes identification information of the tape and capacity information of each tape block in the tape.

S203:定位在待恢复的磁带中的当前文件上,读取该当前文件的文件头中保存的该当前文件的元数据信息。S203: Locate the current file on the magnetic tape to be restored, and read the metadata information of the current file stored in the file header of the current file.

S204:将读取的该当前文件的元数据信息保存在创建的数据库内。S204: Save the read metadata information of the current file in the created database.

S205:根据读取的该当前文件的元数据信息,确定由该当前文件的文件头移动到该当前文件的文件尾需移动的磁带块的数量。S205: According to the read metadata information of the current file, determine the number of tape blocks to be moved from the file head of the current file to the end of the current file.

S206:根据确定所述磁带块的数量,移动对应数量的磁带块到达所述当前文件的文件尾。S206: According to the determined number of tape blocks, move the corresponding number of tape blocks to the end of the current file.

S207:判断所述当前文件的文件尾是否为该磁带的磁带尾,判断结果为是时,进行步骤S208,否则,该当前文件的文件尾为该当前文件的下一个文件的文件头,将该下一个文件作为当前文件进行步骤S203。S207: Judging whether the file tail of the current file is the tape tail of the tape, if the judgment result is yes, proceed to step S208, otherwise, the file tail of the current file is the file header of the next file of the current file, and the The next file is used as the current file to proceed to step S203.

S208:该磁带的元数据恢复结束。S208: The metadata restoration of the magnetic tape ends.

图3为本发明实施例提供的一种磁带元数据的恢复装置,该装置包括:Fig. 3 is a kind of recovery device of magnetic tape metadata that the embodiment of the present invention provides, and this device comprises:

确定模块31,用于确定当前文件的文件头位置;Determining module 31, for determining the file header position of current file;

恢复模块32,用于根据确定的所述文件的文件头位置,读取所述文件头位置存储的所述文件的元数据信息,并保存读取的所述文件的元数据信息。The recovery module 32 is configured to read the metadata information of the file stored at the file header position according to the determined file header position of the file, and save the read metadata information of the file.

所述确定模块31包括:The determination module 31 includes:

第一确定单元311,用于确定所述当前文件为所述磁带的第一个文件时,根据所述磁带中存储所述第一个文件的格式信息,所述格式信息用于标识所述第一个文件位于所述磁带的第几个磁带块,移动对应数量的磁带块将移动后的位置作为所述第一个文件的文件头位置;The first determining unit 311 is configured to, when determining that the current file is the first file of the magnetic tape, according to the format information of the first file stored in the magnetic tape, the format information is used to identify the first file A file is located in which tape block of the tape, moving the corresponding number of tape blocks will use the moved position as the file header position of the first file;

第二确定单元312,用于确定所述当前文件非所述磁带的第一个文件时,根据读取的所述当前文件的上一个文件的元数据信息中记录的所述上一个文件的属性信息,确定由所述上一个文件移动到所述当前文件需移动的磁带块的数量,移动对应数量的磁带块,将移动到的位置作为所述当前文件的文件头位置,其中所述当前文件的文件头位置为所述上一个文件的文件尾位置。The second determining unit 312 is configured to determine that the current file is not the first file of the magnetic tape, according to the attributes of the previous file read in the metadata information of the previous file of the current file Information, determine the number of tape blocks that need to be moved from the previous file to the current file, move the corresponding number of tape blocks, and use the moved position as the file header position of the current file, wherein the current file The file header position is the file tail position of the previous file.

所述装置还包括:The device also includes:

磁带头读取模块33,用于读取所述磁带中磁带头信息,获取所述磁带的属性信息,其中所述磁带的属性信息包括磁带的标识信息,以及该磁带中每个磁带块的容量信息。The tape header reading module 33 is configured to read the tape header information in the tape, and obtain the attribute information of the tape, wherein the attribute information of the tape includes the identification information of the tape, and the capacity of each tape block in the tape information.

所述装置还包括:The device also includes:

判断模块34,用于判断所述当前文件是否为所述磁带的磁带尾,当确定所述当前文件为所述磁带的磁带尾时,所述磁带元数据的恢复过程结束,当确定所述当前文件非所述磁带的磁带尾时,根据读取的所述当前文件的的元数据信息中记录的所述当前文件的属性信息,确定由所述当前文件移动到所述当前文件的下一个文件的文件头需移动的磁带块的数量,根据确定的所述磁带块的数量,移动到所述当前文件的下一个文件的文件头位置。A judging module 34, configured to judge whether the current file is the tail of the tape, when it is determined that the current file is the tail of the tape, the restoration process of the metadata of the tape ends, and when it is determined that the current file is the tail of the tape When the file is not the end of the tape, determine the next file to be moved from the current file to the current file according to the attribute information of the current file recorded in the read metadata information of the current file The number of tape blocks that the file head needs to move is moved to the file head position of the next file of the current file according to the determined number of tape blocks.

本发明实施例提供了一种磁带元数据的恢复方法及装置,该方法包括:确定当前文件的文件头的位置,根据确定的所述文件的文件头位置,读取所述文件头位置存储的所述文件的元数据信息,并保存读取的所述文件的元数据信息。由于在本发明实施例中将每个文件的元数据信息保存在文件的文件头位置,通过读取保存文件头位置的元数据实现对该磁带元数据的恢复,只要磁带未损坏,就可以采用恢复磁带元数据的方法恢复磁带中保存的元数据,从而提高了元数据存储的安全性。The embodiment of the present invention provides a method and device for recovering tape metadata. The method includes: determining the position of the file header of the current file, and reading the file stored at the file header position according to the determined file header position of the file. metadata information of the file, and save the read metadata information of the file. Because in the embodiment of the present invention, the metadata information of each file is stored in the file header position of the file, the recovery of the tape metadata is realized by reading the metadata stored in the file header position, as long as the tape is not damaged, it can be used The method for restoring tape metadata restores the metadata saved in the tape, thereby improving the security of metadata storage.

显然,本领域的技术人员可以对本发明进行各种改动和变型而不脱离本发明的精神和范围。这样,倘若本发明的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalent technologies, the present invention also intends to include these modifications and variations.

Claims (8)

1.一种磁带元数据的恢复方法,其特征在于,针对磁带中存储的每个文件执行下列步骤:1. a recovery method of magnetic tape metadata, is characterized in that, carries out following steps for each file stored in magnetic tape: 确定当前文件的文件头的位置,其中:Determines the location of the file header of the current file, where: 当所述当前文件为所述磁带的第一个文件时,根据所述磁带中存储的所述第一个文件的格式信息,所述格式信息用于标识所述第一个文件位于所述磁带的第几个磁带块,移动对应数量的磁带块,将移动后的位置作为所述第一个文件的文件头位置;When the current file is the first file of the tape, according to the format information of the first file stored in the tape, the format information is used to identify that the first file is located on the tape The number of tape blocks, move the corresponding number of tape blocks, and use the moved position as the file header position of the first file; 当所述当前文件非所述磁带的第一个文件时,根据读取的所述当前文件的上一个文件的元数据信息中记录的所述上一个文件的属性信息,确定由所述上一个文件移动到所述当前文件需移动的磁带块的数量,移动对应数量的磁带块,将移动到的位置作为所述当前文件的文件头位置,其中所述当前文件的文件头位置为所述上一个文件的文件尾位置;When the current file is not the first file of the magnetic tape, according to the attribute information of the previous file recorded in the metadata information of the previous file of the current file read, it is determined that the previous The number of tape blocks that need to be moved when the file is moved to the current file, move the corresponding number of tape blocks, and use the moved position as the file header position of the current file, wherein the file header position of the current file is the above The end-of-file position of a file; 根据确定的所述当前文件的文件头位置,读取所述文件头位置存储的所述当前文件的元数据信息,并保存读取的所述当前文件的元数据信息。According to the determined file header position of the current file, read the metadata information of the current file stored at the file header position, and save the read metadata information of the current file. 2.如权利要求1所述的方法,其特征在于,当所述当前文件为所述磁带的第一个文件时,所述方法在确定当前文件的文件头的位置之前还包括:2. The method according to claim 1, wherein when the current file is the first file of the magnetic tape, the method also includes before determining the position of the file header of the current file: 读取所述磁带中磁带头信息,获取所述磁带的属性信息,其中所述磁带的属性信息包括磁带的标识信息,以及该磁带中每个磁带块的容量信息。Reading the tape header information in the tape to obtain the attribute information of the tape, wherein the attribute information of the tape includes the identification information of the tape and the capacity information of each tape block in the tape. 3.如权利要求1所述的方法,其特征在于,所述方法还包括:3. The method of claim 1, further comprising: 判断所述当前文件是否为所述磁带的磁带尾,当确定所述当前文件为所述磁带的磁带尾时,所述磁带元数据的恢复过程结束;judging whether the current file is the tail of the tape, and when it is determined that the current file is the tail of the tape, the restoration process of the tape metadata ends; 当确定所述当前文件非所述磁带的磁带尾时,根据读取的所述当前文件的的元数据信息中记录的所述当前文件的属性信息,确定由所述当前文件移动到所述当前文件的下一个文件的文件头需移动的磁带块的数量,根据确定的所述磁带块的数量,移动到所述当前文件的下一个文件的文件头位置。When it is determined that the current file is not the end of the magnetic tape, according to the attribute information of the current file recorded in the read metadata information of the current file, it is determined to move from the current file to the current The number of tape blocks that the file header of the next file of the file needs to move is moved to the file header position of the next file of the current file according to the determined number of tape blocks. 4.如权利要求1所述的方法,其特征在于,所述当前文件的属性信息包括:4. The method according to claim 1, wherein the attribute information of the current file comprises: 当前文件的标识信息及当前文件包含的字节数量信息。The identification information of the current file and the number of bytes contained in the current file. 5.如权利要求1所述的方法,其特征在于,所述读取的所述元数据信息保存于数据库中。5. The method according to claim 1, wherein the read metadata information is stored in a database. 6.一种磁带元数据的恢复装置,其特征在于,针对磁带中存储的每个文件执行元数据恢复,所述装置包括:6. A recovery device for tape metadata, characterized in that, performing metadata recovery for each file stored in the tape, said device comprising: 确定模块,用于确定当前文件的文件头位置;所述确定模块包括第一确定单元和第二确定单元,其中:A determining module, configured to determine the file header position of the current file; the determining module includes a first determining unit and a second determining unit, wherein: 第一确定单元,用于确定所述当前文件为所述磁带的第一个文件时,根据所述磁带中存储的所述第一个文件的格式信息,所述格式信息用于标识所述第一个文件位于所述磁带的第几个磁带块,移动对应数量的磁带块,将移动后的位置作为所述第一个文件的文件头位置;The first determining unit is configured to, when determining that the current file is the first file of the magnetic tape, according to the format information of the first file stored in the magnetic tape, the format information is used to identify the first file A file is located in which tape block of the tape, move the corresponding number of tape blocks, and use the moved position as the file header position of the first file; 第二确定单元,用于确定所述当前文件非所述磁带的第一个文件时,根据读取的所述当前文件的上一个文件的元数据信息中记录的所述上一个文件的属性信息,确定由所述上一个文件移动到所述当前文件需移动的磁带块的数量,移动对应数量的磁带块,将移动到的位置作为所述当前文件的文件头位置,其中所述当前文件的文件头位置为所述上一个文件的文件尾位置;The second determination unit is configured to determine that the current file is not the first file of the magnetic tape, according to the attribute information of the previous file recorded in the metadata information of the previous file of the current file read. , determine the number of tape blocks that need to be moved from the previous file to the current file, move the corresponding number of tape blocks, and use the moved position as the file header position of the current file, wherein the current file’s The file header position is the file tail position of the previous file; 恢复模块,用于根据确定的所述当前文件的文件头位置,读取所述文件头位置存储的所述当前文件的元数据信息,并保存读取的所述当前文件的元数据信息。The recovery module is configured to read the metadata information of the current file stored at the file header position according to the determined file header position of the current file, and save the read metadata information of the current file. 7.如权利要求6所述的装置,其特征在于,所述装置还包括:7. The device of claim 6, further comprising: 磁带头读取模块,用于当所述第一确定单元确定所述当前文件为所述磁带的第一个文件时,且在确定当前文件的文件头的位置之前,读取所述磁带中磁带头信息,获取所述磁带的属性信息,其中所述磁带的属性信息包括磁带的标识信息,以及该磁带中每个磁带块的容量信息。A tape header reading module, configured to read the tape in the tape when the first determination unit determines that the current file is the first file of the tape and before determining the position of the file header of the current file The header information is used to acquire attribute information of the tape, where the attribute information of the tape includes identification information of the tape and capacity information of each tape block in the tape. 8.如权利要求6所述的装置,其特征在于,所述装置还包括:8. The device of claim 6, further comprising: 判断模块,用于判断所述当前文件是否为所述磁带的磁带尾,当确定所述当前文件为所述磁带的磁带尾时,所述磁带元数据的恢复过程结束;当确定所述当前文件非所述磁带的磁带尾时,根据读取的所述当前文件的的元数据信息中记录的所述当前文件的属性信息,确定由所述当前文件移动到所述当前文件的下一个文件的文件头需移动的磁带块的数量,根据确定的所述磁带块的数量,移动到所述当前文件的下一个文件的文件头位置。A judging module, configured to judge whether the current file is the tail of the tape, and when it is determined that the current file is the tail of the tape, the restoration process of the tape metadata ends; when it is determined that the current file When it is not the end of the tape, determine the next file moved from the current file to the current file according to the attribute information of the current file recorded in the read metadata information of the current file The number of tape blocks to be moved by the file head is moved to the file head position of the next file of the current file according to the determined number of tape blocks.
CN2009102445403A 2009-12-30 2009-12-30 Method and device for recovering magnetic tape metadata Expired - Fee Related CN102117623B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2009102445403A CN102117623B (en) 2009-12-30 2009-12-30 Method and device for recovering magnetic tape metadata

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2009102445403A CN102117623B (en) 2009-12-30 2009-12-30 Method and device for recovering magnetic tape metadata

Publications (2)

Publication Number Publication Date
CN102117623A CN102117623A (en) 2011-07-06
CN102117623B true CN102117623B (en) 2012-07-04

Family

ID=44216354

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2009102445403A Expired - Fee Related CN102117623B (en) 2009-12-30 2009-12-30 Method and device for recovering magnetic tape metadata

Country Status (1)

Country Link
CN (1) CN102117623B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103680520B (en) * 2013-12-27 2016-08-17 上海爱数信息技术股份有限公司 A kind of magnetic recording method based on object standby system
CN106708830B (en) * 2015-08-03 2020-08-14 四川效率源信息安全技术股份有限公司 Data recovery method based on large database
CN110708355A (en) * 2019-09-05 2020-01-17 北京浪潮数据技术有限公司 File uploading method, system, device and readable storage medium
CN112820325B (en) * 2021-01-27 2022-04-15 天津航大雄英航空工程有限公司 Masking method for reading data of damaged magnetic tape of flight parameter recorder

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN87104879A (en) * 1987-07-21 1988-02-24 中国人民解放军空军第四研究所 High Density Tape Recording Technology of Ordinary Cassette Recorder
CN1409924A (en) * 1999-10-12 2003-04-09 夏普公司 Data recording method and data restoring method
CN1447965A (en) * 2000-08-16 2003-10-08 国际商业机器公司 Method and system for recovery of lateral position of servo system with respect to langitudinal servo bands of mannetic tape

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN87104879A (en) * 1987-07-21 1988-02-24 中国人民解放军空军第四研究所 High Density Tape Recording Technology of Ordinary Cassette Recorder
CN1409924A (en) * 1999-10-12 2003-04-09 夏普公司 Data recording method and data restoring method
CN1447965A (en) * 2000-08-16 2003-10-08 国际商业机器公司 Method and system for recovery of lateral position of servo system with respect to langitudinal servo bands of mannetic tape

Also Published As

Publication number Publication date
CN102117623A (en) 2011-07-06

Similar Documents

Publication Publication Date Title
CN111506251B (en) Data processing method and device, SMR storage system and storage medium
CN102136290A (en) Method for storing embedded real-time video files
CN104484427B (en) A kind of video file storage device and method
CN104811645B (en) A kind of embedded Video data storage method
CN103425785A (en) Data storage system and user data storage and reading method thereof
CN107168651B (en) A small file aggregate storage processing method
CN102117623B (en) Method and device for recovering magnetic tape metadata
CN102945679A (en) Video data processing method and video data read-write equipment
CN101909189B (en) File recovery method, system and DVR (Digital Video Recorder)
CN103034592A (en) Data processing method and device
CN100440352C (en) Power failure recovery method
CN103176867A (en) Fast file differential backup method
CN106909542A (en) The method and device of information erasing is carried out on the terminal device
EP1227480A3 (en) Method and apparatus for reading and writing information, and program storage medium for storage for storing read and write procedure program
WO2009110665A1 (en) Information storage medium for recording data according to journaling file system, and method of and apparatus for writing/recovering data using journaling file system
CN112530467B (en) Method and system for additionally burning optical disk storage
CN103425802B (en) Method for quickly retrieving magnetic disk file
CN102930875B (en) A kind of method of real-time synchronization video and audio recording
CN102141964B (en) Method and device for repeatedly using magnetic tape
US20080056674A1 (en) Data recording and recovery method for an optical storage medium and computer-readable storage medium using the method
WO2001027860A3 (en) Data recovery method, said method stored on computer readable medium, and remote data control method and system
CN109284201A (en) Temperature equalization data reconstruction method and system, storage medium
CN114741552A (en) Video file storage method and medium with custom format
US8775383B2 (en) File editing apparatus and file editing method
CN101399067B (en) Restoration Method of Disc Written Error

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
EE01 Entry into force of recordation of patent licensing contract

Application publication date: 20110706

Assignee: China Digital Video (Beijing) Limited

Assignor: Peking University Founder Group Corp|Beijing Peking University Founder Electronics Co., Ltd.|Peking University

Contract record no.: 2013990000783

Denomination of invention: Method and device for recovering magnetic tape metadata

Granted publication date: 20120704

License type: Exclusive License

Record date: 20131122

LICC Enforcement, change and cancellation of record of contracts on the licence for exploitation of a patent or utility model
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20120704

Termination date: 20191230

CF01 Termination of patent right due to non-payment of annual fee