Hard disk online detection method and device

文档序号:70731 发布日期:2021-10-01 浏览:32次 中文

阅读说明:本技术 一种硬盘上线检测方法与装置 (Hard disk online detection method and device ) 是由 寇耀飞 王志豪 周明伟 江文龙 罗心 于 2021-07-28 设计创作,主要内容包括:一种硬盘上线检测方法与装置,所述方法包括:数据节点获取待上线硬盘中的校验信息;所述校验信息包括集群信息和/或集群信息标识;所述集群信息标识用于标记所述集群信息,所述集群信息包括所述数据节点当前所处集群的信息;所述数据节点根据所述校验信息对所述待上线硬盘进行校验;如果校验通过,硬盘上线。通过这种方式,可以保证存储集群的数据安全,有效提升了存储系统的可用性和可靠性。(A hard disk online detection method and device are provided, the method comprises the following steps: the data node acquires check information in a hard disk to be online; the verification information comprises cluster information and/or a cluster information identifier; the cluster information identifier is used for marking the cluster information, and the cluster information comprises information of a cluster where the data node is located currently; the data node verifies the hard disk to be online according to the verification information; and if the verification is passed, the hard disk is on line. By the method, the data security of the storage cluster can be ensured, and the availability and reliability of the storage system are effectively improved.)

1. A hard disk online detection method is characterized by comprising the following steps:

the data node acquires check information in a hard disk to be online; the verification information comprises cluster information and/or a cluster information identifier; the cluster information identifier is used for marking the cluster information, and the cluster information comprises information of a cluster where the data node is located currently;

the data node verifies the hard disk to be online according to the verification information;

and if the hard disk to be online is verified, the hard disk is online.

2. The method of claim 1, before the data node obtains the verification information in the hard disk to be online, further comprising:

storing the cluster information in a first area in the hard disk to be online;

storing first information in a second area in the hard disk to be online; the first information comprises the media type and the management mode of the hard disk to be online and the cluster information identifier; the media type is used for indicating the type of the hard disk; the management mode is used for indicating a management mode supported by the hard disk to be online; when the cluster information in the first area is updated, the cluster information identifier in the second area is updated correspondingly.

3. The method of claim 1,

the hard disk comprises a CMR area and an SMR area;

the data node verifies the hard disk to be online according to the verification information, and the verification method comprises the following steps:

verifying cluster information in the SMR area and a cluster information identifier in the SMR area; and/or the presence of a gas in the gas,

and verifying the cluster information in the CMR area and the cluster information identifier in the CMR area.

4. The method of claim 1,

the hard disk comprises a CMR area and an SMR area;

the data node verifies the hard disk to be online according to the verification information, and the verification method comprises the following steps:

and comparing the cluster information and/or the cluster information identification in the SMR area with the cluster information and/or the cluster information identification in the CMR area.

5. The method of claim 1,

the hard disk comprises a CMR area and an SMR area;

the data node verifies the hard disk to be online according to the verification information, and the verification method comprises the following steps:

comparing the cluster information and/or the cluster information identifier in the CMR area with the cluster information and/or the cluster information identifier in the data node; and/or the presence of a gas in the gas,

and comparing the cluster information and/or the cluster information identification in the SMR area with the cluster information and/or the cluster information identification in the data node.

6. The method according to claim 1, wherein the data node checks the hard disk to be online according to the check information, and the method comprises:

and verifying that the hard disk belongs to the data node through the verification information.

7. The method of claim 1, further comprising:

if the hard disk to be online is not verified, repairing the hard disk;

and (5) online repairing the hard disk.

8. The method of claim 7, wherein repairing the hard disk comprises:

acquiring cluster information and/or cluster information identification in the data node;

and updating the hard disk according to the cluster information and/or the cluster information identifier in the data node.

9. The method of claim 7,

the hard disk comprises a CMR area and an SMR area;

the repairing the hard disk by using the verification information in the CMR area as main verification information and the verification information in the SMR area as standby verification information comprises the following steps:

and if the CMR area is damaged, applying for a storage address of the cluster information in the SMR area so that the SMR area comprises two storage addresses which are respectively used for storing the main check information and the standby check information.

10. The utility model provides a hard disk detection device that comes on line which characterized in that includes:

the scanning unit is used for acquiring the check information in the hard disk to be online; the verification information comprises cluster information and/or a cluster information identifier; the cluster information identifier is used for marking the cluster information, and the cluster information comprises information of a cluster where the data node is located currently;

the verification unit is used for verifying the hard disk to be online according to the verification information;

and the processing unit is used for uploading the hard disk when the verification passes.

11. The apparatus of claim 10, wherein the processing unit is further configured to:

storing the cluster information in a first area in the hard disk to be online;

storing first information in a second area in the hard disk to be online; the first information comprises the media type and the management mode of the hard disk to be online and the cluster information identifier; the media type is used for indicating the type of the hard disk; the management mode is used for indicating a management mode supported by the hard disk to be online; when the cluster information in the first area is updated, the cluster information identifier in the second area is updated correspondingly.

12. The apparatus of claim 10,

the hard disk comprises a CMR area and an SMR area; the verification unit is specifically configured to:

verifying cluster information in the SMR area and a cluster information identifier in the SMR area; and/or the presence of a gas in the gas,

and verifying the cluster information in the CMR area and the cluster information identifier in the CMR area.

13. The apparatus of claim 10,

the hard disk comprises a CMR area and an SMR area; the verification unit is specifically configured to:

and comparing the cluster information and/or the cluster information identification in the SMR area with the cluster information and/or the cluster information identification in the CMR area.

14. The apparatus of claim 10,

the hard disk comprises a CMR area and an SMR area; the verification unit is specifically configured to:

comparing the cluster information and/or the cluster information identifier in the CMR area with the cluster information and/or the cluster information identifier in the data node; and/or the presence of a gas in the gas,

and comparing the cluster information and/or the cluster information identification in the SMR area with the cluster information and/or the cluster information identification in the data node.

15. The apparatus according to claim 10, wherein the verification unit is specifically configured to:

and verifying that the hard disk belongs to the data node through the verification information.

16. The apparatus according to claim 10, wherein the processing unit is specifically configured to:

if the hard disk to be online is not verified, repairing the hard disk;

and (5) online repairing the hard disk.

17. The apparatus according to claim 16, wherein the processing unit is specifically configured to:

acquiring cluster information and/or cluster information identification in the data node;

and updating the hard disk according to the cluster information and/or the cluster information identifier in the data node.

18. The apparatus of claim 16,

the hard disk comprises a CMR area and an SMR area; the check information in the CMR area is primary check information, the check information in the SMR area is backup check information, and the repair device is specifically configured to:

and if the CMR area is damaged, applying for a storage address of the cluster information in the SMR area so that the SMR area comprises two storage addresses which are respectively used for storing the main check information and the standby check information.

19. An electronic device, comprising:

a memory for storing program instructions;

a processor for calling program instructions stored in said memory and for executing the steps comprised by the method of any one of claims 1 to 9 in accordance with the obtained program instructions.

20. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program comprising program instructions that, when executed by a computer, cause the computer to perform the method according to any one of claims 1-9.

Technical Field

The present application relates to the field of distributed storage cluster systems, and in particular, to a hard disk online detection method and apparatus.

Background

In the distributed storage cluster, when each data node server and the hard disk thereof are on-line for the first time, the metadata server distributes unique marking information of the cluster, so that the data in the hard disk belong to the current storage cluster, the hard disk which does not belong to the current cluster cannot be on-line, the data safety of the hard disk is ensured, and the internal migration of the hard disk in the same cluster can be supported.

In the actual use process, with the increase of the service scale, the number of data nodes for storing cluster management and hard disks in the nodes is very large, and if the cluster identification in the hard disks is lost, the hard disks are failed to be online; and if the hard disk cannot be allocated with the cluster identifier (for example, the cluster identifier cannot be persisted to the hard disk due to the fact that the hard disk cannot use the file system), the hard disk cannot be normally online.

Disclosure of Invention

The application provides a hard disk online detection method and device, which are used for improving the availability and reliability of a storage system.

In a first aspect, a method for detecting an online hard disk is provided, including:

the data node acquires the verification information of the hard disk to be online; the verification information comprises cluster information and/or a cluster information identifier; the cluster information identifier is used for marking the cluster information, and the cluster information comprises information of a cluster where the data node is located currently;

the data node verifies the hard disk to be online according to the verification information;

and if the hard disk to be online is verified, the hard disk is online.

In a possible design, before the data node obtains the check information in the hard disk to be online, the method further includes: storing the cluster information in a first area in the hard disk to be online;

storing first information in a second area in the hard disk to be online; the first information comprises the media type and the management mode of the hard disk to be online and the cluster information identifier; the media type is used for indicating the type of the hard disk; the management mode is used for indicating a management mode supported by the hard disk to be online; when the cluster information in the first area is updated, the cluster information identifier in the second area is updated correspondingly.

In one possible design, the hard disk includes a conventional magnetic recording CMR region and a shingled magnetic recording SMR region; the data node, according to the verification information, for the hard disk to be online, includes:

verifying cluster information in the SMR area and a cluster information identifier in the SMR area; and/or the presence of a gas in the gas,

and verifying the cluster information in the CMR area and the cluster information identifier in the CMR area.

In one possible design, the hard disk includes a CMR area and an SMR area; the data node, according to the verification information, for the hard disk to be online, includes:

and comparing the cluster information and/or the cluster information identification in the SMR area with the cluster information and/or the cluster information identification in the CMR area.

In one possible design, the hard disk includes an SMR area and a CMR area; the data node, according to the verification information, for the hard disk to be online, includes:

comparing the cluster information and/or the cluster information identifier in the CMR area with the cluster information and/or the cluster information identifier in the data node; and/or the presence of a gas in the gas,

and comparing the cluster information and/or the cluster information identification in the SMR area with the cluster information and/or the cluster information identification in the data node.

In a possible design, the verifying, by the data node, the hard disk to be online according to the verification information includes:

and verifying that the hard disk belongs to the data node through the verification information.

In one possible design, the method further includes:

if the hard disk to be online is not verified, repairing the hard disk;

and (5) online repairing the hard disk.

In one possible design, repairing the hard disk includes:

acquiring cluster information and/or cluster information identification in the data node;

and updating the hard disk according to the cluster information and/or the cluster information identifier in the data node.

In one possible design, the hard disk includes a CMR area and an SMR area;

the repairing the hard disk by using the verification information in the CMR area as main verification information and the verification information in the SMR area as standby verification information comprises the following steps:

and if the CMR area is damaged, applying for a storage address of the cluster information in the SMR area so that the SMR area comprises two storage addresses which are respectively used for storing the main check information and the standby check information.

In a second aspect, a hard disk online detection device is provided, which includes:

the scanning unit is used for acquiring the check information in the hard disk to be online; the verification information comprises cluster information and/or a cluster information identifier; the cluster information identifier is used for marking the cluster information, and the cluster information comprises information of a cluster where the data node is located currently;

the verification unit is used for verifying the hard disk to be online according to the verification information;

and the processing unit is used for uploading the hard disk when the verification passes.

In a possible embodiment, the processing unit is further configured to:

storing the cluster information in a first area in the hard disk to be online;

storing first information in a second area in the hard disk to be online; the first information comprises the media type and the management mode of the hard disk to be online and the cluster information identifier; the media type is used for indicating the type of the hard disk; the management mode is used for indicating a management mode supported by the hard disk to be online; when the cluster information in the first area is updated, the cluster information identifier in the second area is updated correspondingly.

In one possible embodiment, the hard disk comprises a CMR area and an SMR area; the verification unit is specifically configured to:

verifying cluster information in the SMR area and a cluster information identifier in the SMR area; and/or the presence of a gas in the gas,

and verifying the cluster information in the CMR area and the cluster information identifier in the CMR area.

In one possible embodiment, the hard disk comprises a CMR area and an SMR area; the verification unit is specifically configured to:

and comparing the cluster information and/or the cluster information identification in the SMR area with the cluster information and/or the cluster information identification in the CMR area.

In one possible embodiment, the hard disk comprises a CMR area and an SMR area; the verification unit is specifically configured to:

comparing the cluster information and/or the cluster information identifier in the CMR area with the cluster information and/or the cluster information identifier in the data node; and/or the presence of a gas in the gas,

and comparing the cluster information and/or the cluster information identification in the SMR area with the cluster information and/or the cluster information identification in the data node.

In a possible embodiment, the verification unit is specifically configured to:

and verifying that the hard disk belongs to the data node through the verification information.

In a possible embodiment, the processing unit is specifically configured to:

if the hard disk to be online is not verified, repairing the hard disk;

and (5) online repairing the hard disk.

In a possible embodiment, the processing unit is specifically configured to:

acquiring cluster information and/or cluster information identification in the data node;

and updating the hard disk according to the cluster information and/or the cluster information identifier in the data node.

In one possible embodiment, the hard disk comprises a CMR area and an SMR area; the check information in the CMR area is primary check information, the check information in the SMR area is backup check information, and the repair device is specifically configured to:

and if the CMR area is damaged, applying for a storage address of the cluster information in the SMR area so that the SMR area comprises two storage addresses which are respectively used for storing the main check information and the standby check information.

In a third aspect, an electronic device is provided, including:

a memory for storing program instructions;

and the processor is used for calling the program instructions stored in the memory and executing the steps included in the method provided by the first aspect according to the obtained program instructions.

In a fourth aspect, a computer-readable storage medium is provided, which stores a computer program comprising program instructions, which, when executed by a computer, cause the computer to perform the method provided by the first aspect described above.

In a fifth aspect, a computer program product comprising instructions is provided, which, when run on a computer, causes the computer to perform the method steps as provided in the first aspect above.

In the embodiment of the application, a data node acquires check information in a hard disk to be online; the verification information comprises cluster information and/or a cluster information identifier; the cluster information identifier is used for marking the cluster information, and the cluster information comprises information of a cluster where the data node is located currently; the data node verifies the hard disk to be online according to the verification information; and if the verification is passed, the hard disk is on line. By the mode, the online hard disk is safe, the data safety of the storage cluster can be ensured, and the availability and the reliability of the storage system are effectively improved.

Drawings

In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application.

FIG. 1 is a system architecture framework provided by an embodiment of the present application;

FIG. 2 is a flow chart provided by an embodiment of the present application;

fig. 3 is a flowchart of online detection of an SMR disk in a node according to an embodiment of the present application;

FIG. 4 is a flowchart of a process for SMR disk cluster information corruption according to an embodiment of the present application;

fig. 5 is a structural diagram of an online detection device for an SMR hard disk according to an embodiment of the present application;

fig. 6 is a schematic view of an electronic device according to an embodiment of the present application.

Detailed Description

In order to make the objects, technical solutions and advantages of the present application more apparent, the technical solutions in the embodiments of the present application will be described clearly and completely with reference to the accompanying 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. In the present application, the embodiments and features of the embodiments may be arbitrarily combined with each other without conflict. Also, while a logical order is shown in the flow diagrams, in some cases, the steps shown or described may be performed in an order different than here.

The terms "first" and "second" in the description and claims of the present application and the above-described drawings are used for distinguishing between different objects and not for describing a particular order. Furthermore, the term "comprises" and any variations thereof, which are intended to cover non-exclusive protection. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus. The "plurality" in the present application may mean at least two, for example, two, three or more, and the embodiments of the present application are not limited.

In addition, the term "and/or" herein is only one kind of association relationship describing an associated object, and means that there may be three kinds of relationships, for example, a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" in this document generally indicates that the preceding and following related objects are in an "or" relationship unless otherwise specified.

The technical scheme provided by the embodiment of the application is described in the following with the accompanying drawings of the specification.

Referring to fig. 1, fig. 1 is a schematic view of a structural framework of the system provided in the present application. The system comprises: the system comprises a metadata server, a plurality of data nodes and a plurality of hard disks. The metadata server may send cluster information to each data node, and the data nodes may store the cluster information in corresponding hard disks, for example, the data node 1 stores the cluster information in the hard disk 1, the data node 2 stores the cluster information in the hard disk 2, and so on.

Fig. 2 is a schematic flowchart of a hard disk online detection method according to an embodiment of the present application, where the method flow may be applied to the system shown in fig. 1. The flow chart of the method shown in fig. 2 is described as follows:

step 201: and the data node acquires the verification information in the hard disk to be online.

One possible implementation manner is that after the data node system is started, all available hard disks connected with the data node are scanned, and check information in the hard disks is read; the check information includes cluster information and/or a cluster information flag, where the cluster information flag is used to flag cluster information, for example, the cluster information flag may be a storage address used to store cluster information. And if the verification information is stored in a designated sector in the hard disk, acquiring the verification information in the hard disk from the designated sector. For example, the cluster information and the cluster information flag may be stored in the same area or different areas in the hard disk.

Optionally, before step 201, the method may further include: storing the cluster information in a first area in the hard disk to be online; storing first information (which can be called as superblock information) in a second area of the hard disk to be online; the first information comprises the media type and the management mode of the hard disk to be online and the cluster information identifier.

Wherein the media type is used to indicate a type of the hard disk. The media types may include: mechanical disks such as a Conventional Magnetic Recording (CMR) hard disk, a Shingled Magnetic Recording (SMR) hard disk, and the like; or at least one of a solid state disk SSD or the like.

The management mode is used for indicating a management mode supported by the hard disk to be online; the method can comprise the following steps: a file system, such as a third generation extended file system ext3, or a high performance journaling file system xfs, etc.; or a file system free management system, or a hybrid management system under an SMR hard disk.

The cluster information identifier may be a storage address for storing cluster information, and may include: absolute path and/or relative path of cluster information in the hard disk. If the cluster information is stored in a designated sector in the hard disk, the location refers to the absolute path and/or the relative path of the cluster information within the designated sector. When the cluster information in the first area is updated, the cluster information in the second area correspondingly updates the position in the hard disk,

the hard disk to be online in the embodiment of the application can adopt an SMR hard disk of a mixed mode, and the SMR hard disk is divided into a CMR area and an SMR area. For convenience of description, the cluster information in the CMR area and the storage address of the cluster information in the CMR area are used as main check information in the following description; and taking the cluster information in the SMR area and the storage address of the cluster information in the SMR area as backup check information.

The CMR partition is used as a single disk management area, and the single disk management is that the CMR area is used as an area for managing the current hard disk (including but not limited to storing cluster information on the hard disk, which is not explained herein too much), and a part of the storage capacity of the CMR medium is configured for the hard disk from the start position of the hard disk; in the application, the CMR partitions are formatted into a universal file system, and cluster information is stored in a file form.

Wherein the SMR partition is used as a data management area, which is a process of efficiently collecting, storing, processing, and applying data using computer hardware and software technologies. The purpose of data management is to fully and effectively play the role of data and realize the effective management of the data; typically, the storage space of the SMR medium in the SMR hard disk is originally used to store and manage user data, and the SMR partition has no concept of a file, but some binary data (such as 010 0101 …); in the application, a space for storing cluster information carried by the hard disk is reserved in an SMR area of the SMR disk, and the cluster information stored in the SMR partition is used as a backup of the cluster information file in the CMR area.

Optionally, the cluster information and the storage address of the cluster information stored in the CMR partition are theoretically consistent with the cluster information and the storage address of the cluster information stored in the SMR partition.

The purpose of this application to manage SMR disks using mixed mode is: in a general file system, cluster information in a file form has universality and visibility in different operating systems; for example, after the cluster identification information file in the hard disk is generated in the Linux operating system, the file can be exported to the Windows operating system for viewing and modification, and then the file is updated to the hard disk, and the data node can still analyze the file, so that the availability of the storage cluster is improved.

Optionally, if the SMR hard disk to be brought online is used before, the data node does not need to initialize the SMR hard disk, and only needs to check the cluster identification information on the SMR hard disk; when the SMR hard disk is a new disk, the data node may perform an initialization action on the SMR hard disk. For example, partitioning and formatting the SMR hard disk; writing the super block written with the cluster information into a hard disk; and updating the cluster information to a cluster identification file of a CMR area, and dividing the cluster information into the SMR partitions of the SMR hard disk, and the like.

Step 202: and verifying the hard disk to be online according to the verification information.

Wherein, the check-up information includes: cluster information and/or the storage address of the cluster information in the hard disk. The hard disk comprises a CMR area and an SMR area, check information in the CMR area comprises cluster information and storage addresses of the cluster information, and check information in the SMR area comprises the cluster information and the storage addresses of the cluster information.

The first verification method is to verify the cluster information in the SMR area and the storage address of the cluster information in the SMR area; and/or checking the cluster information in the CMR area and the storage address of the cluster information in the CMR area.

Exemplarily, comparing the cluster information in the SMR area with the storage address of the cluster information in the SMR area; for example, the cluster information in the storage address is read, the read cluster information is compared with the cluster information in the SMR area, if the read cluster information is consistent with the cluster information in the SMR area, the verification is passed, and if the read cluster information is inconsistent with the cluster information in the SMR area, the verification is seriously failed.

The second verification method is to compare the cluster information and/or the storage address in the SMR area with the cluster information and/or the storage address in the CMR area. Possible situations include: comparing the cluster information within the SMR area to the cluster information within the CMR area; or comparing the storage address of the cluster information in the SMR area with the storage address of the cluster information in the CMR area; or comparing the cluster information in the SMR area with the storage address of the cluster information in the CMR area; or comparing the storage address of the cluster information in the SMR area with the cluster information in the CMR area.

The second verification method is different from the first verification method in that the first verification method is information verification in the same area, and the second verification method is information verification between different areas.

Comparing the cluster information and/or the storage address in the CMR area with the cluster information and/or the storage address in the data node in a third checking mode; and/or comparing the cluster information and/or the storage address in the SMR area with the cluster information and/or the storage address in the data node.

The third verification method is different from the first two verification methods in that the third verification method is information verification between different areas on the hard disk and the data nodes respectively.

For example, preferably, the storage addresses of the cluster information and the cluster information in the CMR area are used as the standard, the storage addresses of the cluster information and the cluster information in the data nodes are checked, and if the storage addresses of the cluster information and the cluster information in the SMR area are not matched, the storage addresses of the cluster information and the cluster information in the data nodes are used for checking; or, checking the cluster information and the storage address of the cluster information in the CMR area and the cluster information and the storage address of the cluster information in the SMR area with the cluster information in the data node and the storage address of the cluster information, respectively, at the same time.

And in a fourth verification mode, the hard disk is verified to belong to the data node through the verification information. For example, the third checking method can be used, and if the check is passed, it is verified that the hard disk belongs to the data node. Or, it may also be verified whether the hard disk belongs to the data node by other verification methods. For example, there is a node identifier in the hard disk, and the node identifier in the data node is compared, and the comparison proves that the hard disk belongs to the data node. Or, the metadata server transmits metadata server information to the data node, wherein the metadata server information includes: and the cluster information in the metadata server and the storage address of the cluster information. Comparing the cluster information in the hard disk and the storage address of the cluster information with the metadata server information in the data node; when the verification information is successfully verified with the metadata server information, the data in the hard disk can be confirmed to belong to the current cluster; after the data in the hard disk is confirmed to belong to the current cluster, further comparing the verification information in the hard disk and the data node, and when the verification is passed, determining that the hard disk belongs to the current node; and (6) the hard disk is on line.

Step 203: and checking the hard disk to be online, and online the hard disk.

Optionally, if the verification in step 202 fails, a hard disk repair may also be performed.

The first repair mode is to obtain cluster information and/or a cluster information identifier in the data node; and updating the hard disk according to the cluster information and/or the cluster information identifier in the data node. That is, if the verification fails, the cluster information in the data node is used as the standard.

In the first case, when the cluster information in the SMR area and the CMR area is not matched with the storage address data of the cluster information, it is determined that the verification of the cluster information stored in the hard disk is invalid, and the cluster information in the hard disk will not continuously participate in the comparison and verification of the cluster information; and at the moment, the hard disk updates the node data in the hard disk by taking the cluster information in the data nodes as a reference, and synchronously updates the storage address of the cluster information in the hard disk when the cluster information corresponding to the hard disk is updated, namely the hard disk is updated.

In the second case, the SMR hard disk carries two pieces of cluster information together; one part is the cluster information file stored in the CMR area, and the other part is the cluster information data stored in the SMR area in a binary form; when one of the cluster information in the SMR area and the storage address of the cluster information or only one of the cluster information in the CMR area and the storage address of the cluster information is not matched, updating the cluster information in the unmatched area and the storage address of the cluster information according to the cluster information in the matched area and the storage address of the cluster information, and after the data are synchronously updated, the two data are mutually backed up.

In a third situation, when the data in the SMR area is inconsistent with the data in the CMR area, checking the data in the data node with the cluster information in the CMR area as a standard, and if the data in the SMR area is matched with the data in the CMR area, updating the cluster information in the SMR area and the storage address of the cluster information according to the correct cluster information in the CMR area; and if not, updating cluster information in an SMR area and a CMR area in the hard disk and the storage address of the cluster information according to the cluster information in the data node.

A second repair method is that, if the CMR is damaged, the SMR area is requested for a storage address of the cluster information again, so that the SMR area includes two storage addresses, which are respectively used for storing the primary check information and the backup check information. The difference from the first repair method is that the first repair method is to directly update and repair a hard disk, and the second repair method is to divide two regions in the SMR region of the hard disk to store cluster information.

In the first case, when the check data of the CMR area does not match the check data in the data node and the check data of the SMR area matches the check data in the data node, it is determined that the CMR area has a damaged common file system, which may result in the CMR area in the entire SMR hard disk being unusable; since the capacity of the SMR hard disk is generally large, in this case, the data node may generally apply for a segment of available storage space again in the SMR area, where the space is used to store new cluster information, and the new cluster information is written into the super block of the hard disk again, so as to ensure that there are two pieces of valid cluster information in the hard disk all the time; at this time, two pieces of cluster information owned in the SMR area of the hard disk are mutually backed up, and the hard disk is on-line.

In the second case, when the check data in the SMR area and the check data in the CMR area do not match the check data in the data node, a failure occurs in reading and/or updating the cluster information of the CMR area and/or the SMR area and the storage address of the cluster information, and the storage medium storing the cluster information is considered to be damaged. In this case, it is necessary to search for another valid sector in the hard disk, replace the cluster information and the storage address of the cluster information in the new valid sector, and after the update is completed, store the storage address of the newly stored cluster information in the SMR hard disk.

The difference from the first case is that: in the first case, the parity information in at least one of the CMR and SMR regions matches the parity information in the data nodes, and in the second case, the parity information in the region does not match the parity information in the data nodes.

The third repair mode is that when the comparison between the check information in the hard disk and the metadata server information is inconsistent, the compared hard disk is determined not to belong to the current cluster, the cluster information in the hard disk and the storage address data of the cluster information are unavailable, and the repair operation needs to be performed in the first repair mode; and re-executing the on-line action of the hard disk. When the comparison result of the verification information in the hard disk and the metadata server information is consistent, but the verification of the verification information in the hard disk and the data node is unsuccessful, the hard disk does not belong to the current node; in the present application, it is determined that the hard disk is migrated from another node in the cluster, and at this time, the hard disk data may still be used continuously, but the cluster information migrated from another node and the storage address of the cluster information need to be reported to the metadata server again to complete the data migration action; after the complete cluster information and the storage address of the cluster information are verified, the cluster information in an SMR area and a CMR area in the hard disk and the storage address of the cluster information are synchronously updated, and the cluster information in the SMR area and the CMR area and the storage address of the cluster information are ensured to be consistent with the cluster information in the data node and the storage address of the cluster information.

Optionally, each piece of cluster information corresponds to a unique storage address to ensure validity and integrity of the to-be-verified cluster information, so that the storage addresses of the cluster information are synchronously updated while the to-be-verified cluster information is updated; for example, as described in step 201, no matter whether the SMR disk to be online is a new disk or an old disk that has been used before, when the cluster information and the storage address of the cluster information are verified and updated, the cluster information in the hard disk changes, and at this time, the cluster information and the storage address of the cluster information in the CMR area and the SMR area in the SMR hard disk need to be updated synchronously, in order to ensure that the storage addresses of the cluster information and the cluster information in the hard disk, the storage addresses of the cluster information and the cluster information in the current metadata server and the data node are all consistent, the purpose is to facilitate information verification of the hard disk during hot plug next time.

In this embodiment of the present application, there are two pieces of cluster information carried in the hard disk all the time, that is, there are one piece of cluster information in each of the CMR area and the SMR area, and possible implementation scenarios include:

the first scenario is that the CMR area of the SMR hard disk is formatted into a universal file system, and the cluster information is stored in a file form; the SMR area of the SMR hard disk stores the cluster information in a binary mode; the two pieces of cluster information are backups of each other.

