CN113590053B - Logical volume recovery method, device, equipment and storage medium - Google Patents

Logical volume recovery method, device, equipment and storage medium Download PDF

Info

Publication number
CN113590053B
CN113590053B CN202111155916.0A CN202111155916A CN113590053B CN 113590053 B CN113590053 B CN 113590053B CN 202111155916 A CN202111155916 A CN 202111155916A CN 113590053 B CN113590053 B CN 113590053B
Authority
CN
China
Prior art keywords
block
logical volume
mapping table
backup
backup file
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.)
Active
Application number
CN202111155916.0A
Other languages
Chinese (zh)
Other versions
CN113590053A (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.)
Suzhou Inspur Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur Intelligent Technology 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 Suzhou Inspur Intelligent Technology Co Ltd filed Critical Suzhou Inspur Intelligent Technology Co Ltd
Priority to CN202111155916.0A priority Critical patent/CN113590053B/en
Publication of CN113590053A publication Critical patent/CN113590053A/en
Application granted granted Critical
Publication of CN113590053B publication Critical patent/CN113590053B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0614Improving the reliability of storage systems
    • G06F3/0619Improving the reliability of storage systems in relation to data integrity, e.g. data losses, bit errors
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1458Management of the backup or restore process
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0662Virtualisation aspects
    • G06F3/0665Virtualisation aspects at area level, e.g. provisioning of virtual or logical volumes

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Computer Security & Cryptography (AREA)
  • Quality & Reliability (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a method, a device, equipment and a storage medium for recovering a logical volume, which comprise the following steps: acquiring a backup file corresponding to the mistakenly deleted logical volume from a backup server; the backup file comprises a first mapping table of the deleted logical volume; comparing the first block mapping table with a second block mapping table of the current local existing logical volume to determine a first type of block elements existing in the first block mapping table but not existing in the second block mapping table and a second type of block elements existing in both the first block mapping table and the second block mapping table; searching an old block storage unit corresponding to the first type block element from the local; applying for new block storage units with the number corresponding to the second type of block elements, and migrating data corresponding to the second type of block elements to the new block storage units; and allocating the old block storage unit and the new block storage unit to the newly created logical volume. By carrying out data migration at the block level on the occupied volume, the recovery capability of the volume can be improved, and data loss can be effectively avoided.

Description

Logical volume recovery method, device, equipment and storage medium
Technical Field
The present application relates to the field of data recovery technologies, and in particular, to a method, an apparatus, a device, and a storage medium for recovering a logical volume.
Background
Currently, with the rapid development of the internet, the mobile internet and the internet of things, the total amount of internet data also shows a rapidly increasing development trend. Storage devices are widely used in organizations such as various large enterprises, governments, military, hospitals, etc., as important backend storage sources of data. For example, when a user deletes a certain logical volume by mistake, data loss may occur, and further, serious problems such as downtime of upper layer services may occur.
However, the data recovery technology for the erroneously deleted logical volume is relatively general in the recovery effect in the practical application process, and how to effectively recover the data when the erroneously deleted logical volume occurs is a problem to be further solved at present.
Disclosure of Invention
In view of the above, an object of the present application is to provide a method, an apparatus, a device, and a storage medium for recovering a logical volume, which can improve the recovery capability of the logical volume data and effectively avoid data loss. The specific scheme is as follows:
in a first aspect, the present application discloses a logical volume recovery method, which is applied to a storage device, and includes:
acquiring a backup file corresponding to the mistakenly deleted logical volume from a backup server; the backup file comprises metadata information of the deleted logical volume, and the metadata information comprises a first block mapping table of the deleted logical volume;
comparing the difference between the first block mapping table and a second block mapping table of a current local existing logical volume to determine a first type block element existing in the first block mapping table but not existing in the second block mapping table and a second type block element existing in both the first block mapping table and the second block mapping table;
searching an old block storage unit corresponding to the first type block element from the local;
applying for a corresponding number of new block storage units according to the number of the second type of block elements, and migrating data in the block storage unit corresponding to the second type of block elements in the local existing logical volume to the new block storage unit;
a new logical volume is created locally and the old block storage units and the new block storage units are allocated to the new logical volume.
Optionally, before comparing the difference between the first block mapping table and the second block mapping table of the current local existing logical volume, the method further includes:
detecting whether the backup file acquired from the backup server is complete;
if the backup file acquired from the backup server is detected to be complete, triggering the step of comparing the difference between the first block mapping table and a second block mapping table of the current local existing logical volume;
and if the incomplete backup file acquired from the backup server is detected, prohibiting triggering the step of comparing the difference between the first block mapping table and the second block mapping table of the current local existing logical volume, and returning corresponding incomplete file prompt information to the backup server.
Optionally, the detecting whether the backup file acquired from the backup server is complete includes:
and extracting an integrity check parameter carried in the backup file, and checking the integrity of the backup file by using the integrity check parameter to determine whether the backup file is complete.
Optionally, the extracting integrity check parameters carried in the backup file, and checking the integrity of the backup file by using the integrity check parameters includes:
extracting magic numbers carried in the backup files and corresponding to the backup files and first digital signatures corresponding to the metadata information;
detecting whether the magic numbers carried in the backup files are correct or not, if not, judging that the backup files are incomplete, and if so, digitally signing the metadata information to obtain a second digital signature;
and judging whether the first digital signature is consistent with the second digital signature, if so, judging that the backup file is complete, and if not, judging that the backup file is incomplete.
Optionally, before the obtaining the backup file corresponding to the deleted logical volume by mistake from the backup server, the method further includes:
collecting metadata information of the logical volume to be backed up to obtain the metadata information to be backed up;
performing digital signature on the metadata information to be backed up to obtain a first digital signature;
and storing the metadata information to be backed up and the first digital signature to a spare part file located under a preset directory, storing a magic number corresponding to the backup file in the spare part file, uploading the backup file to the backup server, so that the backup server performs integrity check on the backup file by using the magic number and the first digital signature in the backup file, and notifying the storage device to upload the backup file again after the integrity check fails.
Optionally, the performing digital signature on the metadata information to be backed up includes:
and digitally signing the metadata information to be backed up by using an MD5 algorithm or an SHA1 algorithm.
Optionally, the saving the metadata information to be backed up and the first digital signature to a spare file located in a preset directory, saving a magic number corresponding to the backup file in the spare file, and uploading the backup file to the backup server includes:
regularly saving the metadata information to be backed up and the first digital signature to a backup file under a preset directory by using a first timer function, and saving magic numbers corresponding to the backup file in the backup file;
and uploading the backup file to the backup server periodically by utilizing a second timer function.
In a second aspect, the present application discloses a logical volume restore apparatus, comprising:
the acquisition module is used for acquiring the backup file corresponding to the mistakenly deleted logical volume from the backup server; the backup file comprises metadata information of the deleted logical volume, and the metadata information comprises a first block mapping table of the deleted logical volume;
a determining module, configured to compare a difference between the first block mapping table and a second block mapping table of a current local existing logical volume, so as to determine a first type block element that exists in the first block mapping table but does not exist in the second block mapping table, and a second type block element that exists in both the first block mapping table and the second block mapping table;
the searching module is used for searching an old block storage unit corresponding to the first type block element from the local;
the migration module is used for applying for a corresponding number of new block storage units according to the number of the second type of block elements, and migrating data in the block storage unit corresponding to the second type of block elements in the local existing logical volume to the new block storage unit;
and the allocation module is used for creating a new logical volume locally and allocating the old block storage unit and the new block storage unit to the new logical volume.
In a third aspect, the present application discloses an electronic device comprising a processor and a memory; wherein the processor implements the aforementioned logical volume restore method when executing the computer program stored in the memory.
In a fourth aspect, the present application discloses a computer readable storage medium for storing a computer program; wherein the computer program when executed by a processor implements the aforementioned logical volume restore method.
Therefore, the backup file corresponding to the mistakenly deleted logical volume is obtained from the backup server; the backup file comprises metadata information of the logical volume deleted by mistake, and the metadata information comprises a first block mapping table of the logical volume deleted by mistake, then the difference between the first block mapping table and a second block mapping table of the current local existing logical volume is compared to determine a first type of block elements existing in the first block mapping table but not existing in the second block mapping table and second type of block elements existing in the first block mapping table and the second block mapping table, then an old block storage unit corresponding to the first type of block elements is searched from the local, a corresponding number of new block storage units are applied according to the number of elements of the second type of block elements, and data in the block storage unit corresponding to the second type of block elements in the local existing logical volume is migrated to the new block storage unit, and then creating a new logical volume locally, and allocating the old block storage unit and the new block storage unit to the new logical volume. Therefore, after the logical volume is deleted by mistake, the backup file sent by the backup server can be received, and then the first block mapping table corresponding to the deleted logical volume in the backup file is compared with the second block mapping table of the current local existing logical volume to determine the first block elements existing in the first block mapping table but not existing in the second block mapping table and the second block elements existing in both the first block mapping table and the second block mapping table. For the first type block elements, the corresponding old block storage units can be directly searched locally and allocated to the new logical volume. For the second type of block elements, a corresponding number of new block storage units are applied, then the data corresponding to the second type of block elements in the local logical volume are migrated to the new block storage units and allocated to the new logical volume, that is, the data blocks occupied in the mistakenly deleted logical volume are migrated to the new block storage units, and then the new block storage units and the old block storage units not occupied are allocated to the new logical volume, so that the data recovery of the mistakenly deleted logical volume is realized through the data migration on the level of the data blocks, the data loss can be effectively avoided, and the efficiency of the data recovery is improved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only embodiments of the present application, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
FIG. 1 is a diagrammatic illustration of a networking topology disclosed herein;
FIG. 2 is a schematic diagram of a specific mapping relationship among Pool, RAID and LUN disclosed in the present application;
FIG. 3 is a block mapping table structure diagram of a specific LUN disclosed in the present application;
FIG. 4 is a flow chart of a logical volume restore method disclosed herein;
FIG. 5 is a flow chart of a specific logical volume restore method disclosed herein;
FIG. 6 is a flowchart of a backup file generation method disclosed herein;
FIG. 7 is a diagram illustrating a specific backup file structure disclosed herein;
FIG. 8 is a schematic structural diagram of a logical volume restore apparatus according to the present disclosure;
fig. 9 is a block diagram of an electronic device disclosed in the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The networking topology structure adopted by the present application is shown in fig. 1, and may specifically include: the system comprises a service server, a fiber Channel Switch (FC-Switch), a storage device, an IP (Internet protocol) Switch, a user management host and a backup server.
In the application, the user logs in the storage device through the IP switch, communication between the user management host and the storage device can be realized, and it is pointed out that the user management host and the equipment server can be at different ends or the same end and can communicate with the storage device through the IP switch. In addition, the storage device can establish communication connection with the service server through the FC-Switch, and mutual transmission of data between the service server and the storage device is achieved.
In this application, after a user logs in to a storage device through an IP switch, the storage device first creates a Pool (i.e., a storage Pool), a RAID (i.e., a Redundant array of Independent Drives), and a LUN (i.e., a Logical Unit Number) for a user management host. As shown in fig. 2, one Pool in fig. 2 includes a plurality of hard disks (i.e., Drive) to form 4 RAIDs, each RAID is divided according to the size of a block (i.e., extent), then 4 LUNs are created according to a block mapping table (i.e., extent mapping table) between the LUNs and the RAIDs, and the space of the LUNs comes from the RAID in the Pool. It should be noted that each LUN has an extent mapping table for recording the RAID to which each extent in the LUN belongs, and the number of the extent in the RAID. When Pool is created, all the RAID belonging to the Pool are divided according to the extent size, and when LUN is created, the LUN selects the extent on one or more RAID in the Pool according to the required capacity and a certain algorithm as a space source. The extension mapping table between LUN and RAID is the most important metadata information of LUN.
Further, referring to fig. 3, fig. 3 shows a structure diagram of an extent mapping table corresponding to a LUN. In FIG. 3, each extension [ x ] records the raidId to which the extension belongs and its number on RAID. Usually recorded with one integer or long integer variable, raidld is left-shifted by a certain number of bits and then summed to get (raidld < < offset | extentId).
An embodiment of the present application discloses a logical volume recovery method, which is applied to a storage device, and as shown in fig. 4, the method includes:
step S11: acquiring a backup file corresponding to the mistakenly deleted logical volume from a backup server; the backup file comprises metadata information of the deleted logical volume, and the metadata information comprises a first block mapping table of the deleted logical volume.
It should be noted that in this embodiment, the storage device starts two timers when the start is completed and the storage device is in a normal operation state, including a first timer (i.e., timer _ a) and a second timer (i.e., timer _ b). The timer _ a is used for regularly backing up the collected metadata information to obtain a backup file; the timer _ b is used for uploading the backup file to a backup server periodically for storage. When a user deletes a logical volume in the storage device by mistake, the storage device may obtain a backup file corresponding to the deleted logical volume from the backup server. The backup file includes, but is not limited to, metadata information of the erroneously deleted logical volume, and the metadata information includes, but is not limited to, information such as an ID of the erroneously deleted logical volume, a NAME of the erroneously deleted logical volume, the number of blocks occupied by the erroneously deleted logical volume and a corresponding block size, and a first block mapping table of the erroneously deleted logical volume.
Step S12: comparing differences between the first block mapping table and a second block mapping table of a current local existing logical volume to determine a first class of block elements that exist in the first block mapping table but do not exist in the second block mapping table, and a second class of block elements that both exist in the first block mapping table and the second block mapping table.
In this embodiment, after the backup file corresponding to the deleted logical volume is acquired from the backup server, a block mapping table of metadata information in the backup file, that is, the first block mapping table, may be acquired. Further, by comparing the first block mapping table with a block mapping table of a current local existing logical volume, that is, the second block mapping table, a difference between the first block mapping table and the second block mapping table can be obtained, and a block element, that is, the first type block element, which exists in the first block mapping table but does not exist in the second block mapping table can be determined by the difference; meanwhile, the block elements existing in both the first block mapping table and the second block mapping table, that is, the second type block elements, may also be determined. It can be understood that, since the first type block element exists in the first block mapping table but does not exist in the second block mapping table, it indicates that the block element in the first type block element has not been allocated to other logical volumes; and indicating that the block elements in the second type of block elements are occupied by other logical volumes because the second type of block elements exist in both the first block mapping table and the second block mapping table.
In addition, before comparing the difference between the first block mapping table and the second block mapping table of the current local existing logical volume, the method may specifically further include: detecting whether the backup file acquired from the backup server is complete; if the backup file acquired from the backup server is detected to be complete, the step of comparing the difference between the first block mapping table and the second block mapping table of the current local existing logical volume is executed; and if the incomplete backup file acquired from the backup server is detected, prohibiting triggering the step of comparing the difference between the first block mapping table and the second block mapping table of the current local existing logical volume, and returning corresponding incomplete file prompt information to the backup server. It may be understood that, in order to ensure the integrity of the received backup file, before comparing the difference between the first block mapping table and the second block mapping table of the current local existing logical volume, the integrity of the received backup file may be checked, in the first embodiment, if the difference is detected, it may be determined that the backup file acquired from the backup server is intact, and the step of comparing the difference between the first block mapping table and the second block mapping table of the current local existing logical volume may be continuously performed.
In a second specific implementation manner, if it is detected that the backup file acquired from the backup server is incomplete, which indicates that the backup file is damaged, and the file content is missing and/or tampered, the step of comparing the difference between the first mapping table and the second mapping table of the current local existing logical volume is prohibited, and a notification message about that the backup file is incomplete is sent to the backup server, and the received incomplete backup file is deleted, after the backup server receives the notification message that the file is incomplete, the backup file is re-uploaded to the storage device, and after the storage device receives the backup file again, the integrity of the backup file is still verified and corresponding response information is sent to the file that fails to be verified.
Step S13: and searching the old block storage unit corresponding to the first type block element from the local.
In this embodiment, after determining the first type block elements that exist in the first block mapping table but do not exist in the second block mapping table and the second type block elements that both exist in the first block mapping table and the second block mapping table, the block storage unit, that is, the old block storage unit, corresponding to the first type block element may be directly searched locally for the first type block elements that are not yet allocated to other logical volumes.
Step S14: and applying for a corresponding number of new block storage units according to the number of the elements of the second type of block elements, and migrating data in the block storage unit corresponding to the second type of block elements in the local existing logical volume to the new block storage unit.
In this embodiment, after the old block storage unit corresponding to the first type block element is searched locally, for the second type block element already occupied by other volumes, a new block storage unit with the same number as the second type block element may be applied according to the number of the second type block element, and data in the block storage unit corresponding to the second type block element, which is already locally stored in the logical volume, is migrated to the new block storage unit.
Step S15: a new logical volume is created locally and the old block storage units and the new block storage units are allocated to the new logical volume.
In this embodiment, after applying for a corresponding number of new block storage units according to the number of elements of the second type of block elements and migrating data in a block storage unit corresponding to the second type of block elements in a local existing logical volume to the new block storage unit, a new logical volume may be created locally, and then the old block storage unit and the new block storage unit are allocated to the newly created logical volume, thereby completing recovery of the erroneously deleted logical volume.
Further, in this embodiment, in the process of migrating the data in the block storage unit corresponding to the second type block element in the local existing logical volume to the new block storage unit, the migration progress of the erroneously deleted logical volume may also be calculated in real time. Specifically, the calculation formula of the migration progress is as follows: migration progress = migrateNum1/migrateNum2 × 100%. Wherein the migrateNum1 is the number of elements of the second type of block elements that remain un-migrated; the migrateNum2 is the number of elements of the second type of block element, i.e., the number of block elements to be migrated.
In addition, in this embodiment, after migrating data in all block storage units corresponding to the second type block elements in the local existing logical volume to the new block storage unit, a damage ratio of the metadata information of the erroneously deleted logical volume may be estimated. Specifically, the damage ratio is calculated by the following formula: ratio of damage = migrateNum 2/migrateNum 3 × 100%; wherein the migrateNum2 is the number of elements of the second type of block element; the migrateNum3 is the total number of block elements in the current locally existing logical volume.
It can be seen that, in the embodiment of the present application, after a logical volume is deleted by mistake, a backup file sent by a backup server may be received, and then a first block mapping table included in the backup file and corresponding to the deleted logical volume by mistake is compared with a second block mapping table of a current local existing logical volume, so as to determine a first type of block elements that exist in the first block mapping table but do not exist in the second block mapping table, and a second type of block elements that both exist in the first block mapping table and the second block mapping table. For the first type block elements, the corresponding old block storage units can be directly searched locally and allocated to the new logical volume. For the second type of block elements, a corresponding number of new block storage units are applied, then the data corresponding to the second type of block elements in the local logical volume are migrated to the new block storage units and allocated to the new logical volume, that is, the occupied data blocks in the mistakenly deleted logical volume are migrated to the new block storage units, and then the new block storage units and the unoccupied old block storage units are allocated to the new logical volume, so that the data recovery of the mistakenly deleted logical volume is realized through the data migration on the level of the data blocks, the data loss can be effectively avoided, and the efficiency of the data recovery is improved.
The embodiment of the present application discloses a specific logical volume recovery method, as shown in fig. 5, the method includes:
step S21: acquiring a backup file corresponding to the mistakenly deleted logical volume from a backup server; the backup file comprises metadata information of the deleted logical volume, and the metadata information comprises a first block mapping table of the deleted logical volume.
In this embodiment, before the backup file corresponding to the erroneously deleted logical volume is acquired from the backup server, the storage device needs to save the backup file in advance, where the backup file includes not only the metadata information but also a verification parameter for verifying the integrity of the backup file. Referring to fig. 6, an embodiment of the present application discloses a method for generating a backup file, which may specifically include:
step S31: collecting metadata information of the logical volume to be backed up to obtain the metadata information to be backed up;
step S32: performing digital signature on the metadata information to be backed up to obtain a first digital signature;
step S33: and storing the metadata information to be backed up and the first digital signature to a spare part file located under a preset directory, storing a magic number corresponding to the backup file in the spare part file, uploading the backup file to the backup server, so that the backup server performs integrity check on the backup file by using the magic number and the first digital signature in the backup file, and notifying the storage device to upload the backup file again after the integrity check fails.
It can be understood that, before the backup file corresponding to the deleted logical volume is obtained from the backup server, the storage device may periodically collect the metadata information of the logical volume to be backed up, obtain the metadata information to be backed up, after the metadata information to be backed up is obtained, in order to ensure the security of the metadata information, the metadata information to be backed up can be digitally signed by using a preset digital signature algorithm to obtain the first digital signature, after the first digital signature is obtained, the metadata information to be backed up and the first digital signature are saved in a spare part file located in a preset directory of a storage device, the backup files stored for many times are distinguished and sorted conveniently, magic numbers corresponding to the backup files are stored in the spare files, and then the backup files are uploaded to the backup server periodically. After receiving the backup file, the backup server can acquire a magic number in the backup file, can identify a file type corresponding to the magic number according to the magic number, and compares the file type with the type of the backup file, if the file type is not matched with the type of the backup file, and the integrity check of the backup file is failed, the backup file is uploaded to the storage device again; if the type is matched with the actual type of the backup file, digitally signing the backup file based on a preset digital signature algorithm, comparing the obtained digital signature with a first digital signature in the backup file, if the comparison result shows that the digital signature information of the two is consistent, judging that the backup file is complete, and storing the backup file; and if the comparison result shows that the digital signature information of the two files is inconsistent, judging that the backup file is incomplete, and informing the storage device to upload the backup file again. The preset digital signature Algorithm includes, but is not limited to, an MD5 (Message-Digest) Algorithm, an SHA1(Secure Hash Algorithm), and the like.
For example, referring to FIG. 7, FIG. 7 illustrates a specific backup file structure. The backup file in fig. 7 includes magic numbers and digital signatures (i.e., magicNum and MD5 sum) for checking integrity of the metadata information, in addition to the metadata information (i.e., lunId, lunName, extentNum, extentSize, and extentx) of the logical volume to be backed up, where the magicNum is defined as xabccba, and the MD5sum is obtained by performing an operation on the metadata information based on an MD5 algorithm.
In this embodiment, the saving the metadata information to be backed up and the first digital signature to a spare part file located in a preset directory, saving a magic number corresponding to the backup file in the spare part file, and uploading the backup file to the backup server may specifically include: regularly saving the metadata information to be backed up and the first digital signature to a backup file under a preset directory by using a first timer function, and saving magic numbers corresponding to the backup file in the backup file; and uploading the backup file to the backup server periodically by utilizing a second timer function. For example, it can be understood that, when the storage device is started up and in a normal operation state, the timer _ a (i.e., the first timer) is started up to periodically backup the metadata information of the logical volume, such as saving the metadata information every day in a day period, and then saving the metadata information into a predefined vdiskinfo directory, and naming the backup files as volume ID + backup time, such as LUN0_20201010010000, where LUN0_ represents a LUN with ID 0, and LUN 20201010010000 represents a file backed up at time of 01:00:00 on 10/2020/10/2020/year. Further, the metadata information in the backup file may be digitally signed by using a preset MD5 algorithm to obtain MD5sum, and the MD5sum is saved in the LUN0_20201010010000, and a corresponding magic number is set for the backup file, for example, the magic number is defined as 0xabccba, and the 0xabccba is saved in the LUN0_ 20201010010000.
Further, the timer _ b (i.e., the second timer) may periodically upload all backup files in the vdiskinfo directory to a directory preset by the backup server, such as vdiskinfo. It should be noted that, in order to avoid that too many backup files occupy too many resources of the storage device, the backup files in the vdiskinfo directory are usually cleaned regularly, and certainly, the backup files that are successfully verified each time and uploaded are also deleted.
Further, after the backup server receives the backup file, the actual type of the backup file is first matched with a magic number, that is, 0xabccba, in the backup file, if the type of the backup file identified by 0xabccba does not match with the actual type of the backup file, it is determined that the backup file is incomplete, and the storage device is notified to upload the backup file again, if the type of the backup file matches with the actual type of the backup file, metadata information in the backup file is digitally signed by using a preset MD5 algorithm to obtain MD5sum1, and the MD5sum1 is compared with the MD5sum, and if the MD5sum1 matches with the MD5sum, it is determined that the backup file is complete.
Step S22: and extracting an integrity check parameter carried in the backup file, and checking the integrity of the backup file by using the integrity check parameter to determine whether the backup file is complete.
In this embodiment, after the backup file corresponding to the erroneously deleted logical volume is acquired from the backup server, the integrity of the backup file may be verified by extracting a verification parameter for verifying the integrity of the backup file, which is pre-stored in the backup file, and it may be determined whether the backup file is complete according to the verification result. And the verification process is consistent with the verification process of the backup server on the received backup file.
Specifically, the extracting an integrity check parameter carried in the backup file, and checking the integrity of the backup file by using the integrity check parameter may include: extracting magic numbers carried in the backup files and corresponding to the backup files and first digital signatures corresponding to the metadata information; detecting whether the magic numbers carried in the backup files are correct or not, if not, judging that the backup files are incomplete, and if so, digitally signing the metadata information to obtain a second digital signature; and judging whether the first digital signature is consistent with the second digital signature, if so, judging that the backup file is complete, and if not, judging that the backup file is incomplete. It can be understood that after the storage device acquires the backup file, a magic number in the backup file can be acquired, a corresponding file type can be identified according to the magic number and compared with the file type of the backup file, and if the type is not matched with the file type of the backup file, indicating that the integrity check of the backup file fails, the storage device is notified to upload the backup file again; if the type is matched with the file type of the backup file, digitally signing the backup file based on a preset digital signature algorithm to obtain a second digital signature, comparing the obtained second digital signature with the first digital signature in the backup file, and if the comparison result shows that the two digital signatures are consistent, judging that the backup file is complete; and if the comparison result shows that the digital signature information of the two files is inconsistent, judging that the backup file is incomplete.
Step S23: comparing differences between the first block mapping table and a second block mapping table of a current local existing logical volume to determine a first class of block elements that exist in the first block mapping table but do not exist in the second block mapping table, and a second class of block elements that both exist in the first block mapping table and the second block mapping table.
Step S24: and searching the old block storage unit corresponding to the first type block element from the local.
Step S25: and applying for a corresponding number of new block storage units according to the number of the elements of the second type of block elements, and migrating data in the block storage unit corresponding to the second type of block elements in the local existing logical volume to the new block storage unit.
Step S26: a new logical volume is created locally and the old block storage units and the new block storage units are allocated to the new logical volume.
For more specific processing procedures of the above steps S21, S23, S24, S25, and S26, reference may be made to corresponding contents disclosed in the foregoing embodiments, and details are not repeated herein.
As can be seen, in the embodiment of the present application, before comparing the difference between the first mapping table and the second mapping table of the current local existing logical volume, whether the backup file acquired from the backup server is complete is detected by extracting the magic number carried in the backup file and corresponding to the backup file and the first digital signature corresponding to the metadata information. The two parameters for verifying the integrity of the backup file are added in the backup file in advance, so that the integrity of the backup file can be ensured, and the subsequent recovery of the logical volume is guaranteed.
Correspondingly, an embodiment of the present application further discloses a logical volume recovery apparatus, as shown in fig. 8, the apparatus includes:
the file acquisition module 11 is configured to acquire a backup file corresponding to the erroneously deleted logical volume from the backup server; the backup file comprises metadata information of the deleted logical volume, and the metadata information comprises a first block mapping table of the deleted logical volume;
an element determining module 12, configured to compare a difference between the first block mapping table and a second block mapping table of a current local existing logical volume, so as to determine a first type of block element that exists in the first block mapping table but does not exist in the second block mapping table, and a second type of block element that exists in both the first block mapping table and the second block mapping table;
a unit searching module 13, configured to search an old block storage unit corresponding to the first type block element from the local;
the data migration module 14 is configured to apply for a corresponding number of new block storage units according to the number of elements of the second type of block elements, and migrate data in a block storage unit corresponding to the second type of block elements in a local existing logical volume to the new block storage unit;
and the unit allocating module 15 is configured to create a new logical volume locally, and allocate the old block storage unit and the new block storage unit to the new logical volume.
For the specific work flow of each module, reference may be made to corresponding content disclosed in the foregoing embodiments, and details are not repeated here.
It can be seen that, in the embodiment of the present application, after a logical volume is deleted by mistake, a backup file sent by a backup server may be received, and then a first block mapping table corresponding to the deleted logical volume and included in the backup file is compared with a second block mapping table of a current local existing logical volume, so as to determine a first type block element that exists in the first block mapping table but does not exist in the second block mapping table, and a second type block element that exists in both the first block mapping table and the second block mapping table. For the first type block elements, the corresponding old block storage units can be directly searched locally and allocated to the new logical volume. For the second type of block elements, a corresponding number of new block storage units are applied, then the data corresponding to the second type of block elements in the local logical volume are migrated to the new block storage units and allocated to the new logical volume, that is, the data blocks occupied in the mistakenly deleted logical volume are migrated to the new block storage units, and then the new block storage units and the old block storage units not occupied are allocated to the new logical volume, so that the data recovery of the mistakenly deleted logical volume is realized through the data migration on the level of the data blocks, the data loss can be effectively avoided, and the efficiency of the data recovery is improved.
In some specific embodiments, before the element determining module 12, specifically, the method may further include:
the first detection unit is used for detecting whether the backup file acquired from the backup server is complete or not;
a triggering unit, configured to trigger the step of comparing a difference between the first block mapping table and a second block mapping table of a current local existing logical volume if it is detected that the backup file acquired from the backup server is complete;
and the prohibition triggering unit is used for prohibiting triggering the step of comparing the difference between the first block mapping table and the second block mapping table of the current local existing logical volume if the incomplete backup file acquired from the backup server is detected, and returning corresponding incomplete file prompt information to the backup server.
In some specific embodiments, the first detecting unit may specifically include:
and the first extraction unit is used for extracting the integrity check parameter carried in the backup file and checking the integrity of the backup file by using the integrity check parameter so as to determine whether the backup file is complete.
In some specific embodiments, the first extracting unit may specifically include:
the second extraction unit is used for extracting the magic numbers carried in the backup files and corresponding to the backup files and the first digital signatures corresponding to the metadata information;
the second detection unit is used for detecting whether the magic numbers carried in the backup files are correct or not, if not, the backup files are judged to be incomplete, and if yes, the metadata information is digitally signed to obtain a second digital signature;
and the first judging unit is used for judging whether the first digital signature is consistent with the second digital signature or not, judging that the backup file is complete if the first digital signature is consistent with the second digital signature, and judging that the backup file is incomplete if the first digital signature is not consistent with the second digital signature.
In some specific embodiments, before the file obtaining module 11, the method may further include:
the information collection unit is used for collecting metadata information of the logical volume to be backed up so as to obtain the metadata information to be backed up;
the first digital signature unit is used for carrying out digital signature on the metadata information to be backed up so as to obtain a first digital signature;
the first file uploading unit is used for storing the metadata information to be backed up and the first digital signature to a spare part file located under a preset directory, storing magic numbers corresponding to the backup file in the spare part file, and then uploading the backup file to the backup server, so that the backup server can conveniently carry out integrity check on the backup file by using the magic numbers and the first digital signature in the backup file, and inform the storage device to upload the backup file again after the integrity check fails.
In some specific embodiments, the first digital signature unit may specifically include:
and the second digital signature unit is used for digitally signing the metadata information to be backed up by utilizing the MD5 algorithm or the SHA1 algorithm.
In some specific embodiments, the first file uploading unit may specifically include:
the storage unit is used for regularly storing the metadata information to be backed up and the first digital signature to a backup file under a preset directory by using a first timer function, and storing a magic number corresponding to the backup file in the backup file;
and the second file uploading unit is used for uploading the backup files to the backup server regularly by utilizing a second timer function.
Further, an electronic device is disclosed in the embodiments of the present application, and fig. 9 is a block diagram of an electronic device 20 according to an exemplary embodiment, which should not be construed as limiting the scope of the application.
Fig. 9 is a schematic structural diagram of an electronic device 20 according to an embodiment of the present disclosure. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input output interface 25, and a communication bus 26. The memory 22 is configured to store a computer program, and the computer program is loaded and executed by the processor 21 to implement the relevant steps in the logical volume recovery method disclosed in any of the foregoing embodiments. In addition, the electronic device 20 in the present embodiment may be specifically an electronic computer.
In this embodiment, the power supply 23 is configured to provide a working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and an external device, and a communication protocol followed by the communication interface is any communication protocol applicable to the technical solution of the present application, and is not specifically limited herein; the input/output interface 25 is configured to obtain external input data or output data to the outside, and a specific interface type thereof may be selected according to specific application requirements, which is not specifically limited herein.
In addition, the storage 22 is used as a carrier for resource storage, and may be a read-only memory, a random access memory, a magnetic disk or an optical disk, etc., and the resources stored thereon may include an operating system 221, a computer program 222, etc., and the storage manner may be a transient storage or a permanent storage.
The operating system 221 is used for managing and controlling each hardware device on the electronic device 20 and the computer program 222, and may be Windows Server, Netware, Unix, Linux, or the like. The computer program 222 may further include a computer program that can be used to perform other specific tasks in addition to the computer program that can be used to perform the logical volume recovery method performed by the electronic device 20 disclosed in any of the foregoing embodiments.
Further, the present application also discloses a computer-readable storage medium for storing a computer program; wherein the computer program when executed by a processor implements the logical volume restore method disclosed above. For the specific steps of the method, reference may be made to the corresponding contents disclosed in the foregoing embodiments, which are not described herein again.
The embodiments are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same or similar parts among the embodiments are referred to each other. The device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The above detailed description is provided for a method, an apparatus, a device, and a storage medium for restoring a logical volume, and a specific example is applied in the present disclosure to explain the principle and the implementation of the present disclosure, and the description of the above embodiment is only used to help understanding the method and the core idea of the present disclosure; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (10)

1. A method for recovering a logical volume, which is applied to a storage device, includes:
acquiring a backup file corresponding to the mistakenly deleted logical volume from a backup server; the backup file comprises metadata information of the deleted logical volume, and the metadata information comprises a first block mapping table of the deleted logical volume;
comparing the difference between the first block mapping table and a second block mapping table of a current local existing logical volume to determine a first type block element existing in the first block mapping table but not existing in the second block mapping table and a second type block element existing in both the first block mapping table and the second block mapping table;
searching an old block storage unit corresponding to the first type block element from the local;
applying for a corresponding number of new block storage units according to the number of the second type of block elements, and migrating data in the block storage unit corresponding to the second type of block elements in the local existing logical volume to the new block storage unit;
a new logical volume is created locally and the old block storage units and the new block storage units are allocated to the new logical volume.
2. The method for recovering a logical volume according to claim 1, wherein before comparing the difference between the first block mapping table and the second block mapping table of the current local existing logical volume, the method further comprises:
detecting whether the backup file acquired from the backup server is complete;
if the backup file acquired from the backup server is detected to be complete, triggering the step of comparing the difference between the first block mapping table and a second block mapping table of the current local existing logical volume;
and if the incomplete backup file acquired from the backup server is detected, prohibiting triggering the step of comparing the difference between the first block mapping table and the second block mapping table of the current local existing logical volume, and returning corresponding incomplete file prompt information to the backup server.
3. The method for restoring a logical volume according to claim 2, wherein the detecting whether the backup file acquired from the backup server is complete includes:
and extracting an integrity check parameter carried in the backup file, and checking the integrity of the backup file by using the integrity check parameter to determine whether the backup file is complete.
4. The method according to claim 3, wherein the extracting the integrity check parameter carried in the backup file and checking the integrity of the backup file by using the integrity check parameter includes:
extracting magic numbers carried in the backup files and corresponding to the backup files and first digital signatures corresponding to the metadata information;
detecting whether the magic numbers carried in the backup files are correct or not, if not, judging that the backup files are incomplete, and if so, digitally signing the metadata information to obtain a second digital signature;
and judging whether the first digital signature is consistent with the second digital signature, if so, judging that the backup file is complete, and if not, judging that the backup file is incomplete.
5. The method according to claim 4, further comprising, before the obtaining the backup file corresponding to the deleted logical volume from the backup server,:
collecting metadata information of the logical volume to be backed up to obtain the metadata information to be backed up;
performing digital signature on the metadata information to be backed up to obtain a first digital signature;
and storing the metadata information to be backed up and the first digital signature to a spare part file located under a preset directory, storing a magic number corresponding to the backup file in the spare part file, uploading the backup file to the backup server, so that the backup server performs integrity check on the backup file by using the magic number and the first digital signature in the backup file, and notifying the storage device to upload the backup file again after the integrity check fails.
6. The logical volume recovery method according to claim 5, wherein said digitally signing the metadata information to be backed up comprises:
and digitally signing the metadata information to be backed up by using an MD5 algorithm or an SHA1 algorithm.
7. The method for restoring a logical volume according to claim 5 or 6, wherein the saving the metadata information to be backed up and the first digital signature to a spare file located under a preset directory, saving a magic number corresponding to the backup file in the spare file, and uploading the backup file to the backup server includes:
regularly saving the metadata information to be backed up and the first digital signature to a backup file under a preset directory by using a first timer function, and saving magic numbers corresponding to the backup file in the backup file;
and uploading the backup file to the backup server periodically by utilizing a second timer function.
8. A logical volume restore apparatus, comprising:
the file acquisition module is used for acquiring backup files corresponding to the deleted logical volumes from the backup server; the backup file comprises metadata information of the deleted logical volume, and the metadata information comprises a first block mapping table of the deleted logical volume;
an element determining module, configured to compare a difference between the first block mapping table and a second block mapping table of a current local existing logical volume, so as to determine a first type of block element that exists in the first block mapping table but does not exist in the second block mapping table, and a second type of block element that exists in both the first block mapping table and the second block mapping table;
the unit searching module is used for searching an old block storage unit corresponding to the first type block element from the local;
the data migration module is used for applying for a corresponding number of new block storage units according to the number of the second type of block elements, and migrating data in the block storage unit corresponding to the second type of block elements in the local existing logical volume to the new block storage unit;
and the unit allocation module is used for creating a new logical volume locally and allocating the old block storage unit and the new block storage unit to the new logical volume.
9. An electronic device comprising a processor and a memory; wherein the processor, when executing the computer program stored in the memory, implements the logical volume restore method of any of claims 1 to 7.
10. A computer-readable storage medium for storing a computer program; wherein the computer program when executed by a processor implements the logical volume restore method of any of claims 1 to 7.
CN202111155916.0A 2021-09-30 2021-09-30 Logical volume recovery method, device, equipment and storage medium Active CN113590053B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111155916.0A CN113590053B (en) 2021-09-30 2021-09-30 Logical volume recovery method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111155916.0A CN113590053B (en) 2021-09-30 2021-09-30 Logical volume recovery method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113590053A CN113590053A (en) 2021-11-02
CN113590053B true CN113590053B (en) 2021-12-03

Family

ID=78242601

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111155916.0A Active CN113590053B (en) 2021-09-30 2021-09-30 Logical volume recovery method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113590053B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113918388A (en) * 2021-12-15 2022-01-11 苏州浪潮智能科技有限公司 Data recovery method, device, equipment and storage medium
CN115374075B (en) * 2022-08-01 2023-09-01 北京明朝万达科技股份有限公司 File type identification method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1746492A1 (en) * 2005-07-08 2007-01-24 Hitachi, Ltd. Disk array apparatus and method for controlling the same
JP2008059443A (en) * 2006-09-01 2008-03-13 Hitachi Ltd Storage system and backup method
US8473697B1 (en) * 2008-10-29 2013-06-25 Netapp, Inc. Method and system for volume based snapshot restore
CN109358988A (en) * 2018-12-10 2019-02-19 郑州云海信息技术有限公司 A kind of restoration methods, device, system and the readable storage medium storing program for executing of cloud Backup Data
CN111813753A (en) * 2020-06-29 2020-10-23 深圳市元征科技股份有限公司 File saving method, file restoring method, device and terminal equipment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1746492A1 (en) * 2005-07-08 2007-01-24 Hitachi, Ltd. Disk array apparatus and method for controlling the same
JP2008059443A (en) * 2006-09-01 2008-03-13 Hitachi Ltd Storage system and backup method
US8473697B1 (en) * 2008-10-29 2013-06-25 Netapp, Inc. Method and system for volume based snapshot restore
CN109358988A (en) * 2018-12-10 2019-02-19 郑州云海信息技术有限公司 A kind of restoration methods, device, system and the readable storage medium storing program for executing of cloud Backup Data
CN111813753A (en) * 2020-06-29 2020-10-23 深圳市元征科技股份有限公司 File saving method, file restoring method, device and terminal equipment

Also Published As

Publication number Publication date
CN113590053A (en) 2021-11-02

Similar Documents

Publication Publication Date Title
CN113590053B (en) Logical volume recovery method, device, equipment and storage medium
US9250824B2 (en) Backing up method, device, and system for virtual machine
CN110603524B (en) Method and system for dependency analysis of orchestrated workload
US20110218967A1 (en) Partial Block Based Backups
CN102495880B (en) Method and device for synchronizing file
CN110377456B (en) Management method and device for virtualization platform disaster tolerance
EP3474143B1 (en) Method and apparatus for incremental recovery of data
CN105550073A (en) Database backup method and system thereof
CN113918388A (en) Data recovery method, device, equipment and storage medium
CN107533495B (en) Techniques for data backup and recovery
CN113886143B (en) Virtual machine continuous data protection method and device and data recovery method and device
US9262634B2 (en) Memory content protection
CN113722155A (en) Data backup and repair method in distributed file system and related components
CN110972497A (en) Disaster recovery method and device for virtualization platform
CN114416665B (en) Method, device and medium for detecting and repairing data consistency
CN105740049B (en) A kind of control method and device
CN111400105A (en) Database backup method and device
CN109672544B (en) Data processing method and device and distributed storage system
CN104407942A (en) Off-site storage based Linux operation system backup recovery method
CN105740729A (en) Method for checking credibility of system service program
US10922183B2 (en) In-place disk unformatting
CN109344118B (en) Snapshot rollback recovery method, system, device and computer readable storage medium
US11436098B2 (en) Crash recovery of vRPA cluster protection engine
CN106815098A (en) Setting backup and the method and system for recovering based on linux system
CN104317675A (en) Disaster tolerance treatment method and device of applications

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant