CN113419686A - RAID reconstruction method and device - Google Patents

RAID reconstruction method and device Download PDF

Info

Publication number
CN113419686A
CN113419686A CN202110784852.4A CN202110784852A CN113419686A CN 113419686 A CN113419686 A CN 113419686A CN 202110784852 A CN202110784852 A CN 202110784852A CN 113419686 A CN113419686 A CN 113419686A
Authority
CN
China
Prior art keywords
target
hard disk
raid
data
stored
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.)
Pending
Application number
CN202110784852.4A
Other languages
Chinese (zh)
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.)
Hangzhou Hikvision Digital Technology Co Ltd
Original Assignee
Hangzhou Hikvision Digital 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 Hangzhou Hikvision Digital Technology Co Ltd filed Critical Hangzhou Hikvision Digital Technology Co Ltd
Priority to CN202110784852.4A priority Critical patent/CN113419686A/en
Publication of CN113419686A publication Critical patent/CN113419686A/en
Pending legal-status Critical Current

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/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0683Plurality of storage devices
    • G06F3/0689Disk arrays, e.g. RAID, JBOD
    • 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
    • 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/062Securing storage systems
    • 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/0638Organizing or formatting or addressing of data
    • G06F3/0643Management of files
    • 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/0638Organizing or formatting or addressing of data
    • G06F3/0644Management of space entities, e.g. partitions, extents, pools
    • 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/0646Horizontal data movement in storage systems, i.e. moving data in between storage devices or systems
    • G06F3/0647Migration mechanisms

Abstract

The embodiment of the invention provides a RAID reconstruction method and a device, and relates to the technical field of data storage. The reconstruction method is applied to RAID driving, and comprises the following steps: determining a target hard disk; the target hard disk is used for reconstructing a target RAID; traversing each metadata stored in a file system to which the target RAID belongs, and determining whether a target data file corresponding to the metadata is an effective file when each metadata is traversed; if so, reconstructing target data to be stored in the target hard disk according to the designated data stored in each initial hard disk; and storing the target data into the target hard disk. Compared with the prior art, the scheme provided by the embodiment of the invention can be used for rapidly and efficiently reconstructing the RAID after the hard disk with read-write abnormality is removed on the premise of ensuring the integrity of the data stored in the RAID and the data security of the RAID and improving the security level of the RAID.

Description

RAID reconstruction method and device
Technical Field
The invention relates to the technical field of data storage, in particular to a RAID reconstruction method and device.
Background
When a hard disk in a RAID (Redundant Arrays of Independent Disks) is abnormally read and written, the hard disk is removed from the RAID, so that data stored in the removed hard disk is lost in the RAID, and data security of the RAID is reduced, so that the RAID is in a degraded state.
In order to ensure the integrity of data stored in the RAID and the data security of the RAID and improve the security level of the RAID, a new blank hard disk needs to be added to the RAID from which the hard disk with the read-write abnormality is removed, and the data content stored in the blank hard disk needs to be reconstructed.
Based on this, how to reconstruct the RAID with the hard disk out of which the read-write abnormality occurs fast and efficiently on the premise of ensuring the integrity of data stored in the RAID and the data security of the RAID and improving the security level of the RAID becomes a technical problem to be solved at present.
Disclosure of Invention
The embodiment of the invention aims to provide a RAID reconstruction method and a device, so as to rapidly and efficiently reconstruct the RAID from which the hard disk with read-write abnormality is removed on the premise of ensuring the integrity of data stored in the RAID and the data security of the RAID and improving the security level of the RAID. The specific technical scheme is as follows:
in a first aspect, an embodiment of the present invention provides a RAID reconfiguration method, which is applied to RAID driving, and the method includes:
determining a target hard disk; the target hard disk is used for reconstructing a target RAID;
traversing each metadata stored in a file system to which the target RAID belongs, and determining whether a target data file corresponding to the metadata is an effective file when each metadata is traversed;
if so, reconstructing target data to be stored in the target hard disk according to the specified data stored in the original hard disk which is not moved out in the target RAID; the specified data is: data corresponding to the target data file;
if not, traversing the next metadata, and returning to the step of determining whether the target data file corresponding to the metadata is an effective file when each metadata is traversed;
and storing the target data into the target hard disk.
In a second aspect, an embodiment of the present invention provides a RAID reconfiguration apparatus, which is applied to RAID driving, and the apparatus includes:
the hard disk determining module is used for determining a target hard disk; the target hard disk is used for reconstructing a target RAID;
the metadata traversing module is used for traversing each metadata stored in the file system to which the target RAID belongs, and determining whether a target data file corresponding to the metadata is an effective file or not when each metadata is traversed; if yes, triggering a data reconstruction module, if not, traversing the next metadata, and returning to the step of determining whether the target data file corresponding to the metadata is an effective file when each metadata is traversed;
the data reconstruction module is used for reconstructing target data to be stored in the target hard disk according to the specified data stored in the initial hard disk which is not moved out in the target RAID; wherein the specified data is: data corresponding to the target data file;
and the data storage module is used for storing the target data into the target hard disk.
In a third aspect, an embodiment of the present invention provides a RAID driver, where the RAID driver is configured to execute any one of the RAID reconfiguration method steps provided in the first aspect.
In a fourth aspect, an embodiment of the present invention provides an electronic device, which is provided with a RAID driver, and includes a processor, a communication interface, a memory, and a communication bus, where the processor and the communication interface complete communication between the memory and the processor through the communication bus;
a memory for storing a computer program;
and the processor is used for realizing any RAID reconstruction method steps provided by the first aspect when executing the program stored in the memory.
In a fifth aspect, an embodiment of the present invention provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements any of the RAID reconstruction method steps provided in the first aspect.
In a sixth aspect, an embodiment of the present invention provides a computer program product containing instructions, which when run on a computer, causes the computer to perform any of the RAID reconstruction method steps provided in the first aspect.
The embodiment of the invention has the following beneficial effects:
as can be seen from the above, with the adoption of the scheme provided by the embodiment of the present invention, when the target RAID is reconstructed, the target hard disk for reconstructing the target RAID is determined first; furthermore, each metadata stored in the file information to which the target RAID belongs is traversed, when each metadata is traversed, in the case where the target data file corresponding to the metadata is a valid file, the target data to be stored in the target hard disk is reconstructed according to the specified data corresponding to the target data file stored in the original hard disk that is not moved out, and the reconstructed target data is stored in the target hard disk, and in the case where the target data file corresponding to the metadata is an invalid file, the target data file may be skipped, and the data content corresponding to the target data file does not need to be reconstructed in the target hard disk.
Based on this, by applying the scheme provided by the embodiment of the invention, when reconstructing the data content stored in the new target hard disk added in the target RAID, the invalid file stored in the target RAID can be skipped, and only the valid file in the target RAID is reconstructed, so that the reconstruction of the invalid file can be avoided, and the calculation resource and the reconstruction time can be saved. Therefore, the RAID out of the hard disk with read-write abnormality can be reconstructed quickly and efficiently on the premise of ensuring the integrity of data stored in the reconstructed target RAID and the data security of the target RAID and improving the security level of the target RAID.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other embodiments can be obtained by referring to these drawings.
FIG. 1 is a schematic diagram of the structure of an SMR;
fig. 2 is a schematic flowchart of a RAID reconfiguration method according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a target RAID created by multiple SMRs;
fig. 4 is a schematic flowchart of another RAID reconfiguration method according to an embodiment of the present invention;
fig. 5 is a schematic flowchart of a RAID reconfiguration method according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a RAID reconfiguration apparatus according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived from the embodiments given herein by one of ordinary skill in the art, are within the scope of the invention.
When a hard disk in the RAID is read and written abnormally, the hard disk is removed from the RAID, so that data stored in the removed hard disk is lost in the RAID, and data security of the RAID is reduced, so that the RAID is in a degraded state. Based on this, how to reconstruct the RAID with the hard disk out of which the read-write abnormality occurs fast and efficiently on the premise of ensuring the integrity of data stored in the RAID and the data security of the RAID and improving the security level of the RAID becomes a technical problem to be solved at present.
In order to solve the above technical problem, an embodiment of the present invention provides a RAID reconfiguration method.
The RAID reconfiguration method is suitable for any application scenario in which the RAID is required to be reconfigured after the hard disk with the abnormal read/write is removed, and is not limited to the exemplary video monitoring scenario.
And, the reconstruction method is applied to RAID driving. In a specific application, the RAID driver for executing the reconstruction method may be a RAID driver preset in various electronic devices such as a notebook computer and a desktop computer, and certainly, the RAID driver for executing the reconstruction method may also be a RAID driver preset in an equipment cluster.
The RAID reconfiguration method provided in the embodiment of the present invention may include the following steps:
determining a target hard disk; the target hard disk is used for reconstructing a target RAID;
traversing each metadata stored in a file system to which the target RAID belongs, and determining whether a target data file corresponding to the metadata is an effective file when each metadata is traversed;
if so, reconstructing target data to be stored in the target hard disk according to the specified data stored in the initial hard disk which is not moved out in the RAID; wherein the initial hard disk is: in the hard disk not moved out in the RAID, the specified data is: data corresponding to the target data file;
and if not, traversing the next metadata, and returning to the step of determining whether the target data file corresponding to the metadata is a valid file when each metadata is traversed.
And storing the target data into the target hard disk.
As can be seen from the above, with the adoption of the scheme provided by the embodiment of the present invention, when the target RAID is reconstructed, the target hard disk for reconstructing the target RAID is determined first; furthermore, each metadata stored in the file information to which the target RAID belongs is traversed, when each metadata is traversed, in the case where the target data file corresponding to the metadata is a valid file, the target data to be stored in the target hard disk is reconstructed according to the specified data corresponding to the target data file stored in the original hard disk that is not moved out, and the reconstructed target data is stored in the target hard disk, and in the case where the target data file corresponding to the metadata is an invalid file, the target data file may be skipped, and the data content corresponding to the target data file does not need to be reconstructed in the target hard disk.
Based on this, by applying the scheme provided by the embodiment of the invention, when reconstructing the data content stored in the new target hard disk added in the target RAID, the invalid file stored in the target RAID can be skipped, and only the valid file in the target RAID is reconstructed, so that the reconstruction of the invalid file can be avoided, and the calculation resource and the reconstruction time can be saved. Therefore, the RAID out of the hard disk with read-write abnormality can be reconstructed quickly and efficiently on the premise of ensuring the integrity of data stored in the reconstructed target RAID and the data security of the target RAID and improving the security level of the target RAID.
Before specifically describing a RAID reconfiguration method provided in the embodiment of the present invention, first, SMRs that may be involved in the embodiment of the present invention are briefly described.
SMRs (shielded Magnetic Recording disks) adjust the data storage mode in the SMRs by overlapping tracks, and further improve the track density of the SMRs, so that the storage capacity of a single SMR is increased. Among them, SMR provides a magnetic disk data storage technology, by which data tracks on a disk can be partially overlapped in a manner similar to the stacking of tiles on a roof, and thus, SMR can be called a shingled magnetic recording technology, and thus, the storage density of a magnetic disk can be greatly improved by applying SMR.
However, due to the special storage structure, the SMR does not support random writing and in-place updating of data, and thus, the data storage operability of the SMR is poor and the data storage efficiency is low.
The SMR divides the track into bands, i.e., into continuously writable areas each of which is formed of a continuous track, and each of the continuously writable areas forms a basic unit to be sequentially written. Band is a physical concept of an SMR, and its corresponding logical concept is "zone (zone)", which is a sequential write area in an SMR that can be seen by upper layer software that can operate the SMR.
Typically, the spatial size of one zone in an SMR is on the order of 256 MB. Among them, since the SMR needs to ensure that data can be read from the non-overlapped portion of the track, data reading in each zone can be performed at random. Also, the SMR is area-divided at the time of production and manufacture, so that the start position of each zone can be identified by leaving a large space between each zone. In addition, a hard disk manufacturer can set a small block area on the SMR and use a non-overlapping track organization manner of a traditional hard disk in the small block area to trade the random writing capability in the small block area at the expense of partial storage density. The small block area may be referred to as a "legacy Zone" so that a foothold may be provided for random writing operations of an upper layer application capable of operating the SMR.
FIG. 1 is a schematic diagram of the structure of an SMR, wherein, as shown in FIG. 1, the following characteristics of the SMR can be obtained:
SMR takes a zone as a management unit, and the space size of each zone is generally 256 MB; each zone in the SMR region of the SMR supports write-around read operations, but only sequential write operations, i.e., data can only be written sequentially, from front to back, in order; SMRs include a Shielded Magnetic Recording (SMR) region and a CMR (Conventional Magnetic Recording disk) region, the CMR region has a small spatial size and supports a write-disorder operation; reading and writing can be carried out only after each zone in the SMR is opened, and the number of opened zones is limited; the SMR supports ZAC/ZBC commands to acquire, read, write and clear zone states.
A RAID reconfiguration method according to an embodiment of the present invention is specifically described below with reference to the accompanying drawings.
Fig. 2 is a schematic flowchart of a RAID reconfiguration method according to an embodiment of the present invention, and as shown in fig. 2, the reconfiguration method may include the following steps S201 to S204:
s201: determining a target hard disk;
the target hard disk is used for reconstructing the target RAID;
when reconstructing the target RAID from which the hard disk with the read-write abnormality is removed, a new hard disk needs to be added to the target RAID to be reconstructed, so that the removed hard disk is replaced with the added new hard disk, and the data stored in the removed hard disk is reconstructed into the new hard disk.
Therefore, when reconstructing the target RAID from which the hard disk with the read-write abnormality has been removed, it is necessary to determine the target hard disk for reconstructing the target RAID first. And the target hard disk is a new hard disk added in the target RAID to be reconstructed.
The electronic device where the RAID drive is located may be associated with a plurality of unused blank hard disks, so that the RAID drive may detect a plurality of unused blank hard disks that currently exist, and further, the RAID drive needs to determine, from the detected plurality of unused blank hard disks, a target hard disk for reconstructing the target RAID.
Optionally, the user may send the hard disk identifier of the selected target hard disk for reconstructing the target RAID to the RAID driver by inputting the identifier, clicking the identifier, and the like, so that the RAID driver may determine, from among the detected plurality of unused blank hard disks, the hard disk having the received hard disk identifier as the target hard disk for reconstructing the target RAID.
Optionally, the RAID driver may randomly select a target hard disk for reconstructing the target RAID from the detected plurality of unused blank hard disks.
Optionally, the RAID driver may determine, according to a preset rule, a hard disk that meets the preset rule among the detected plurality of unused blank hard disks, as the target hard disk.
For example, the preset rule may be: setting the hard disk with the smallest hard disk identification in the plurality of unused blank hard disks as a target hard disk; the following steps can be also included: and setting the hard disk detected firstly in the plurality of unused blank hard disks as a target hard disk. This is all reasonable.
The above example of the preset rule is merely an example for determining a target hard disk for RAID driving, and is not limited, and any manner capable of implementing the step S101 is within the protection scope of the present invention.
Further, the above target RAID may be created using various types of hard disks, and the SMR is, of course, not limited to this, as an example. And the hard disk in the target RAID and the target hard disk are the same type of hard disk.
Optionally, the target RAID created by using the SMR may include a first array (RAID-S) and a second array (RAID-C), the first array (RAID-S) is configured by SMR areas in the SMRs in the RAID, and the first array (RAID-S) includes a plurality of stripes (stripe), each stripe (stripe) includes a write area (zone) with the same offset address in the SMR areas of the plurality of SMRs, and is used to store data files written in an aligned sequential writing manner; the second array (RAID-C) is configured from the CMR region in each SMR in the RAID.
Optionally, the second array (RAID-C) is at least for caching data content of each data file and storing metadata of each data file.
For example, fig. 3 is a schematic diagram of a target RAID created by multiple SMRs.
As shown in fig. 3, the columns corresponding to SMR1-SMR3 are SMRs for creating a target RAID, the RAID-C area is the second array of the target RAID, the RAID-S area is the first array of the target RAID, and the column corresponding to RAID is the target RAID created using SMR1-SMR 3.
Wherein, Date _ File-1 to Date _ File-N are respectively the stripes (stripes) in the first array (RAID-S) of the target RAID. Note that Date _ File-1 is composed of three write areas (Zone) zones-1 having the same offset address and located in PD1-PD3, Date _ File-2 is composed of three write areas (Zone) zones-2 having the same offset address and located in SMRs 1-SMR3, and so on, and Date _ File-N is composed of three write areas (Zone) zones-N having the same offset address and located in SMRs 1-SMR 3.
S202: traversing each metadata stored in a file system to which the target RAID belongs, and determining whether a target data file corresponding to the metadata is an effective file or not when each metadata is traversed; if yes, step S203 is executed, and if no, step S204 is executed.
S203: reconstructing target data to be stored in the target hard disk according to the designated data stored in the original hard disk which is not moved out in the target RAID;
wherein, the initial hard disk is: the hard disk which is not moved out in the target RAID specifies the data as follows: data corresponding to the target data file;
s204: and traversing the next metadata, returning to the step S202, and determining whether the target data file corresponding to the metadata is a valid file when each metadata is traversed.
S205: and storing the target data into the target hard disk.
After the target hard disk for reconstructing the target RAID is determined, the data stored in the target hard disk may be further reconstructed, so that the data stored in the target hard disk and the data stored in the removed hard disk are kept consistent.
For each data file stored in the target RAID, each hard disk in the target RAID stores data corresponding to the data file, for example, stores partial data content in the data file, and for example, stores a check value and the like of the data file. When the hard disk with read-write abnormality is moved out of the target RAID, the target RAID loses the data stored in the hard disk and corresponding to each data file stored in the target RAID.
Based on this, reconstructing the data stored in the target hard disk means that the data stored in the removed hard disk and corresponding to each data file stored in the target RAID is restored to the determined target hard disk, and thus the data stored in the removed hard disk and corresponding to each data file stored in the target RAID is restored in the target RAID after reconstruction is completed.
For each data file stored in the target RAID, metadata is stored in the file system to which the target RAID belongs, so that when data stored in the target hard disk is reconstructed, the metadata can be stored in the file system to which the target RAID belongs.
Therefore, after the target hard disk used for reconstructing the target RAID is determined, all metadata stored in the file system to which the target RAID belongs can be traversed.
In some cases, the data content of the valid file is not necessarily stored in all of the storage locations of the target RAID. For example, some storage locations may not have data content stored, and for example, other storage locations may have data that the user has deleted, etc. The valid file may be a data file that is currently stored and meets the requirements of the user, and the user may set the data file belonging to the valid file according to the requirements in the actual application.
Based on this, each metadata stored by the file system to which the target RAID belongs corresponds to a data file stored in a partial storage location in the target RAID, and each metadata may indicate whether the corresponding data file is a valid file.
When a data file is not stored in a certain storage location, the data file corresponding to the metadata corresponding to the storage location may be considered as an invalid file.
In this way, for each piece of metadata stored in the file system to which the target RAID belongs, when the data file corresponding to a piece of metadata is an invalid file, the metadata is stored in the file system to which the target RAID belongs, but when reconstructing the target RAID, it is not necessary to reconstruct the invalid file corresponding to the piece of metadata in the target hard disk.
That is, when a data file corresponding to a certain metadata is an invalid file, the invalid file is skipped over, and the invalid file is not reconstructed, that is, the invalid file corresponding to the metadata does not need to be reconstructed in the target hard disk.
Based on this, when traversing to each metadata stored in the file system to which the target RAID belongs, it may be determined whether the target data file corresponding to the metadata is a valid file.
When traversing to each metadata, it may first determine whether a target data file corresponding to the metadata is an effective file according to various types of information recorded in the metadata, for example, flag information used for characterizing whether the data file is an effective file, and the like.
If the target data file corresponding to the metadata is a valid file, data corresponding to the target data file needs to be reconstructed in the target hard disk, so that the subsequent step S203 can be continuously performed, and the target data to be stored in the target hard disk is reconstructed according to the specified data stored in each initial hard disk.
Correspondingly, if the target data file corresponding to the metadata is not a valid file, that is, the target data file corresponding to the metadata is an invalid file, it is not necessary to reconstruct the data corresponding to the target data file in the target hard disk, so that the subsequent step S204, that is, the next metadata of the metadata is traversed, and when the next metadata is traversed, the step S202 is returned to be executed to determine whether the target data file corresponding to the metadata is a valid file. That is, if the target data file corresponding to the metadata is an invalid file, the invalid file may be skipped without reconstructing the target data file, i.e., without performing the subsequent steps S203 and S205. Therefore, by skipping the invalid file, the time of the invalid data reconstruction process is saved, and the efficiency of reconstructing the target RAID can be improved.
Therefore, when the target RAID is reconstructed, the invalid files stored in the target RAID can be skipped, so that the reconstruction of the invalid files is avoided, the computing resources are saved, and the reconstruction efficiency is improved.
Because the moved hard disk and the original hard disk which is not moved in the target RAID both store data corresponding to the target data file, when reconstructing the data corresponding to the target data file stored in the target hard disk, the data corresponding to the target data file stored in the original hard disk which is not moved in the target RAID may be determined first, that is, the specified data stored in the original hard disk which is not moved in the target RAID may be determined first, and then, the target data to be stored in the target hard disk may be reconstructed using the determined specified data, and the reconstructed target data may be stored in the target hard disk.
Optionally, each initial hard disk in the target RAID may store data corresponding to the target data file, so that the target data to be stored in the target hard disk may be reconstructed according to the specified data stored in each initial hard disk.
That is, the reconstructed target data is data corresponding to the target data file stored in the removed hard disk, so that after the target data is stored in the target hard disk, the data corresponding to the target data file stored in the removed hard disk can be reconstructed in the target hard disk.
In this way, after the metadata of all the data files stored in the target RAID is traversed, the data corresponding to all the data files that are valid files stored in the target RAID stored in the moved hard disk can be reconstructed in the target hard disk, so that the data stored in the target hard disk and the data stored in the moved hard disk are kept consistent.
Based on this, after the metadata of all the data files stored in the target RAID is traversed, the reconstruction of the target RAID can be determined to be completed, and thus, it can be determined that the target RAID can recover to a normal state to continue to complete data storage.
Optionally, in a specific implementation manner, as shown in fig. 4, the RAID reconfiguration method provided in the foregoing embodiment of the present invention may further include the following step S206.
S206: and when the last metadata in the metadata is traversed, marking the target RAID as a normal state.
In this specific implementation manner, after all metadata stored in the file system to which the target RAID belongs are traversed, it may be determined that the reconstruction of the target RAID is completed, and thus it may be determined that the target RAID may recover to a normal state. In this way, in order to facilitate understanding of the reconfiguration of the target RAID to meet the data storage requirement for the target RAID, the target RAID may be marked as a normal state when the last metadata in the metadata is traversed.
Therefore, the reconstruction of the target RAID can be determined to be completed according to the normal state marked by the target RAID, and the data storage can be continuously performed by using the target RAID.
Based on this, by applying the scheme provided by the embodiment of the invention, when reconstructing the data content stored in the new target hard disk added in the target RAID, the invalid file stored in the target RAID can be skipped, and only the valid file in the target RAID is reconstructed, so that the reconstruction of the invalid file can be avoided, and the calculation resource and the reconstruction time can be saved. Therefore, the RAID reconstruction efficiency can be improved on the premise of ensuring the integrity of the data stored in the reconstructed target RAID and the data security of the target RAID and improving the security level of the target RAID.
Optionally, in a specific implementation manner, before reconstructing target data to be stored in the target hard disk according to specified data stored in an initial hard disk that is not moved out in the target RAID, the method may further include:
determining whether a data writing task exists at a storage position for storing a target data file corresponding to the metadata; and if the target data does not exist, executing a step of reconstructing the target data to be stored in the target hard disk according to the specified data stored in the initial hard disk which is not moved out in the target RAID.
The storage space of each initial hard disk and the target hard disk in the target RAID may be divided into each write area (zone), so that the size of the data file stored by the target RAID is related to the space size of the write area (zone).
For example, in a target RAID configured with a plurality of SMRs, the size of a data file stored by the target RAID may be equal to the product of the number of SMRs and the size of space of each write area (zone) in the SMR area of each SMR, or the like.
In this way, when reconstructing data stored in the target hard disk, a data reconstruction task and a data writing task may exist simultaneously for the same writing area (zone) in the target hard disk, that is, two writing operations for the same writing area (zone) may exist simultaneously.
For some types of target hard disks, for example, SMR, each write area (zone) in the target hard disk can only support sequential writing, but not out-of-order writing, and thus each write area (zone) in the target hard disk does not support two write operations to operate on the write area (zone) at the same time, so to ensure that the data stored in the target hard disk is reconstructed smoothly, it is necessary to avoid the occurrence of a situation where a data reconstruction task and a data write task exist for the same write area (zone) in the target hard disk.
Based on this, when traversing to each metadata, it can be determined whether there is a data writing task in the writing area (zone) for storing the target data file corresponding to the metadata.
If it is determined that no data writing task exists, because the situation that a data reconstruction task and a data writing task exist for the same writing area (zone) in the target hard disk does not occur, when the target data file corresponding to the element number is an effective file, the subsequent step of reconstructing the target data to be stored in the target hard disk according to the specified data stored in the initial hard disk which is not moved out in the target RAID can be further performed.
Optionally, if it is determined that a data writing task exists, because a data reconstruction task and a data writing task exist for the same writing area (zone) in the target hard disk, no matter whether the target data file corresponding to the metadata is a valid file, reconstruction of data stored in the target hard disk may be suspended, and the data writing task is executed first, so that when the data writing task is completed and the target data file corresponding to the metadata is a valid file, the execution of the data reconstruction task is resumed to reconstruct data stored in the target hard disk.
Based on this, in this specific implementation, when traversing to each metadata, if the target data file corresponding to the metadata is to be reconstructed, that is, the target data to be stored in the target hard disk is to be reconstructed, it is required to satisfy that the target data file corresponding to the metadata is a valid file, and a data writing task exists in a writing area (zone) for storing the target data file corresponding to the metadata.
Optionally, in a specific implementation manner, when traversing to each metadata, it may first determine whether a target data file corresponding to the metadata is a valid file.
When the judgment result is that the file is not the valid file, skipping the target data file and traversing the next metadata; if the file is a valid file, it is further determined whether a data write task exists in a write area (zone) for storing a target data file corresponding to the metadata.
And if the judgment result is that the data writing task exists, executing the data writing task, and reconstructing target data to be stored in the target hard disk according to the specified data stored in the initial hard disk which is not moved out in the target RAID when the data writing task is finished. And if the judgment result is that no data writing task exists, reconstructing target data to be stored in the target hard disk directly according to the specified data stored in the original hard disk which is not moved out in the target RAID.
Optionally, in a specific implementation manner, when traversing to each metadata, it may first be determined whether a data writing task exists in a writing area (zone) for storing a target data file corresponding to the metadata.
When the judgment result is that no data writing task exists, whether the target data file corresponding to the metadata is a valid file can be further judged.
If the judgment result is that the file is not a valid file, skipping the target data file and traversing the next metadata; and if the judgment result is that the file is the valid file, reconstructing target data to be stored in the target hard disk directly according to the specified data stored in the original hard disk which is not moved out in the target RAID.
Optionally, when the determination result is that there is a data writing task, it may be further determined whether the target data file corresponding to the metadata is a valid file; therefore, if the judgment result is that the file is not a valid file, skipping the target data file and traversing the next metadata; and if the judgment result is that the file is a valid file, reconstructing target data to be stored in the target hard disk according to the specified data stored in the initial hard disk which is not moved out in the target RAID after the data writing task is executed.
Optionally, when the determination result is that a data writing task exists, the data writing task may be executed, and after the data writing task is executed, it is further determined whether a target data file corresponding to the metadata is a valid file; therefore, if the judgment result is that the file is not a valid file, skipping the target data file and traversing the next metadata; and if the judgment result is that the file is the valid file, reconstructing target data to be stored in the target hard disk directly according to the specified data stored in the original hard disk which is not moved out in the target RAID.
Optionally, in a specific implementation manner, when traversing to each metadata, it may be determined whether a target data file corresponding to the metadata is a valid file, and whether a data writing task exists in a writing area (zone) for storing the target data file corresponding to the metadata.
If the judgment result is that: if the file is an effective file and no data writing task exists, reconstructing target data to be stored in the target hard disk directly according to specified data stored in the initial hard disk which is not moved out in the target RAID;
if the judgment result is that: if the file is not a valid file and no data writing task exists, skipping the target data file and traversing the next metadata;
if the judgment result is that: if the file is an effective file and a data writing task exists, reconstructing target data to be stored in a target hard disk according to specified data stored in an initial hard disk which is not moved out in the target RAID after the data writing task is executed;
if the judgment result is that: if the file is a valid file and no data writing task exists, skipping the target data file and traversing the next metadata.
When storing a data file using a target RAID, in order to improve data security so that data recovery can be performed more easily when part of data in the data file is lost, a check value of the data file may be stored in correspondence with the data file.
That is, an area for storing the check value may be selected in the target RAID, so that, when writing a data file to the target RAID, the data file may be written to an area for storing data content of the data file included in the target RAID, and the calculated check value of the data file may be written to the selected area for storing the check value.
Based on this, optionally, in a specific implementation manner, the multiple hard disks in the target RAID are set as a first type hard disk and at least one second type hard disk, where each second type hard disk is used to store partial data of a data file, and the first type hard disk is used to store a check value of the data file;
accordingly, in this specific implementation manner, the step S103 of reconstructing the target data to be stored in the target hard disk according to the specified data stored in the original hard disk that is not moved out in the target RAID may include the following steps 11 and 12.
Step 11: if the target hard disk is a first type of hard disk, calculating a check value of the target data file according to partial data of the target data file stored in each initial hard disk, and using the check value as target data to be stored in the target hard disk;
step 12: and if the target hard disk is the second type of hard disk, generating partial data in the target data file lost in the target RAID according to the partial data and the check value of the target data file stored in each initial hard disk, wherein the partial data is used as the target data to be stored in the target hard disk.
In this specific implementation manner, the removed hard disk may be a first type hard disk in the target RAID or a second type hard disk in the target RAID, so that the target hard disk may be added to the target RAID as the first type hard disk in the target RAID or added to the target RAID as the second type hard disk in the target RAID.
And if the target hard disk is added to the target RAID as the first hard disk in the target RAID, the target hard disk is used for storing the check value of the data file. That is, the entire data content of the target data file corresponding to the traversed metadata is stored in each initial hard disk in the target RAID, and the check value of the target data file needs to be reconstructed in the target hard disk.
Based on this, the check value of the target data file can be calculated according to the partial data of the target data file stored in each initial hard disk of the target RAID, and the calculated check value is determined as the target data to be stored in the target hard disk.
Optionally, the check value of the target data file may be calculated by performing an exclusive or operation on part of data of the target data file stored in each initial hard disk of the target RAID.
And if the target hard disk is added to the target RAID as a second type hard disk in the target RAID, the target hard disk is used for storing the data content of the data file. That is, the partial data and the check value of the target data file corresponding to the traversed metadata are stored in each initial hard disk in the target RAID, and the partial data of the target data file lost in the target RAID needs to be reconstructed in the target hard disk.
Based on this, the partial data of the target data file lost in the target RAID can be generated according to the partial data and the check value of the target data file stored in each initial hard disk of the target RAID, and the partial data obtained through calculation is determined as the target data to be stored in the target hard disk.
Optionally, in a specific implementation manner, the plurality of hard disks in the target RAID are SMRs, and the target RAID includes a first array (RAID-S) and a second array (RAID-C).
Wherein the first array (RAID-S) is composed of SMR areas of the plurality of SMRs, the second array (RAID-C) is composed of CMR areas of the plurality of SMRs, and the first array (RAID-S) comprises: a plurality of strips (strips), each strip (strip) comprising: the SMR areas of the plurality of SMRs are write areas (zones) having the same offset address, and store data files written in an aligned order.
Alternatively, the metadata for each data file may be stored in a target area in a second array (RAID-C) in the target RAID.
In this particular implementation, when creating a target RAID with multiple SMRs, SMR areas of the multiple SMRs may be configured as a first array of the target RAID to be created (RAID-S). In the process of configuring the first array (RAID-S), the RAID driver may determine that a write area (zone) having the same offset address is located in an SMR area of the SMRs, and configure the determined write area (zone) having the same offset address in an SMR area of a different SMR as one stripe (stripe) in the first array (RAID-S) of the target RAID. In this way, after all the write areas (zones) in the SMR areas of the plurality of SMRs are traversed and all the stripes (stripes) are allocated, the allocation of the first array (RAID-S) of the target RAID can be completed.
In this way, a first array (RAID-S) of the target RAID may include a plurality of stripes (stripes), each stripe (stripe) including a write area (zone) having the same offset address in an SMR area of the plurality of SMRs.
Furthermore, since the SMR area of the SMR does not support the out-of-order write operation, when writing a data file to each write area (zone) in the SMR area, the write pointer must be sequentially moved from the start position of the write area (zone) to the end position of the write area (zone), and therefore, the first array (RAID-S) of the target RAID does not support the out-of-order write operation as well. In this way, when writing a data file to each stripe (stripe) in the first array (RAID-S) of the target RAID, the writing method employed is: aligned sequential writing.
That is, when writing a data file to each stripe (stripe) in the first array (RAID-S) of the target RAID, the write pointers in the respective write areas (zones) included in the stripe (stripe) are identical, and in each write area (zone) included in the stripe (stripe), the write pointers must be sequentially moved from the start position of the write area (zone) to the end position of the write area (zone). Based on this, each stripe (stripe) in the first array (RAID-S) of the target RAID may be used to store data files written in an aligned sequential write manner.
In addition, the CMR area of the plurality of SMRs may also be configured as a second array of target RAID (RAID-C). Among them, since the CMR area of SMR supports out-of-order write operations, the second array of the target RAID (RAID-C) may also support out-of-order write operations.
Furthermore, since the storage area for storing the metadata of the data file is generally operated by an out-of-order write operation when the metadata of the data file stored in the first array (RAID-S) of the target RAID is changed or added, the second array (RAID-C) of the target RAID may be used for storing at least the metadata of the data file stored in the first array (RAID-S) of the target RAID.
Correspondingly, in this specific implementation manner, as shown in fig. 5, the RAID recovery method provided in the embodiment of the present invention further includes the following step S207.
S207: the SMR area of the target hard disk and the SMR areas of the plurality of initial hard disks are configured as a new first array (RAID-S) of the target RAID, and the CMR area of the target hard disk and the CMR areas of the plurality of initial hard disks are configured as a new second array (RAID-C) of the target RAID.
In this specific implementation, since the plurality of hard disks in the target RAID are SMRs, the determined target hard disk and each of the initial hard disks in the target RAID are SMRs, and an SMR area of the plurality of SMRs in the target RAID is configured as a first array of the target RAID (RAID-S), and a CMR area of the plurality of SMRs in the target RAID is configured as a second array of the target RAID (RAID-C), when the target hard disk is added to the target RAID to reconstruct the target RAID, it is necessary to integrate the SMR area of the target hard disk and the SMR area of each of the initial hard disks in the target RAID to form the first array of the reconstructed target RAID (RAID-S), and integrate the SMR area of the target hard disk and the CMR area of each of the initial hard disks in the target RAID to form the second array of the reconstructed target RAID (RAID-C).
Based on this, in this specific implementation, after the target hard disk is determined, the SMR area of the target hard disk and the SMR areas of the multiple initial hard disks may be configured as a new first array (RAID-S) of the target RAID, and the CMR area of the target hard disk and the CMR areas of the multiple initial hard disks may be configured as a new second array (RAID-C) of the target RAID.
In addition to the specific implementation shown in fig. 5, the second array (RAID-C) of the target RAID may store metadata of each data file stored in the first array (RAID-S) of the target RAID, and therefore, when the target data file corresponding to the metadata is a valid file for each metadata, the metadata of the target data file stored in the new second array (RAID-C) of the target RAID is updated after the reconstruction of the target data file is completed, that is, the step S205 is executed and the target data is stored in the target hard disk.
Based on this, optionally, in a specific implementation manner, on the basis of the specific implementation manner shown in fig. 5, the RAID reconfiguration method provided in the embodiment of the present invention may further include the following steps:
the metadata of the target data file is updated in a new second array (RAID-C).
In this specific implementation manner, for a target data file, data content corresponding to the target data file stored in a removed hard disk is restored to an added target hard disk after reconstruction, so that storage information related to the part of data content is changed, for example, a hard disk identifier of a local hard disk, and thus metadata of the stored target data file is also changed.
In this way, when the second array (RAID-C) of the target RAID is used to store the metadata of the data file stored in the first array (RAID-S) of the target RAID, the metadata of the target data file stored in the new second array (RAID-C) of the target RAID may be changed after the target data is stored in the target hard disk. Therefore, after the target data is stored in the target hard disk, the metadata of the target data file can be updated in a new second array (RAID-C) of the target RAID according to the relevant storage information of the target data.
Based on the above specific implementation shown in fig. 5, for the metadata of each data file stored in the target RAID, the data corresponding to the target data file corresponding to the metadata stored in each initial hard disk in the target RAID and the data corresponding to the target data file corresponding to the metadata to be reconstructed in the target hard disk should be stored in the same stripe (stripe) in the first array (RAID-S) of the target RAID.
That is, for the metadata of each data file stored in the target RAID, the stripe (stripe) to which the write area (zone) of the designated data of each initial hard disk in the target RAID belongs is the same as the stripe (stripe) to which the write area (zone) to which the determined target data belongs in the target hard disk.
Based on this, optionally, in a specific implementation manner, on the basis of the specific implementation manner shown in fig. 5, the step S205 of storing the target data in the target hard disk may include the following steps 21 to 22.
Step 21: determining a designated stripe (stripe) to which a write area (zone) storing designated data in each initial hard disk belongs;
step 22: and storing the target data into a write area (zone) belonging to a designated stripe (stripe) in an SMR area of the target hard disk.
In this specific implementation manner, when traversing to the metadata of each data file stored in the target RAID, a write area (zone) in which data corresponding to the target data file corresponding to the metadata stored in each initial hard disk is located may be determined, that is, a write area (zone) in which specified data stored in each initial hard disk is located may be determined, and a specified stripe (stripe) to which the write area (zone) belongs may be further determined.
In this way, the write area (zone) belonging to the designated stripe (stripe) can be specified in the SMR area of the target hard disk, and the specified target data can be stored in the specified write area (zone) belonging to the designated stripe (stripe).
Corresponding to the RAID reconfiguration method provided in the embodiment of the present invention, an embodiment of the present invention provides a RAID driver, where the RAID driver may be used to implement any specific implementation manner in the RAID reconfiguration method provided in the embodiment of the present invention, that is, any specific implementation manner in the RAID reconfiguration method provided in the embodiment of the present invention may be completed by operating the RAID driver.
The embodiment of the present invention does not limit the specific writing manner and writing language of the RAID driver, and as long as the RAID driver capable of implementing any specific implementation manner in the RAID reconfiguration method provided by the embodiment of the present invention is implemented, the RAID driver belongs to the protection scope of the present invention.
Corresponding to the RAID reconfiguration method provided in the embodiments of the present invention, an embodiment of the present invention also provides a RAID reconfiguration apparatus applied to RAID driving.
Fig. 6 is a schematic structural diagram of a RAID reconfiguration apparatus according to an embodiment of the present invention, and as shown in fig. 6, the apparatus may include the following modules:
a hard disk determining module 610, configured to determine a target hard disk; the target hard disk is used for reconstructing a target RAID;
a metadata traversal module 620, configured to traverse each metadata stored in a file system to which the target RAID belongs, and determine whether a target data file corresponding to the metadata is a valid file when each metadata is traversed; if yes, triggering a data reconstruction module 630, if not, traversing the next metadata, and returning to the step of determining whether the target data file corresponding to the metadata is a valid file when each metadata is traversed;
the data reconstructing module 630 is configured to reconstruct target data to be stored in the target hard disk according to specified data stored in the original hard disk that is not moved out in the target RAID; wherein the specified data is: data corresponding to the target data file;
a data storage module 640, configured to store the target data in the target hard disk.
Based on this, by applying the scheme provided by the embodiment of the invention, when reconstructing the data content stored in the new target hard disk added in the target RAID, the invalid file stored in the target RAID can be skipped, and only the valid file in the target RAID is reconstructed, so that the reconstruction of the invalid file can be avoided, and the calculation resource and the reconstruction time can be saved. Therefore, the RAID out of the hard disk with read-write abnormality can be reconstructed quickly and efficiently on the premise of ensuring the integrity of data stored in the reconstructed target RAID and the data security of the target RAID and improving the security level of the target RAID.
Optionally, in a specific implementation manner, the metadata traversal module 620 is specifically configured to:
determining whether a data writing task exists in a writing area of a target data file for storing the metadata or not before reconstructing target data to be stored in the target hard disk according to the specified data stored in the original hard disk which is not moved out in the target RAID; if not, the data reconstruction module 630 is triggered.
Optionally, in a specific implementation manner, the apparatus further includes:
and the RAID marking module is used for marking the target RAID as a normal state when the last metadata in the metadata is traversed.
Optionally, in a specific implementation manner, a plurality of hard disks in the target RAID are set as a first type of hard disk and at least one second type of hard disk, where each second type of hard disk is used to store partial data of a data file, and the first type of hard disk is used to store a check value of the data file; the data reconstruction module 630 is specifically configured to:
if the target hard disk is the first type of hard disk, calculating a check value of the target data file according to partial data of the target data file stored in each initial hard disk, wherein the check value is used as target data to be stored in the target hard disk;
and if the target hard disk is the second type hard disk, generating partial data of the target data file lost in the target RAID according to the partial data and the check value of the target data file stored in each initial hard disk, wherein the partial data is used as target data to be stored in the target hard disk.
Optionally, in a specific implementation manner, the plurality of hard disks in the target RAID are SMRs, and the target RAID includes a first array and a second array, where the first array is formed by SMR areas of the plurality of SMRs, the second array is formed by CMR areas of the plurality of SMRs, and the first array includes: a plurality of strips, each strip comprising: the SMR areas of the SMRs are written into areas with the same offset address and are used for storing data files written in an aligned sequence writing mode; the device further comprises:
an array configuration module, configured to configure the SMR area of the target hard disk and the SMR areas of the initial hard disks as a new first array of the target RAID, and configure the CMR areas of the target hard disk and the initial hard disks as a new second array of the target RAID, before the traversing the metadata of each data file stored in the target RAID.
Optionally, in a specific implementation manner, the apparatus further includes:
and the metadata updating module is used for updating the metadata of the target data file in the new second array.
Optionally, in a specific implementation manner, the data storage module 640 is specifically configured to:
determining a designated stripe to which a write-in area storing the designated data in each initial hard disk belongs;
and storing the target data into a write-in area belonging to the specified strip in an SMR area of the target hard disk.
Corresponding to the RAID reconfiguration method provided in the foregoing embodiment of the present invention, an embodiment of the present invention further provides an electronic device, where the electronic device is provided with a RAID driver, as shown in fig. 7, and includes a processor 701, a communication interface 702, a memory 703 and a communication bus 704, where the processor 701, the communication interface 702, and the memory 703 complete mutual communication through the communication bus 704,
a memory 703 for storing a computer program;
the processor 701 is configured to implement the steps of any RAID reconfiguration method provided in the foregoing embodiments of the present invention when executing the program stored in the memory 703.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
In another embodiment of the present invention, a computer-readable storage medium is further provided, in which a computer program is stored, and the computer program, when executed by a processor, implements the steps of any RAID reconfiguration method provided in the foregoing embodiments of the present invention.
In yet another embodiment of the present invention, a computer program product containing instructions is also provided, which when run on a computer, causes the computer to perform the steps of any of the RAID reconstruction methods provided in the embodiments of the present invention described above.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is 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.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, apparatus embodiments, electronic device embodiments, computer-readable storage medium embodiments, and computer program product embodiments are described for simplicity because they are substantially similar to method embodiments, as may be found in some descriptions of method embodiments.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (12)

1. A RAID reconstruction method is applied to RAID driving, and the method comprises the following steps:
determining a target hard disk; the target hard disk is used for reconstructing a target RAID;
traversing each metadata stored in a file system to which the target RAID belongs, and determining whether a target data file corresponding to the metadata is an effective file when each metadata is traversed;
if so, reconstructing target data to be stored in the target hard disk according to the specified data stored in the original hard disk which is not moved out in the target RAID; the specified data is: data corresponding to the target data file;
if not, traversing the next metadata, and returning to the step of determining whether the target data file corresponding to the metadata is an effective file when each metadata is traversed;
and storing the target data into the target hard disk.
2. The method of claim 1, wherein prior to the step of reconstructing the target data to be stored in the target hard disk according to the specified data stored in the original hard disk that was not migrated in the target RAID, the method further comprises:
determining whether a data writing task exists in a writing area for storing a target data file corresponding to the metadata;
and if the target data does not exist, executing the step of reconstructing the target data to be stored in the target hard disk according to the specified data stored in the original hard disk which is not moved out in the target RAID.
3. The method according to claim 1 or 2, characterized in that the method further comprises:
and when the last metadata in the metadata is traversed, marking the target RAID in a normal state.
4. The method according to claim 1 or 2, wherein the plurality of hard disks in the target RAID are set as a first type hard disk and at least one second type hard disk, each of the second type hard disks is used for storing partial data of a data file, and the first type hard disk is used for storing a check value of the data file;
the step of reconstructing the target data to be stored in the target hard disk according to the specified data stored in the original hard disk which is not moved out in the target RAID comprises:
if the target hard disk is the first type of hard disk, calculating a check value of the target data file according to partial data of the target data file stored in each initial hard disk, wherein the check value is used as target data to be stored in the target hard disk;
and if the target hard disk is the second type hard disk, generating partial data of the target data file lost in the target RAID according to the partial data and the check value of the target data file stored in each initial hard disk, wherein the partial data is used as target data to be stored in the target hard disk.
5. The method of claim 1 or 2, wherein the plurality of hard disks in the target RAID are SMRs, and the target RAID comprises a first array and a second array, wherein the first array is formed by SMR areas of the plurality of SMRs, the second array is formed by CMR areas of the plurality of SMRs, the first array comprising: a plurality of strips, each strip comprising: the SMR areas of the SMRs are written into areas with the same offset address and are used for storing data files written in an aligned sequence writing mode;
before the step of traversing the metadata stored in the file system to which the target RAID belongs, the method further includes:
and configuring the SMR area of the target hard disk and the SMR areas of the plurality of initial hard disks as a new first array of the target RAID, and configuring the CMR area of the target hard disk and the CMR areas of the plurality of initial hard disks as a new second array of the target RAID.
6. The method of claim 5, further comprising:
updating metadata of the target data file in the new second array.
7. The method of claim 5, wherein the step of storing the target data in the target hard disk comprises:
determining a designated stripe to which a write-in area storing the designated data in each initial hard disk belongs;
and storing the target data into a write-in area belonging to the specified strip in an SMR area of the target hard disk.
8. A RAID reconfiguration apparatus for use in a RAID drive, the apparatus comprising:
the hard disk determining module is used for determining a target hard disk; the target hard disk is used for reconstructing a target RAID;
the metadata traversing module is used for traversing each metadata stored in the file system to which the target RAID belongs, and determining whether a target data file corresponding to the metadata is an effective file or not when each metadata is traversed; if yes, triggering a data reconstruction module, if not, traversing the next metadata, and returning to the step of determining whether the target data file corresponding to the metadata is an effective file when each metadata is traversed;
the data reconstruction module is used for reconstructing target data to be stored in the target hard disk according to the specified data stored in the initial hard disk which is not moved out in the target RAID; wherein the specified data is: data corresponding to the target data file;
and the data storage module is used for storing the target data into the target hard disk.
9. The apparatus of claim 8, wherein the metadata traversal module is specifically configured to:
determining whether a data writing task exists in a writing area of a target data file for storing the metadata or not before reconstructing target data to be stored in the target hard disk according to the specified data stored in the original hard disk which is not moved out in the target RAID; if the data do not exist, triggering the data reconstruction module;
and/or the presence of a gas in the gas,
the device further comprises:
the RAID marking module is used for marking the target RAID as a normal state when the last metadata in the metadata is traversed;
and/or the presence of a gas in the gas,
the multiple hard disks in the target RAID are set to be a first type hard disk and at least one second type hard disk, each second type hard disk is used for storing partial data of a data file, and the first type hard disk is used for storing a check value of the data file; the data reconstruction module is specifically configured to:
if the target hard disk is the first type of hard disk, calculating a check value of the target data file according to partial data of the target data file stored in each initial hard disk, wherein the check value is used as target data to be stored in the target hard disk;
if the target hard disk is the second type hard disk, generating partial data of the target data file lost in the target RAID according to partial data and check values of the target data file stored in each initial hard disk, wherein the partial data is used as target data to be stored in the target hard disk;
and/or the presence of a gas in the gas,
the plurality of hard disks in the target RAID are SMRs, and the target RAID comprises a first array and a second array, wherein the first array is formed by SMR areas of the SMRs, the second array is formed by CMR areas of the SMRs, and the first array comprises: a plurality of strips, each strip comprising: the SMR areas of the SMRs are written into areas with the same offset address and are used for storing data files written in an aligned sequence writing mode; the device further comprises:
an array configuration module, configured to configure the SMR area of the target hard disk and the SMR areas of the initial hard disks as a new first array of the target RAID, and configure the CMR areas of the target hard disk and the initial hard disks as a new second array of the target RAID, before traversing the metadata stored in the file system to which the target RAID belongs;
and/or the presence of a gas in the gas,
the device further comprises:
a metadata update module for updating metadata of the target data file in the new second array;
and/or the presence of a gas in the gas,
the data storage module is specifically configured to:
determining a designated stripe to which a write-in area storing the designated data in each initial hard disk belongs;
and storing the target data into a write-in area belonging to the specified strip in an SMR area of the target hard disk.
10. A RAID drive configured to perform the method steps of any one of claims 1 through 7.
11. The electronic equipment is characterized by being provided with a RAID drive and comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any of claims 1 to 7 when executing a program stored in the memory.
12. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of claims 1 to 7.
CN202110784852.4A 2021-07-12 2021-07-12 RAID reconstruction method and device Pending CN113419686A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110784852.4A CN113419686A (en) 2021-07-12 2021-07-12 RAID reconstruction method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110784852.4A CN113419686A (en) 2021-07-12 2021-07-12 RAID reconstruction method and device

Publications (1)

Publication Number Publication Date
CN113419686A true CN113419686A (en) 2021-09-21

Family

ID=77720669

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110784852.4A Pending CN113419686A (en) 2021-07-12 2021-07-12 RAID reconstruction method and device

Country Status (1)

Country Link
CN (1) CN113419686A (en)

Cited By (3)

* 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
CN114153394A (en) * 2021-11-30 2022-03-08 浙江大华技术股份有限公司 Data storage management method, device and equipment
CN115657965A (en) * 2022-11-16 2023-01-31 苏州浪潮智能科技有限公司 Method, device and medium for configuring metadata

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140019680A1 (en) * 2012-07-16 2014-01-16 Agency For Science, Technology And Research Data storage system, method of writing to storage in the data storage system, hard disk and method of forming the hard disk
CN103699337A (en) * 2013-12-04 2014-04-02 华为技术有限公司 Writing control method and system based on independent redundant array of independent disks (RAID)

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140019680A1 (en) * 2012-07-16 2014-01-16 Agency For Science, Technology And Research Data storage system, method of writing to storage in the data storage system, hard disk and method of forming the hard disk
CN103699337A (en) * 2013-12-04 2014-04-02 华为技术有限公司 Writing control method and system based on independent redundant array of independent disks (RAID)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114153394A (en) * 2021-11-30 2022-03-08 浙江大华技术股份有限公司 Data storage management method, device and equipment
CN113918388A (en) * 2021-12-15 2022-01-11 苏州浪潮智能科技有限公司 Data recovery method, device, equipment and storage medium
CN115657965A (en) * 2022-11-16 2023-01-31 苏州浪潮智能科技有限公司 Method, device and medium for configuring metadata
CN115657965B (en) * 2022-11-16 2023-04-07 苏州浪潮智能科技有限公司 Method, device and medium for configuring metadata