The second scenario is that the CMR area of the SMR hard disk does not need to be formatted as a universal file system, and together with the cluster information in the SMR area, the cluster information is saved in a binary form, and the two pieces of data still back up each other.

In a third scenario, on the premise of the first scenario, the common file system in the CMR area is damaged, a section of capacity is acquired in the SMR area, where the capacity is used to store cluster information and inherits the identity of the primary cluster information in the original CMR area, and another piece of cluster information in the original SMR area is kept unchanged as backup cluster information, and the two pieces of data are still backed up with each other.

By processing when cluster information in the SMR hard disk is damaged, the cluster information management method further ensures that the hard disk to be online can be provided with a storage address which can generally store the cluster information as long as available sectors exist in the hard disk, and can also provide the cluster information management and verification functions, further ensures the data safety of the cluster information, and improves the availability and the safety of the system.

Fig. 3 is an example provided by an embodiment of the present application. As shown in fig. 3, the process includes:

s301, scanning and analyzing the hard disk super block. For introduction of the super block, please refer to the foregoing.

S302, whether the super block has the main/standby check information of the SMR disk or not is obtained. For an introduction of the SMR disk, the main verification information includes: cluster information in a CMR area of the SMR disk and a storage address of the cluster information; the check information includes: cluster information in an SMR area of the SMR disk and a storage address of the cluster information;

s303, whether the main verification information is matched with the verification information of the data node or not is judged; when the output in S302 is yes, continue to step S303, otherwise go to step S305;

s305, the hard disk is online;

s304, whether the check information is matched with the check information of the data node or not is judged; when the output of the step S303 is no, the step S304 is performed, otherwise, the step S306 is performed;

s306, updating the main and standby verification information in the hard disk; when the output of S303 is yes, or the output of S304 is yes, the process proceeds to step S306;

s307, generating verification information needing to be persisted to the hard disk according to the verification information in the data nodes, and writing the verification information into a main and standby verification information area of the SMR disk; after S305 is completed, go to step S306;

s308, the hard disk is successfully online; after the operations in steps S301-S307 are completed, step S308 is performed.

S309, failing to get on the hard disk; when the output of S304 is no, step S309 is performed.

Fig. 4 is another example provided by an embodiment of the present application. As shown in fig. 4, the process includes:

s401, whether main cluster information of the SMR disk is successfully read or not is judged; the introduction of the SMR disk refers to the foregoing, and the main cluster information is cluster information in a CMR area in the SMR disk;

s402, whether the main cluster information of the SMR disk is matched with the storage address of the SMR disk or not is judged; wherein the main cluster information is cluster information in a CMR area in the SMR disk; when the output of S401 is yes, go to step S402, otherwise go to S403;

s403, whether the backup cluster information of the SMR disk is successfully read or not is judged; wherein the standby cluster information is cluster information in an SMR area in the SMR disk; when the output of S401 is no, or the output of S402 is no, step S403 is continued;

s404, whether the backup cluster information of the SMR disk is matched with the storage address of the SMR disk or not is judged; when the output of S403 is yes, the step S404 is entered, otherwise, the step S405 is executed;

s405, cluster information in the hard disk is completely damaged; when the output of S404 is no or the output of S403 is no, the process proceeds to step S405;

s406, the hard disk fails to be on line; when the actions of S401-S405 are all completed, the process goes to step S406;

s407, as valid verification information; the cluster information and the storage address of the device are used for verifying the information; when the output of S402 is yes, or the output of S404 is yes, the process proceeds to step S407;

s408, whether the main cluster information and the standby cluster information need to be repaired or not; when the operations of S401-S404 and S407 are all completed, the process proceeds to step S408;

s409, after updating the cluster information, updating the new address to the hard disk super block; for the introduction of super-block, please refer to the foregoing; when the output of S408 is yes, go to operation S409, otherwise, perform operation S410;

s410, the hard disk is successfully online; when the actions of S406-S410 are all completed, operation S410 is entered.

Based on the same inventive concept, the embodiment of the application provides a hard disk online detection device. The hard disk online detection device can be a hardware structure, a software module or a hardware structure and a software module. The hard disk online detection device can be realized by a chip system, and the chip system can be formed by a chip and can also comprise the chip and other discrete devices. Referring to fig. 5, the hard disk online detection apparatus includes a scanning unit 501, a verification unit 502, and a processing unit 503. Wherein: a scanning unit 501, configured to scan, by a data node, a hard disk to be online to obtain check information in the hard disk; the verification information comprises cluster information and/or a cluster information identifier;

a verification unit 502, configured to verify the hard disk to be online according to the verification information;

the processing unit 503 is configured to upload the hard disk when the hard disk to be uploaded passes verification.

In a possible implementation manner, the hard disk to be online comprises an SMR area and a CMR area; the verification unit 502 is specifically configured to:

verifying cluster information in the SMR area and a cluster information identifier in the SMR area; and/or the presence of a gas in the gas,

and verifying the cluster information in the CMR area and the cluster information identifier in the CMR area.

