Disk failure processing method, device, equipment and storage medium
By monitoring disk failures and distinguishing between media errors and hardware errors, intelligent processing of disk failures in distributed storage systems is achieved, reducing unnecessary disk replacement operations and improving system stability.
Patent Information
- Application Number
- CN202110779937.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-07-09
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2041-07-09
AI Technical Summary
In a distributed storage system, existing technology will lead to unnecessary disk replacement operations when a disk fails, increasing labor and material costs and affecting system stability. It is also unable to distinguish between media errors and hardware errors, leading to unnecessary disk removal.
By monitoring I/O errors in the disk, the cause of the faulty sector is obtained. If it is a media error, isolate the sector and restore the objects stored in it to other sectors to avoid unnecessary disk replacement operations; if it is not If the media is wrong, the disk will be removed.
It reduces unnecessary disk replacement operations, saves manpower and material costs, improves the stability of the distributed storage system, and performs targeted processing according to the cause of the failure.
Smart Images

Figure CN113672415B
Abstract
Description
Technical Field
[0001] The present application relates to the field of storage technology, and in particular to a disk failure processing method, device, equipment and storage medium. Background Art
[0002] With the rapid development of computer technology, big data, cloud computing, and high-performance applications have gradually emerged, and their back-end storage is mostly distributed storage systems. During the operation of a distributed storage system, once a disk fails, a disk kick operation will be triggered to remove the failed disk from the distributed storage system.
[0003] In fact, there are many reasons for disk failure. In many cases, disk failure does not mean that the entire disk cannot be used normally. If a disk is removed from the distributed storage system as soon as it fails, it will increase unnecessary disk replacement operations, with high manpower and material costs, and easily affect the stability of the distributed storage system. Summary of the invention
[0004] The purpose of this application is to provide a disk failure processing method, device, equipment and storage medium to reduce unnecessary disk replacement operations, save manpower and material costs, and improve the stability of distributed storage systems.
[0005] In order to solve the above technical problems, this application provides the following technical solutions:
[0006] A method for handling a disk failure, comprising:
[0007] When an input / output I / O error is detected in reading an object in a target disk, a fault cause of a current faulty sector of the target disk is obtained;
[0008] If the fault cause is a medium error, isolating the current faulty sector;
[0009] The object stored in the current failed sector is restored to other non-isolated sectors of the target disk.
[0010] In a specific implementation manner of the present application, after obtaining the failure cause of the current failed sector of the target disk, the method further includes:
[0011] If the cause of the failure is not a medium error, the target disk is removed from the distributed storage system.
[0012] In a specific implementation manner of the present application, after the target disk is removed from the distributed storage system, the method further includes:
[0013] Output fault warning information for the target disk.
[0014] In a specific implementation manner of the present application, when the fault cause is a medium error, before isolating the current faulty sector, the method further includes:
[0015] Determine whether the number of medium error failures of the sectors of the target disk within a set time period reaches a set number threshold;
[0016] If the number threshold is not reached, the step of isolating the current faulty sector is performed.
[0017] In a specific implementation of the present application, it also includes:
[0018] If the number of medium error failures of the sectors of the target disk within the set time period reaches the number threshold, the target disk is removed from the distributed storage system.
[0019] In a specific implementation manner of the present application, the obtaining the failure cause of the current failed sector of the target disk includes:
[0020] The failure cause of the current failure sector of the target disk is obtained through the small computer system interface SCSI general device file name sg.
[0021] In a specific implementation of the present application, it also includes:
[0022] When a sector isolation information query instruction is received, relevant information of the current isolation sector in the distributed storage system is output, and the relevant information includes the time when the medium error occurs and the logical block address number.
[0023] A disk failure processing device, comprising:
[0024] A fault cause acquisition module is used to acquire the fault cause of the current faulty sector of the target disk when an input / output I / O error is detected in reading an object in the target disk;
[0025] An isolation processing module, configured to isolate the current faulty sector if the fault cause is a medium error;
[0026] The object recovery module is used to recover the object stored in the current faulty sector to other non-isolated sectors of the target disk.
[0027] A disk failure processing device, comprising:
[0028] Memory for storing computer programs;
[0029] A processor is used to implement the steps of any of the above-mentioned disk failure processing methods when executing the computer program.
[0030] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of any one of the above-mentioned disk failure processing methods are implemented.
[0031] By applying the technical solution provided in the embodiment of the present application, when an I / O error is detected in reading an object in the target disk, the fault cause of the current faulty sector of the target disk is obtained. If the fault cause is a medium error, the current faulty sector is isolated and the object stored in the current faulty sector is restored to other non-isolated sectors of the target disk. In the event of a medium error, only the current faulty sector is isolated and the object stored in the current faulty sector is restored to other non-isolated sectors, so that other non-isolated sectors can still respond to object read requests normally, thus reducing unnecessary disk replacement operations, saving manpower and material costs, and improving the stability of the distributed storage system. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0033] Figure 1 This is a flowchart of a method for handling disk failure in an embodiment of the present application;
[0034] Figure 2 This is a structural schematic diagram of a disk failure processing device in an embodiment of the present application;
[0035] Figure 3 This is a structural diagram of a disk failure processing device in an embodiment of the present application. DETAILED DESCRIPTION
[0036] The core of this application is to provide a disk failure handling method that can be applied to storage engines such as Bluestore. Bluestore is a storage engine built on a bare disk device. It no longer uses the system's file system, such as XFS (a high-performance log file system), but directly manages the bare disk. Objects stored in the disk of the distributed storage system can be directly accessed through the storage engine.
[0037] When the storage engine detects an input / output (I / O) error when reading an object on the target disk, it can obtain the cause of the failure of the current faulty sector of the target disk. If the cause of the failure is a medium error, the current faulty sector can be isolated and the object stored in the current faulty sector can be restored to other non-isolated sectors of the target disk. This can reduce unnecessary disk replacement operations, save manpower and material costs, and improve the stability of the distributed storage system.
[0038] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.
[0039] See also Figure 1 FIG. 1 is a flowchart of a method for handling a disk failure provided by an embodiment of the present application. The method may include the following steps:
[0040] S110: When an I / O error is detected in reading an object in the target disk, a failure cause of a current failure sector of the target disk is obtained.
[0041] The storage engine can directly manage the disks of the distributed storage system. If the client has an object read request, the storage engine will read the corresponding object from the disk and return the read object to the client.
[0042] The storage engine can monitor errors that occur when reading objects. When an I / O error (EIO) is detected when reading objects in the target disk, the cause of the failure of the current failed sector of the target disk can be obtained.
[0043] Specifically, the storage engine can obtain the cause of the current faulty sector of the target disk through sg. When the storage engine is started, it can maintain a relationship between the disk and sg (SCSI (Small Computer System Interface) general device file name). When an I / O error is detected when reading an object in the target disk, the sg corresponding to the target disk can be read through the sg I / O control interface, and the current faulty sector of the target disk can be determined through sg. At the same time, the sg I / O control interface can pass sense information (sense info) to the user state, based on which the accurate cause of the fault can be queried.
[0044] There may be many reasons for disk sector failure, such as Hardware error, Medium error, Not Ready, unplug the disk, did_bad_target, did_no_connect, did_soft_error, command timeout, etc. Hardware error means hardware error, and Medium error means medium error.
[0045] S120: If the fault is caused by a medium error, the current faulty sector is isolated.
[0046] For disk sectors, medium error is a relatively common non-fatal error. It may be a medium abnormality or a failure caused by jitter. If one or a few sectors have medium errors, if the corresponding sectors are isolated, it will avoid affecting the operation of other sectors of the disk.
[0047] Therefore, after obtaining the fault cause of the current faulty sector of the target disk, it can be determined whether to isolate the current faulty sector according to the fault cause. If the fault cause is a medium error, the current faulty sector can be isolated, such as by marking it as unavailable to isolate the current faulty sector from the distributed storage system and no longer use it. This can avoid the need to replace the disk, and after isolating the current faulty sector, other non-isolated sectors of the target disk can still work normally.
[0048] S130: Recover the object stored in the current failed sector to other non-isolated sectors of the target disk.
[0049] After isolating the current faulty sector, the object stored in the current faulty sector can be restored to other non-isolated sectors of the target disk. For example, a silent data recovery operation can be triggered. In this way, the object stored in the target disk is still complete and can respond to object read requests normally, avoiding affecting upper-layer business.
[0050] By using the method provided in the embodiment of the present application, when an I / O error is detected in reading an object in the target disk, the fault cause of the current faulty sector of the target disk is obtained. If the fault cause is a medium error, the current faulty sector is isolated and the object stored in the current faulty sector is restored to other non-isolated sectors of the target disk. In the event of a medium error, only the current faulty sector is isolated and the object stored in the current faulty sector is restored to other non-isolated sectors, so that other non-isolated sectors can still respond to object read requests normally, thus reducing unnecessary disk replacement operations, saving manpower and material costs, and improving the stability of the distributed storage system.
[0051] In one embodiment of the present application, after obtaining the failure cause of the current failed sector of the target disk, the method may further include the following steps:
[0052] If the cause of the failure is not a medium error, the target disk is removed from the distributed storage system.
[0053] In the embodiment of the present application, when an I / O error is detected when reading an object in the target disk, after obtaining the cause of the failure of the current faulty sector of the target disk, a processing scheme can be further determined according to the cause of the failure. If the cause of the failure is not a medium error, such as a hardware error, or other errors, it can be considered that the target disk is no longer working properly, and the target disk can be removed from the distributed storage system to avoid the error of the target disk affecting the overall operation of the distributed storage system, and the user can perform a disk replacement operation according to the actual situation.
[0054] In one embodiment of the present application, after the target disk is removed in the distributed storage system, the method may further include the following steps:
[0055] Outputs fault warning information for the target disk.
[0056] After the target disk is removed from the distributed storage system, fault alarm information for the target disk can be output so that the user can be informed of the currently removed target disk in time and replace the faulty disk in time. The fault alarm information can be output in the form of lights, text messages, emails, human-computer interaction interfaces, etc.
[0057] In one embodiment of the present application, when the fault cause is a medium error, before isolating the current faulty sector, the following steps may be further included:
[0058] Step 1: Determine whether the number of medium error failures of the target disk's sectors within a set time period reaches a set number threshold;
[0059] Step 2: If the number threshold is not reached, the operation of isolating the current faulty sector is executed;
[0060] Step 3: If the number of media error failures of the faulty sector within a set time period reaches a threshold, the target disk is removed from the distributed storage system.
[0061] For ease of description, the above two steps are combined for illustration.
[0062] In an embodiment of the present application, when an I / O error is detected in reading an object in the target disk, after obtaining the cause of the failure of the current faulty sector of the target disk, if the cause of the failure is a media error, it can be determined whether the number of failures of the target disk sectors that have media errors within a set time period has reached a set number threshold. If the number of failures of the target disk sectors that have media errors within a set time period has reached a set number threshold, it can be considered that the probability of the target disk failure is high, and continued use may affect the overall operation of the distributed storage system. In this case, the target disk can be removed from the distributed storage system to ensure the stability of the distributed storage system. If the number of failures of the target disk sectors that have media errors within a set time period has not reached a set number threshold, it can be considered that the target disk sectors that have media errors are not sufficient to affect the normal operation of the target disk. In this case, the current faulty sectors can be isolated.
[0063] Among them, the time period, the number threshold, etc. can be set and adjusted according to the actual situation. For example, if the time period is 24 hours and the number threshold is 6, it is determined whether the target disk sector has experienced 6 media error failures within 24 hours. Alternatively, if the time period is 7*24 hours and the number threshold is 12, it is determined whether the target disk sector has experienced 12 media error failures within 7*24 hours. Alternatively, if the time period is the time from the start of the target disk activation to the current moment, the number threshold is 500, it is determined whether the target disk sector has experienced 500 media error failures from the start of the target disk activation to the current moment.
[0064] Before isolating the current faulty sector, first determine whether the number of media error failures in the target disk's sectors within a set time period has reached a set threshold, so as to determine whether the target disk's sectors frequently experience media error failures. If media error failures do not occur frequently, isolate the current faulty sector to avoid unnecessary disk replacement operations. If media error failures occur frequently, remove the target disk from the distributed storage system to avoid affecting the overall operation of the distributed storage system.
[0065] In one embodiment of the present application, the method may further include the following steps:
[0066] When a sector isolation information query instruction is received, relevant information of the current isolation sector in the distributed storage system is output, and the relevant information includes the time when the medium error occurs and the logical block address number.
[0067] In an embodiment of the present application, when a user has a need to query sector isolation information, the user can send a corresponding sector isolation information query instruction to the storage engine through the client. When the storage engine receives the sector isolation information query instruction, it can output relevant information of the current isolated sector in the distributed storage system. The relevant information may include the time when the media error occurred and the logical block address number, so as to facilitate the user to perform analysis, repair, adjustment and other operations based on the relevant information of the current isolated sector.
[0068] Corresponding to the above method embodiment, the embodiment of the present application further provides a disk fault processing device, and the disk fault processing device described below and the disk fault processing device method described above can be referenced to each other.
[0069] See also Figure 2 As shown, the device may include the following modules:
[0070] The failure cause acquisition module 210 is used to acquire the failure cause of the current failed sector of the target disk when an input / output I / O error is detected in reading an object in the target disk;
[0071] The isolation processing module 220 is used to isolate the current faulty sector if the fault cause is a medium error;
[0072] The object recovery module 230 is used to recover the object stored in the current failed sector to other non-isolated sectors of the target disk.
[0073] By using the device provided in the embodiment of the present application, when an I / O error is detected in reading an object in the target disk, the cause of the failure of the current faulty sector of the target disk is obtained. If the cause of the failure is a medium error, the current faulty sector is isolated and the object stored in the current faulty sector is restored to other non-isolated sectors of the target disk. In the event of a medium error, only the current faulty sector is isolated and the object stored in the current faulty sector is restored to other non-isolated sectors, so that other non-isolated sectors can still respond to object read requests normally, thus reducing unnecessary disk replacement operations, saving manpower and material costs, and improving the stability of the distributed storage system.
[0074] In a specific implementation of the present application, a disk removal module is also included, which is used to:
[0075] After obtaining the failure cause of the current failed sector of the target disk, if the failure cause is not a medium error, the target disk is removed from the distributed storage system.
[0076] In a specific implementation of the present application, an alarm information output module is also included, which is used to:
[0077] After the target disk is removed from the distributed storage system, fault alarm information for the target disk is output.
[0078] In a specific implementation of the present application, an isolation determination module is also included, which is used to:
[0079] In the case where the cause of the failure is a medium error, before isolating the current faulty sector, determining whether the number of medium error failures of the target disk sector within a set time period reaches a set number threshold;
[0080] If the number threshold is not reached, the isolation processing module 220 is triggered to perform an isolation processing operation on the current faulty sector.
[0081] In a specific implementation of the present application, the isolation determination module is further used to:
[0082] If the number of medium error failures of the target disk's sectors within a set time period reaches a threshold, the disk removal module is triggered to perform an operation of removing the target disk in the distributed storage system.
[0083] In a specific implementation of the present application, the fault cause acquisition module 210 is used to:
[0084] The failure reason of the current failure sector of the target disk is obtained through the small computer system interface SCSI general device file name sg.
[0085] In a specific implementation of the present application, an information output module is also included for:
[0086] When a sector isolation information query instruction is received, relevant information of the current isolation sector in the distributed storage system is output, and the relevant information includes the time when the medium error occurs and the logical block address number.
[0087] Corresponding to the above method embodiment, the embodiment of the present application further provides a disk failure processing device, including:
[0088] Memory for storing computer programs;
[0089] The processor is used to implement the steps of the above disk failure processing method when executing a computer program.
[0090] like Figure 3 , which is a schematic diagram of the structure of a disk fault processing device, the disk fault processing device may include: a processor 10, a memory 11, a communication interface 12 and a communication bus 13. The processor 10, the memory 11 and the communication interface 12 communicate with each other through the communication bus 13.
[0091] In the embodiment of the present application, the processor 10 may be a central processing unit (CPU), an application specific integrated circuit, a digital signal processor, a field programmable gate array or other programmable logic devices, etc.
[0092] The processor 10 may call a program stored in the memory 11. Specifically, the processor 10 may execute operations in the embodiment of the disk failure processing method.
[0093] The memory 11 is used to store one or more programs, which may include program codes, and the program codes include computer operation instructions. In the embodiment of the present application, the memory 11 at least stores programs for implementing the following functions:
[0094] When an input / output I / O error is detected in reading an object in the target disk, a fault cause of a current fault sector of the target disk is obtained;
[0095] If the fault is caused by a medium error, the current faulty sector is isolated;
[0096] Recover objects stored in the current failed sectors to other non-quarantined sectors of the target disk.
[0097] In one possible implementation, the memory 11 may include a program storage area and a data storage area, wherein the program storage area can store an operating system and application programs required for at least one function (such as information acquisition function, object recovery function), etc.; the data storage area can store data created during use, such as sector storage object data, fault cause data, etc.
[0098] In addition, the memory 11 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device or other volatile solid-state storage device.
[0099] The communication interface 12 may be an interface of a communication module, and is used to connect to other devices or systems.
[0100] Of course, it should be noted that Figure 3 The structure shown does not constitute a limitation on the disk fault processing device in the embodiment of the present application. In actual applications, the disk fault processing device may include Figure 3 More or fewer components than shown, or combinations of certain components.
[0101] Corresponding to the above method embodiment, the embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above disk failure handling method are implemented.
[0102] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0103] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0104] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0105] Specific examples are used herein to illustrate the principles and implementation methods of the present application, and the description of the above embodiments is only used to help understand the technical solution and core ideas of the present application. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of the present application.
Claims
1. A disk failure processing method, characterized in that: include: When an input / output I / O error is detected in reading an object in a target disk, a fault cause of a current faulty sector of the target disk is obtained; If the fault cause is a medium error, isolating the current faulty sector; Restoring the object stored in the current failed sector to other non-isolated sectors of the target disk; The disk failure processing method further includes: When receiving a sector isolation information query instruction, output relevant information of the current isolation sector in the distributed storage system, the relevant information including the time when the medium error occurred and the logical block address number; The obtaining of the failure cause of the current failed sector of the target disk includes: Obtain the failure cause of the current failure sector of the target disk through the small computer system interface SCSI general device file name sg; In the case where the fault cause is a medium error, before isolating the current faulty sector, the method further includes: Determine whether the number of medium error failures of the sectors of the target disk within a set time period reaches a set number threshold; If the number threshold is not reached, executing the step of isolating the current faulty sector; If the number of media error failures of the faulty sector within a set time period reaches a threshold, the target disk is removed from the distributed storage system.
2. The disk failure processing method according to claim 1, characterized in that: After obtaining the failure cause of the current failure sector of the target disk, the method further includes: If the cause of the failure is not a medium error, the target disk is removed from the distributed storage system.
3. The disk failure processing method according to claim 2, characterized in that: After the target disk is removed from the distributed storage system, the method further includes: Output fault warning information for the target disk.
4. A disk failure processing device, characterized in that: include: A fault cause acquisition module is used to acquire the fault cause of the current faulty sector of the target disk when an input / output I / O error is detected in reading an object in the target disk; An isolation processing module, configured to isolate the current faulty sector if the fault cause is a medium error; An object recovery module, used for recovering the object stored in the current faulty sector to other non-isolated sectors of the target disk; Wherein, the device is also used for: When receiving a sector isolation information query instruction, output relevant information of the current isolation sector in the distributed storage system, the relevant information including the time when the medium error occurred and the logical block address number; obtain the fault cause of the current fault sector of the target disk through the small computer system interface SCSI general device file name sg; determine whether the number of medium error failures of the sector of the target disk within a set time period reaches a set number threshold; if the number threshold is not reached, execute the step of isolating the current fault sector; If the number of media error failures of the faulty sector within a set time period reaches a threshold, the target disk is removed from the distributed storage system.
5. A disk failure processing device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the disk failure processing method as described in any one of claims 1 to 3 when executing the computer program.
6. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the disk failure processing method according to any one of claims 1 to 3 are implemented.