Similar Documents

Publication Publication Date Title
CN106548789B (en) Method and apparatus for operating stacked tile type magnetic recording equipment
US8880843B2 (en) Providing redundancy in a virtualized storage system for a computer system
CN113419686A (en) RAID reconstruction method and device
KR101870521B1 (en) Methods and systems for improving storage journaling
CN113419685B (en) RAID creation based on SMR, data writing aiming at RAID and RAID recovery method
US10970173B2 (en) Logging process in a data storage system
US10114576B2 (en) Storage device metadata synchronization
KR20170023734A (en) Methods and systems for improving flash memory flushing
CN110597663A (en) Transaction processing method and device
CN112463058B (en) Fragmented data sorting method and device and storage node
US8688938B2 (en) Data copying
US11768701B2 (en) Exception analysis for data storage devices
US9009430B2 (en) Restoration of data from a backup storage volume
US7529904B2 (en) Storing location identifier in array and array pointer in data structure for write process management
US20110153674A1 (en) Data storage including storing of page identity and logical relationships between pages
CN109508140B (en) Storage resource management method and device, electronic equipment and system
CN114924923A (en) Method, system, equipment and medium for verifying correctness of hard disk write-in point
CN109284270B (en) Deployment optimization method and device for distributed file system storage module
CN111444114B (en) Method, device and system for processing data in nonvolatile memory
US9740632B1 (en) Snapshot efficiency
CN111506250B (en) Data deleting method and device, electronic equipment and storage medium
CN116257531B (en) Database space recovery method
CN107562642B (en) Checkpoint elimination method and device
US10740015B2 (en) Optimized management of file system metadata within solid state storage devices (SSDs)
US9690503B2 (en) Returning coherent data in response to a failure of a storage device when a single input/output request spans two storage devices

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20210921

RJ01 Rejection of invention patent application after publication