In a possible implementation manner, the hard disk to be online comprises an SMR area and a CMR area; the verification unit 502 is specifically configured to:

and comparing the cluster information and/or the cluster information identification in the SMR area with the cluster information and/or the cluster information identification in the CMR area.

In a possible implementation manner, the hard disk to be online comprises an SMR area and a CMR area; the verification unit 502 is specifically configured to:

comparing the cluster information and/or the cluster information identifier in the CMR area with the cluster information and/or the cluster information identifier in the data node; and/or the presence of a gas in the gas,

and comparing the cluster information and/or the cluster information identification in the SMR area with the cluster information and/or the cluster information identification in the data node.

In a possible implementation manner, the hard disk to be online comprises an SMR area and a CMR area; the verification unit 502 is specifically configured to:

and verifying that the hard disk belongs to the data node through the verification information.

In a possible implementation manner, the processing unit 503 is specifically configured to:

if the verification fails, repairing the hard disk;

and (5) online repairing the hard disk.

In a possible implementation manner, the processing unit 503 is specifically configured to:

acquiring cluster information and/or cluster information identification in the data node;

and updating the hard disk according to the cluster information and/or the cluster information identifier in the data node.

In a possible implementation manner, the hard disk to be online comprises an SMR area and a CMR area; the check information in the CMR area is primary check information, the check information in the SMR area is backup check information, and the repair device is specifically configured to:

and if the CMR is damaged, applying for a storage address of the cluster information in the SMR area so that the SMR area comprises two storage addresses which are respectively used for storing the main check information and the standby check information.

Based on the same inventive concept, the embodiment of the application provides electronic equipment. Referring to fig. 6, the electronic device includes at least one processor 601 and a memory 602 connected to the at least one processor, in this embodiment, a specific connection medium between the processor 601 and the memory 602 is not limited in this application, in fig. 6, the processor 601 and the memory 602 are connected by a bus 600 as an example, the bus 600 is represented by a thick line in fig. 6, and a connection manner between other components is only schematically illustrated and is not limited. The bus 600 may be divided into an address bus, a data bus, a control bus, etc., and is shown with only one thick line in fig. 6 for ease of illustration, but does not represent only one bus or type of bus.

In the embodiment of the present application, the memory 602 stores instructions executable by the at least one processor 601, and the at least one processor 601 may execute the steps included in the learning supervision method by executing the instructions stored in the memory 602.

The processor 601 is a control center of the electronic device, and may connect various parts of the whole electronic device by using various interfaces and lines, and perform various functions and process data of the electronic device by operating or executing instructions stored in the memory 602 and calling data stored in the memory 602, thereby performing overall monitoring on the electronic device. Alternatively, processor 601 may include one or more processing units, and processor 601 may integrate an application processor, which mainly handles operating systems and application programs, etc., and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 601. In some embodiments, the processor 601 and the memory 602 may be implemented on the same chip, or in some embodiments, they may be implemented separately on separate chips.

The processor 601 may be a general-purpose processor, such as a Central Processing Unit (CPU), digital signal processor, application specific integrated circuit, field programmable gate array or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or the like, that may implement or perform the methods, steps, and logic blocks disclosed in embodiments of the present application. A general purpose processor may be a microprocessor or any conventional processor or the like. The steps of the learning supervision method disclosed in connection with the embodiments of the present application may be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules in the processor.

The memory 602, which is a non-volatile computer-readable storage medium, may be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. The Memory 602 may include at least one type of storage medium, and may include, for example, a flash Memory, a hard disk, a multimedia card, a card-type Memory, a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Programmable Read Only Memory (PROM), a Read Only Memory (ROM), a charge Erasable Programmable Read Only Memory (EEPROM), a magnetic Memory, a magnetic disk, an optical disk, and so on. The memory 602 is any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited to such. The memory 602 in the embodiments of the present application may also be circuitry or any other device capable of performing a storage function for storing program instructions and/or data.

By programming the processor 601, the code corresponding to the vehicle lamp detection method described in the foregoing embodiment may be solidified into the chip, so that the chip can execute the steps of the foregoing learning and monitoring method when running, and how to program the processor 601 is a technique known by those skilled in the art, and will not be described herein again.

Based on the same inventive concept, the present application also provides a computer-readable storage medium, which stores computer instructions, and when the computer instructions are executed on a computer, the computer is caused to execute the steps of the learning supervision method as described above.

In some possible embodiments, the aspects of the vehicle light detection method provided by the present application may also be implemented in the form of a program product, which includes program code for causing an electronic device to perform the steps in the learning supervision method according to various exemplary embodiments of the present application described above in this specification when the program product is run on the electronic device.

As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.

The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.

These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.

These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.

It will be apparent to those skilled in the art that various changes and modifications may be made in the present application without departing from the spirit and scope of the application. Thus, if such modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is intended to include such modifications and variations as well.

20页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:固态硬盘不可纠错数据的处理方法、装置、设备及介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!