Hard disk processing method and related system, electronic device and storage medium
Through the hard disk processing method combined with the user layer and the kernel layer, hard disk exceptions are detected and processed, the problem of low exception handling efficiency in read and write operations of the hard disk is solved, and the performance of hard disk business is improved.
Patent Information
- Application Number
- CN202411402397.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-09
- Publication Date
- 2025-01-03
- Estimated Expiration
- 2044-10-09
AI Technical Summary
In the prior art, when an abnormality occurs in a hard disk during a read and write operation, it is difficult to effectively handle it, resulting in poor performance of the storage server and lack of efficient abnormality detection and processing methods.
The target hard disk is launched on the user layer, triggering read/write operations, and detecting metadata and read/write operations in the kernel layer, obtaining exception details, and processing the hard disk based on this information to improve the accuracy and processing efficiency of abnormal detection.
By quickly and accurately judging hard disk abnormalities, the probability of problems caused by abnormalities in the business is reduced, and the performance of hard disk business is improved. It is suitable for handling various types of exceptions.
Smart Images

Figure CN118916242B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of cloud storage technology, and in particular to a hard disk processing method and related systems, electronic equipment and storage media. Background Art
[0002] During the use of the hard disk in the storage system, due to problems such as magnetic degradation, bad sectors or vibration of the hard disk, the hard disk may cause abnormalities in the read and write operations, affecting the normal operation of the storage service.
[0003] In the prior art, it usually relies on the error information returned by the hard disk IO request, that is, only after the hard disk IO error occurs can the subsequent operation and processing of the hard disk with IO error be performed, and for hard disks of other abnormal types, effective processing cannot be made, thus resulting in poor performance of the storage server. In view of this, how to improve the accuracy of hard disk anomaly detection and improve the performance of hard disk services has become an urgent problem to be solved. Summary of the invention
[0004] The main technical problem solved by the present application is to provide a hard disk processing method and related systems, electronic devices and storage media, which can improve the performance of hard disk services by improving the accuracy of hard disk anomaly detection.
[0005] In order to solve the above technical problems, the first aspect of the present application provides a hard disk processing method, including triggering the target hard disk to perform read / write operations based on the target hard disk online at the user layer; detecting the metadata of the target hard disk and the execution status of the read / write operation in the kernel layer; in response to at least one of the first detection result of the metadata and the second detection result of the read / write operation representing an abnormality, obtaining the abnormality details information about the target hard disk in the kernel layer; and processing the target hard disk based on the abnormality details information.
[0006] In order to solve the above technical problems, the second aspect of the present application provides an electronic device, including a memory and a processor coupled to each other, the memory storing program instructions, and the processor being used to execute the program instructions to implement the hard disk processing method described in the first aspect above.
[0007] In order to solve the above technical problems, the third aspect of the present application provides a hard disk processing system, including a storage server and a hard disk processor that are communicatively connected, the storage server stores a number of target hard disks to perform read / write operations on the target hard disks, and the hard disk processor is the electronic device described in the second aspect above.
[0008] In order to solve the above technical problem, the fourth aspect of the present application provides a computer-readable storage medium, which stores program instructions that can be executed by a processor, and the program instructions are used to implement the hard disk processing method described in the first aspect above.
[0009] The above scheme triggers the target hard disk to perform read / write operations based on the target hard disk that is online at the user layer, detects the metadata of the target hard disk and the execution status of the read / write operation in the kernel layer, and when at least one of the first detection result of the metadata and the second detection result of the read / write operation indicates an abnormality, obtains the abnormality details information about the target hard disk in the kernel layer, and processes the target hard disk based on the abnormality details information. On the one hand, based on the first detection result and the second detection result obtained in the kernel layer, it is possible to quickly and accurately determine whether the target hard disk has an abnormality as much as possible, and the second detection result is obtained based on the execution status of the read / write operation of the target hard disk in the kernel layer, so the second detection result can detect multiple abnormal types of the target hard disk during the execution process. On the other hand, processing the target hard disk based on the abnormality details information can reduce the probability of business problems caused by abnormal hard disks as much as possible, and effectively process target hard disks of different abnormal types. Therefore, the performance of hard disk business can be improved by improving the accuracy of hard disk abnormality detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] Figure 1 It is a flowchart of an embodiment of the hard disk processing method of the present application;
[0011] Figure 2 It is a flowchart of another embodiment of the hard disk processing method of the present application;
[0012] Figure 3 It is a schematic diagram of the framework of an embodiment of a hard disk processing device of the present application;
[0013] Figure 4 It is a schematic diagram of the framework of an embodiment of the electronic device of the present application;
[0014] Figure 5 It is a schematic diagram of the framework of an embodiment of the hard disk processing system of the present application;
[0015] Figure 6 It is a schematic diagram of a framework of an embodiment of a computer-readable storage medium of the present application. DETAILED DESCRIPTION
[0016] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0017] The terms "system" and "network" are often used interchangeably in this article. The term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship. In addition, "many" in this article means two or more than two.
[0018] See also Figure 1 , Figure 1 This is a flowchart of an embodiment of the hard disk processing method of the present application. Specifically, it may include the following steps:
[0019] Step S10: based on the target hard disk that is online at the user layer, trigger the target hard disk to perform a read / write operation.
[0020] In the embodiments of the present disclosure, read / write operations are two basic modes of data transmission, involving data exchange between a processor and an I / O port. A read operation is a process in which the processor obtains data from an I / O port and performs a bus operation. In contrast, a write operation is a process in which the processor writes data to an I / O port, that is, saves the data in a hard disk. In a wider range of applications, read / write operations also include reading current data, modifying the data as needed, and then writing the modified data back to the original location. For details, please refer to the technical details of the read / write operation, which will not be repeated here.
[0021] It should be noted that the read / write operations described in this application include read operations and / or write operations, and the specific operation types are not limited in this application.
[0022] In one implementation scenario, the storage server stores several candidate hard disks. After the storage server is started, the initialization operation is performed on the candidate hard disks, and the hard disks after the initialization are put online as target hard disks in the kernel layer and the user layer respectively, where the user layer is responsible for interaction with the user, and the kernel layer is responsible for managing the core resources of the system and providing basic operating system services. The target hard disk put online in the user layer can be displayed on the display page, and the user can select the target hard disk and issue a read / write request. The target hard disk put online in the kernel layer can control the target hard disk to perform read / write operations based on the received read / write request.
[0023] In a specific implementation scenario, when the storage server starts to start, several candidate hard disks stored in the storage server are triggered to read data of preset sizes, for example, the preset sizes are 1MB, 512KB, etc., and a verification result indicating whether the data reading of the candidate hard disk is successful is obtained. It should be noted that the storage location of the read data in the candidate hard disk is not limited in this application, and the preset size is not limited in this application.
[0024] In a specific implementation scenario, the reading operation can adopt a small block cyclic reading method. Specifically, the preset size is set to 1MB, and 4KB of data is read from the candidate hard disk each time until 1MB is read. During the data reading process, if the reading fails when reading 4KB of data at a time, the data reading is stopped, and a verification result representing the failure of the candidate hard disk data reading is obtained. The above scheme can avoid the kernel from being stuck when reading data when an abnormality is found in the candidate hard disk.
[0025] In a specific implementation scenario, after obtaining the verification result, the initialization operation of the candidate hard disk is performed based on the verification result. The verification result includes the candidate hard disk data reading success and the candidate hard disk data reading failure. The candidate hard disk that successfully performs the initialization operation is selected as the target hard disk, and the target hard disk is brought online to the kernel layer and the user layer. The above scheme can minimize the probability of the kernel layer being stuck due to jamming during the initialization of the candidate hard disk, so it can improve the performance of the hard disk service.
[0026] In a specific implementation scenario, when the verification result indicates that the data of the candidate hard disk is read successfully, an initialization operation is performed on the candidate hard disk.
[0027] In another specific implementation scenario, when the verification result indicates that the data reading of the candidate hard disk fails, if the initialization operation of the candidate hard disk is performed during the startup of the storage server, the initialization of the candidate hard disk may fail or be stuck due to the abnormality of the candidate hard disk, which may further cause the failure of the storage server to start. Therefore, when the verification result indicates that the data reading fails, the initialization operation of the candidate hard disk is suspended, and after the storage server is started, the initialization operation of the candidate hard disk is restarted.
[0028] It is understandable that in order to ensure the startup success rate of the storage server as much as possible, the data reading operation of each candidate hard disk can be performed first, and after the data reading operation of all candidate hard disks is completed, the initialization operation is performed on the candidate hard disks that have successfully performed the data reading. Of course, considering that the network environment, hardware resources, etc. are relatively abundant, the data volume of the data reading operation of the candidate hard disk is much smaller than the data volume of the initialization operation, so the data reading operation of the candidate hard disk and the initialization operation of the candidate hard disk can usually be performed at the same time, so it is also possible not to perform the data reading operation and the initialization operation of the candidate hard disk separately. The above examples are only a few typical examples in actual application, and do not limit the operation execution sequence.
[0029] In a specific implementation scenario, a candidate hard disk on which the initialization operation is successfully executed is selected as the target hard disk, and after the target hard disk is brought online to the kernel layer and the user layer, a preset hard disk blacklist is obtained, in which the serial numbers of several bad disks are stored. Based on the serial number of the target hard disk, it is detected whether there is a serial number consistent with the serial number of the target hard disk in the preset hard disk blacklist. When the detection result indicates that there is a serial number consistent with the target hard disk in the preset blacklist, the target hard disk in the kernel layer is taken offline, that is, the read / write operation of the target hard disk is stopped, and the read / write function of the target hard disk in the user layer is stopped, that is, the target hard disk is displayed in the interactive interface of the interactive layer, but cannot provide the user with corresponding read / write request reception. It can be understood that, as the aforementioned read / write operation, the read / write function includes a read function and / or a write function.
[0030] It should be noted that the serial number is only one possible implementation method for characterizing the hard disk identification and is not specifically limited in this application.
[0031] In a specific implementation scenario, the preset hard disk blacklist is updated by the maintenance personnel of the storage server, and / or the candidate hard disks that fail to complete initialization successfully after each cloud storage server startup are added to the preset hard disk blacklist to improve the performance of the hard disk service.
[0032] In one implementation scenario, after the target hard disk is online at the user layer and the kernel layer, and before the user layer is open to user interaction, the target hard disk is triggered to perform a read / write operation based on a test request, and the request type of the test request is consistent with the request type of the read / write request issued in the user interaction. The above solution detects whether the target hard disk has an abnormality based on a test request before the user layer is open to user interaction, which can reduce the risk of abnormalities in the storage server during the application process as much as possible, and thus can improve the performance of the hard disk service.
[0033] In a specific implementation scenario, after the user layer opens user interaction, the read / write request based on the user layer can be used as a test request to trigger the target hard disk to perform read / write operations. It can be understood that triggering the target hard disk to perform read / write operations based on the test request and detecting the execution status is relatively independent of executing the read / write operations expected by the user based on the read / write request. Under the condition of sufficient network resources, the two can be performed simultaneously.
[0034] In one implementation scenario, when a new candidate hard disk is added during the operation of the storage server, for example, when a hard disk is hot-plugged, an initialization operation and a subsequent trigger detection operation are performed on the new hard disk.
[0035] Step S20: Detecting metadata of the target hard disk and execution status of the read / write operation in the kernel layer.
[0036] In one implementation scenario, the metadata of the target hard disk is detected in the kernel layer. The metadata of the target hard disk is data indicating the original data storage structure, which is used to provide pointers and descriptors, through which the sectors on the hard disk are linked into files and distinguished. It can be understood that an abnormality in the metadata of the target hard disk will cause the collapse of the target hard disk, that is, the bad disk. And the execution status of the read / write operation of the target hard disk is detected in the kernel layer. It should be noted that the detection order of the metadata and the execution status of the read / write operation is not limited in this application. For example, the detection of the metadata is performed simultaneously with the detection of the execution status of the read / write operation, or the detection of the metadata of the target hard disk is performed first and then the detection of the execution status of the read / write operation, etc.
[0037] In a specific implementation scenario, after a read / write request is generated to trigger the target hard disk to perform a read / write operation, the user layer sends the read / write request to the kernel block (basic unit) layer. The block layer encapsulates and aggregates the read / write request and puts it into the request queue for management. Finally, the read / write request is sent to the underlying IO stack for processing by the target hard disk. Regardless of whether the processing succeeds or fails, the underlying IO stack eventually calls the req_bio_endio() function for the request that has been processed. For details, please refer to the technical details of the cloud storage system. For the sake of brevity, it will not be repeated here. The above scheme detects the function called after the request is completed in the underlying IO stack, that is, obtains the second detection result of the execution of the read / write operation of the target hard disk in the kernel layer, and can determine whether the target hard disk has an abnormality as quickly and accurately as possible, so it can improve the performance of the hard disk service by improving the accuracy of hard disk abnormality detection.
[0038] In a specific implementation scenario, SMART (Self-Monitoring, Analysis, and Reporting Technology) can be used to detect the target hard disk metadata. SMART is a hard disk self-monitoring, analysis and reporting technology that allows the hard disk to record several of its own parameters during operation, including model, capacity, temperature, density, sectors, seek time, transmission speed and bit error rate, etc. For details, please refer to the technical details of SMART. For the sake of brevity, it will not be repeated here.
[0039] It should be noted that the method of detecting the metadata of the target hard disk and the execution status of the read / write operation in the kernel layer is not limited in this application, and the above embodiment is only a possible implementation method.
[0040] Step S30: in response to at least one of the first detection result of the metadata and the second detection result of the read / write operation indicating an abnormality, obtaining abnormality detail information about the target hard disk in the kernel layer.
[0041] In one implementation scenario, when the first detection result of the metadata and the second detection result of the read / write operation both indicate that they are normal, it indicates that the target hard disk can be used normally.
[0042] In one implementation scenario, when at least one of the first detection result of metadata and the second detection result of read / write operation indicates an abnormality, the target hard disk is indicated to be a slow disk or a bad disk, that is, an abnormality exists, and the abnormality details information about the target hard disk is obtained in the kernel layer. In the above scheme, the first detection result and the second detection result are obtained in the kernel layer, and it is possible to determine whether the target hard disk has an abnormality as quickly and accurately as possible. The abnormality details information about the target hard disk obtained in the kernel layer can more accurately determine the abnormality, so the performance of the hard disk service can be improved by improving the accuracy of hard disk abnormality detection.
[0043] In a specific implementation scenario, the request time for the target hard disk to perform a read / write operation is obtained, and the request return time for the target hard disk to perform a read / write operation in the kernel layer is obtained, and the time difference between the completion time and the request time is obtained. Based on the time difference and the time threshold, the abnormal type of the abnormal details of the target hard disk is determined. For example, the time threshold includes an IO slow threshold and an IO blocking threshold, the IO slow threshold is 5 seconds, and the IO blocking threshold is 30 seconds. If the request return time is between 5 seconds and 30 seconds, it is considered that the target hard disk input and output are slow. If the request return time has not returned when 30 seconds are reached, it is considered that the target hard disk input and output are blocked.
[0044] In a specific implementation scenario, when it is detected that the read / write operation of the target hard disk fails, an execution failure mark is sent, and when it is detected that the read / write operation of the target hard disk is successfully executed, an execution success mark is sent. Before obtaining the request return time of the target hard disk executing the read / write operation in the kernel layer, it is determined whether the target hard disk successfully executes the read / write operation based on the received mark. When the execution failure mark is detected, it is considered that the input and output of the target hard disk are wrong. When the execution success mark is detected, the abnormal type of the abnormal details of the target hard disk is determined based on the request time of the target hard disk executing the read / write operation and the request return time of the target hard disk executing the read / write operation in the kernel layer.
[0045] It should be noted that the specific content of the exception details information is not limited in this application, such as request time difference, exception type, number of exceptions, etc., and the method for obtaining the exception details information is not limited in this application, such as data integration, etc.
[0046] Step S40: Process the target hard disk based on the abnormality details information.
[0047] In one implementation scenario, the target hard disk is processed based on the abnormality details information. On the one hand, based on the first detection result and the second detection result obtained in the kernel layer, it is possible to quickly and accurately determine whether the target hard disk has an abnormality. On the other hand, processing the target hard disk based on the abnormality details information can reduce the probability of business problems caused by the abnormal hard disk as much as possible. Therefore, the performance of the hard disk business can be improved by improving the accuracy of hard disk abnormality detection.
[0048] In one implementation scenario, based on the exception details information, the target exception type of the target hard disk and the first occurrence number of the target exception type are determined, and a preset reset condition that matches the target exception type is selected as the target reset condition. When the first occurrence number of the target exception type meets the target reset condition, the target hard disk is reset. The probability of business problems caused by abnormal hard disks can be reduced as much as possible. Therefore, the performance of hard disk business can be improved by improving the accuracy of hard disk anomaly detection.
[0049] In a specific implementation scenario, when the target exception type includes slow input and output, the preset reset condition determined as the target reset condition is: the number of hard disks online in the kernel layer is not less than the preset number, and the first number of slow input and output of the target hard disk within the preset time period is not less than the preset number.
[0050] In a specific implementation scenario, when the target abnormality type includes input / output blocking, the preset reset condition determined as the target reset condition is: the first number of input / output blocking occurrences of the target hard disk is not zero.
[0051] In a specific implementation scenario, when the target abnormality type includes an input / output error, the preset reset condition determined as the target reset condition is: the first number of input / output errors occurring in the target hard disk is not less than a preset number of times.
[0052] In a specific implementation scenario, the target abnormality type of the target hard disk includes multiple types, such as slow input and output and blocked input and output, etc., which are not limited here.
[0053] In a specific implementation scenario, after performing a reset operation on the target hard disk, a second number of times the target hard disk performs the reset operation is obtained, and when the second number is not less than a number threshold, the read / write function of the target hard disk in the user layer is stopped, and the target hard disk is offline in the kernel layer. It should be noted that the size of the number threshold is not limited in this application.
[0054] In a specific implementation scenario, when it is detected that at least one of the first detection results and / or the second detection results of the target hard disk represents an abnormality for a preset number of consecutive times, the preset hard disk blacklist is updated based on the target hard disk. For example, the preset number of times is set to 4. After the storage server is restarted 4 times in a row, the first detection result and / or the second detection result representing an abnormality of the target hard disk is detected after each startup. Then the serial number of this target hard disk is added to the preset hard disk blacklist. Alternatively, the abnormality details of the target hard disk are continuously detected during the operation of the storage server. The preset number of times can be set based on the target reset condition. For example, the target reset condition is in response to the target abnormality type including slow input and output. The preset reset condition determined as the target reset condition is: the number of hard disks online in the kernel layer is not less than the preset number, and the first number of slow input and output of the target hard disk within the preset time period is not less than the preset number. The preset number of times is 5 times. Then the preset number of times can be set to a value greater than the preset number, for example 10 times, which is not limited here.
[0055] In a specific implementation scenario, after the target hard disk is online at the user layer and the kernel layer and user interaction is opened at the user layer, a detection cycle can be set to periodically execute the steps and subsequent steps that trigger the target hard disk to perform read / write operations. If an abnormality occurs during operation, the target hard disk will also be reset or offline during business to prevent the target hard disk in use from malfunctioning and causing business abnormalities.
[0056] The above scheme triggers the target hard disk to perform read / write operations based on the target hard disk that is online at the user layer, detects the metadata of the target hard disk and the execution status of the read / write operation in the kernel layer, and when at least one of the first detection result of the metadata and the second detection result of the read / write operation indicates an abnormality, obtains the abnormality details information about the target hard disk in the kernel layer, and processes the target hard disk based on the abnormality details information. On the one hand, based on the first detection result and the second detection result obtained in the kernel layer, it is possible to quickly and accurately determine whether the target hard disk has an abnormality as much as possible, and the second detection result is obtained based on the execution status of the read / write operation of the target hard disk in the kernel layer, so the second detection result can detect multiple abnormal types of the target hard disk during the execution process. On the other hand, processing the target hard disk based on the abnormality details information can reduce the probability of business problems caused by abnormal hard disks as much as possible, and effectively process target hard disks of different abnormal types. Therefore, the performance of hard disk business can be improved by improving the accuracy of hard disk abnormality detection.
[0057] See also Figure 2 , Figure 2 This is a flow chart of another embodiment of the hard disk processing method of the present application. Specifically, it may include the following steps:
[0058] Step S11: Select a candidate hard disk on which the initialization operation is successfully performed as a target hard disk, and bring the target hard disk online to the kernel layer and the user layer.
[0059] For details, please refer to the aforementioned embodiments, which will not be described again here for the sake of brevity.
[0060] Step S21: Determine whether the serial number of the target hard disk exists in the preset hard disk blacklist.
[0061] For details, please refer to the aforementioned embodiments, which will not be described again here for the sake of brevity.
[0062] Step S22: In response to the existence of a serial number consistent with the target hard disk in the preset hard disk blacklist, an offline operation is performed on the target hard disk in the kernel layer, and the read / write function of the target hard disk in the user layer is stopped.
[0063] For details, please refer to the aforementioned embodiments, which will not be described again here for the sake of brevity.
[0064] Step S10: In response to the fact that the preset hard disk blacklist does not contain a serial number consistent with the target hard disk, based on the target hard disk online at the user layer, triggering the target hard disk to perform a read / write operation.
[0065] For details, please refer to the aforementioned embodiments, which will not be described again here for the sake of brevity.
[0066] Step S20: Detecting metadata of the target hard disk and execution status of the read / write operation in the kernel layer.
[0067] For details, please refer to the aforementioned embodiments, which will not be described again here for the sake of brevity.
[0068] Step S30: in response to at least one of the first detection result of the metadata and the second detection result of the read / write operation indicating an abnormality, obtaining abnormality detail information about the target hard disk in the kernel layer.
[0069] For details, please refer to the aforementioned embodiments, which will not be described again here for the sake of brevity.
[0070] Step S31: in response to the first detection result of the metadata and the second detection result of the read / write operation indicating normality, the target hard disk is opened in the interactive service of the user layer.
[0071] For details, please refer to the aforementioned embodiments, which will not be described again here for the sake of brevity.
[0072] Step S40: Process the target hard disk based on the abnormality details information.
[0073] For details, please refer to the aforementioned embodiments, which will not be described again here for the sake of brevity.
[0074] The above scheme triggers the target hard disk to perform read / write operations based on the target hard disk that is online at the user layer, detects the metadata of the target hard disk and the execution status of the read / write operation in the kernel layer, and when at least one of the first detection result of the metadata and the second detection result of the read / write operation indicates an abnormality, obtains the abnormality details information about the target hard disk in the kernel layer, and processes the target hard disk based on the abnormality details information. On the one hand, based on the first detection result and the second detection result obtained in the kernel layer, it is possible to quickly and accurately determine whether the target hard disk has an abnormality as much as possible, and the second detection result is obtained based on the execution status of the read / write operation of the target hard disk in the kernel layer, so the second detection result can detect multiple abnormal types of the target hard disk during the execution process. On the other hand, processing the target hard disk based on the abnormality details information can reduce the probability of business problems caused by abnormal hard disks as much as possible, and effectively process target hard disks of different abnormal types. Therefore, the performance of hard disk business can be improved by improving the accuracy of hard disk abnormality detection.
[0075] See also Figure 3 , Figure 3 Schematic diagram of the framework of an embodiment of the hard disk processing device 30 of the present application. Figure 3 As shown, the hard disk processing device 30 includes a trigger module 31, a detection module 32, an acquisition module 33 and a processing module 34. The trigger module 31 is used to trigger the target hard disk to perform a read / write operation based on the target hard disk online at the user layer. The detection module 32 is used to detect the metadata of the target hard disk and the execution status of the read / write operation in the kernel layer. The acquisition module 33 is used to obtain the abnormality details information about the target hard disk in the kernel layer in response to at least one of the first detection result of the metadata and the second detection result of the read / write operation to characterize the abnormality. The processing module 34 is used to process the target hard disk based on the abnormality details information.
[0076] Therefore, the hard disk processing device 30 triggers the target hard disk to perform a read / write operation based on the target hard disk that is online in the user layer, detects the metadata of the target hard disk and the execution status of the read / write operation in the kernel layer, and when at least one of the first detection result of the metadata and the second detection result of the read / write operation represents an abnormality, obtains the abnormality details information about the target hard disk in the kernel layer, and processes the target hard disk based on the abnormality details information. On the one hand, based on the first detection result and the second detection result obtained in the kernel layer, it is possible to quickly and accurately determine whether the target hard disk has an abnormality as much as possible, and the second detection result is obtained based on the execution status of the read / write operation of the target hard disk in the kernel layer, so the second detection result can detect multiple abnormal types of the target hard disk during the execution process. On the other hand, processing the target hard disk based on the abnormality details information can reduce the probability of business problems caused by abnormal hard disks as much as possible, and effectively process target hard disks of different abnormal types. Therefore, the performance of hard disk business can be improved by improving the accuracy of hard disk abnormality detection.
[0077] In some disclosed embodiments, the acquisition module 33 also includes an information determination module (not shown) for determining a target exception type of the target hard disk and the first occurrence number of the target exception type based on the exception detail information; the acquisition module 33 also includes a condition selection module (not shown) for selecting a preset reset condition that matches the target exception type as the target reset condition; the acquisition module 33 also includes a reset execution module (not shown) for performing a reset operation on the target hard disk in response to the first occurrence number of the target exception type satisfying the target reset condition.
[0078] In some disclosed embodiments, the acquisition module 33 also includes a times acquisition module (not shown), which is used to obtain a second number of times the target hard disk performs a reset operation after the reset operation is performed on the target hard disk; the acquisition module 33 also includes a function adjustment module (not shown), which is used to stop the read / write function of the target hard disk in the user layer and take the target hard disk offline in the kernel layer in response to the second number being not less than a times threshold.
[0079] In some disclosed embodiments, the condition selection module (not shown) also includes a slow condition module (not shown), which is used to determine, in response to the target abnormality type including slow input and output, a preset reset condition as a target reset condition: the number of hard disks online in the kernel layer is not less than a preset number, and the first number of slow input and output occurrences of the target hard disk within a preset time period is not less than a preset number; the condition selection module (not shown) also includes a blocking condition module (not shown), which is used to determine, in response to the target abnormality type including input and output blocking, a preset reset condition as a target reset condition: the first number of input and output blocking occurrences of the target hard disk is not zero; the condition selection module (not shown) also includes an error condition module (not shown), which is used to determine, in response to the target abnormality type including input and output errors, a preset reset condition as a target reset condition: the first number of input and output errors occurring to the target hard disk is not less than a preset number.
[0080] In some disclosed embodiments, before triggering the target hard disk to perform a read / write operation based on the target hard disk that is online at the user layer, the hard disk processing device 30 also includes a read verification module (not shown) for triggering the candidate hard disk to read data of a preset size in response to the storage server starting up, and obtaining a verification result representing whether the data reading of the candidate hard disk is successful; wherein the storage server stores a number of candidate hard disks; the hard disk processing device 30 also includes an initialization module (not shown) for performing an initialization operation on the candidate hard disk based on the verification result; the hard disk processing device 30 also includes a target hard disk selection module (not shown) for selecting a candidate hard disk on which the initialization operation is successfully performed as a target hard disk, and bringing the target hard disk online to the kernel layer and the user layer.
[0081] In some disclosed embodiments, the initialization module (not shown) further includes an execution success module (not shown) for executing the initialization operation of the candidate hard disk in response to a verification result indicating that the data of the candidate hard disk has been read successfully; the initialization module (not shown) further includes an execution failure module (not shown) for pausing the initialization operation of the candidate hard disk in response to a verification result indicating that the data of the candidate hard disk has failed to be read, and restarting the initialization operation of the candidate hard disk in response to completion of the startup of the storage server.
[0082] In some disclosed embodiments, after the target hard disk is brought online to the kernel layer and the user layer, and before the target hard disk is triggered to perform a read / write operation based on the target hard disk that is online in the user layer, the hard disk processing device 30 also includes a blacklist acquisition module (not shown) for acquiring a preset hard disk blacklist, and detecting the preset hard disk blacklist based on the serial number of the target hard disk; the hard disk processing device 30 also includes a target hard disk processing module (not shown) for executing an offline operation on the target hard disk in the kernel layer in response to the detection result indicating that there is a serial number consistent with the target hard disk in the preset hard disk blacklist, and stopping the read / write function of the target hard disk in the user layer.
[0083] In some disclosed embodiments, the hard disk processing device 30 also includes an anomaly detection module (not shown) for detecting anomaly detail information of a target hard disk; the hard disk processing device 30 also includes a blacklist update module (not shown) for updating a preset hard disk blacklist based on the target hard disk in response to the anomaly detail information including at least one of the failure of the target hard disk to perform an initialization operation, the target hard disk being abnormal for a preset number of consecutive times by the first detection result, and / or the second detection result representing an abnormality.
[0084] In some disclosed embodiments, the acquisition module 33 also includes a time acquisition module (not shown), which is used to obtain the request time for the target hard disk to perform read / write operations, and to obtain the request return time for the target hard disk to perform read / write operations in the kernel layer; the acquisition module 33 also includes a time difference calculation module (not shown), which is used to obtain the time difference between the completion time and the request time; the acquisition module 33 also includes a type determination module (not shown), which is used to determine the abnormality type of the abnormal details of the target hard disk based on the time difference and the time threshold.
[0085] See also Figure 4 , Figure 4 1 is a schematic diagram of a framework of an embodiment of an electronic device 40 of the present application. Figure 4 As shown, the electronic device 40 includes a memory 41 and a processor 42 coupled to each other, the memory 41 stores program instructions, and the processor 42 is used to execute the program instructions to implement the steps in any of the above hard disk processing method embodiments. Specifically, the electronic device 40 may include but is not limited to: a server, a desktop computer, a laptop computer, a tablet computer, a smart phone, etc., which are not limited here. Specifically, the processor 42 is used to control itself and the memory 41 to implement the steps in any of the above hard disk processing method embodiments. The processor 42 can also be called a CPU (Central Processing Unit). The processor 42 may be an integrated circuit chip with signal processing capabilities. The processor 42 can also be a general-purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), a field-programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. In addition, the processor 42 can be implemented by an integrated circuit chip.
[0086] Therefore, in the electronic device 40, based on the target hard disk that is online in the user layer, the target hard disk is triggered to perform a read / write operation, and the metadata of the target hard disk and the execution status of the read / write operation are detected in the kernel layer. When at least one of the first detection result of the metadata and the second detection result of the read / write operation represents an abnormality, the abnormality details information about the target hard disk in the kernel layer is obtained, and the target hard disk is processed based on the abnormality details information. On the one hand, based on the first detection result and the second detection result obtained in the kernel layer, it is possible to quickly and accurately determine whether the target hard disk has an abnormality as much as possible, and the second detection result is obtained based on the execution status of the read / write operation of the target hard disk in the kernel layer, so the second detection result can detect multiple abnormal types of the target hard disk during the execution process. On the other hand, processing the target hard disk based on the abnormality details information can reduce the probability of business problems caused by the abnormal hard disk as much as possible, and effectively process the target hard disks of different abnormal types. Therefore, the performance of the hard disk business can be improved by improving the accuracy of hard disk abnormality detection.
[0087] See also Figure 5 , Figure 5 Schematic diagram of the framework of an embodiment of a hard disk processing system 50 of the present application. Figure 5 As shown, the hard disk processing system 50 includes a storage server 51 and a hard disk processor 52 that are communicatively connected, the storage server 51 stores a number of target hard disks to perform read / write operations on the target hard disks, and the hard disk processor 52 is the electronic device 40 described in any of the above embodiments.
[0088] Therefore, the hard disk processing system 50 triggers the target hard disk to perform a read / write operation based on the target hard disk that is online at the user layer, detects the metadata of the target hard disk and the execution of the read / write operation in the kernel layer, and when at least one of the first detection result of the metadata and the second detection result of the read / write operation represents an abnormality, obtains the abnormality details information about the target hard disk in the kernel layer, and processes the target hard disk based on the abnormality details information. On the one hand, based on the first detection result and the second detection result obtained in the kernel layer, it is possible to quickly and accurately determine whether the target hard disk has an abnormality as much as possible, and the second detection result is obtained based on the execution of the read / write operation of the target hard disk in the kernel layer, so the second detection result can detect multiple abnormal types of the target hard disk during the execution process, and on the other hand, based on the abnormality details information, the target hard disk is processed, which can reduce the probability of business problems caused by abnormal hard disks as much as possible, and effectively process target hard disks of different abnormal types. Therefore, the performance of hard disk business can be improved by improving the accuracy of hard disk abnormality detection.
[0089] In some implementation scenarios, the storage server 51 includes a kernel layer 511 and a user layer 512, wherein the user layer 512 is responsible for interaction with users, while the kernel layer 511 is responsible for managing the core resources of the system and providing basic operating system services. The target hard disk online in the user layer 512 can be displayed on the display page, and the user can select a target hard disk with a read / write function and issue a read / write request. The target hard disk online in the kernel layer 511 can control the target hard disk to perform a read / write operation based on the received read / write request.
[0090] See also Figure 6 , Figure 6 The schematic diagram is a schematic diagram of an embodiment of a computer-readable storage medium 60 of the present application. The computer-readable storage medium 60 stores program instructions 61 that can be executed by a processor, and the program instructions 61 are used to implement the steps in any of the above hard disk processing method embodiments.
[0091] In some embodiments, the functions or modules included in the device provided by the embodiments of the present disclosure can be used to execute the method described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.
[0092] The above description of various embodiments tends to emphasize the differences between the various embodiments. The same or similar aspects can be referenced to each other, and for the sake of brevity, they will not be repeated herein.
[0093] In the several embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation described above is only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0094] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, and may be located in one place or distributed over multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0095] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0096] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to execute all or part of the steps of each implementation method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.
[0097] If the technical solution of this application involves personal information, the product using the technical solution of this application has clearly informed the personal information processing rules and obtained the individual's voluntary consent before processing the personal information. If the technical solution of this application involves sensitive personal information, the product using the technical solution of this application has obtained the individual's separate consent before processing the sensitive personal information, and at the same time meets the "explicit consent" requirement. For example, on personal information collection devices such as cameras, clear and prominent signs are set to inform that the personal information collection scope has been entered and personal information will be collected. If the individual voluntarily enters the collection scope, it is deemed that he or she agrees to the collection of his or her personal information; or on the device that processes personal information, the personal information processing rules are notified by obvious signs / information, and the individual's authorization is obtained through pop-up information or by asking the individual to upload his or her personal information; among them, the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the type of personal information processed.
Claims
1. A hard disk processing method, characterized in that: include: Based on the target hard disk that is online at the user layer, triggering the target hard disk to perform a read / write operation; Detecting metadata of the target hard disk and execution status of the read / write operation in the kernel layer; In response to at least one of the first detection result of the metadata and the second detection result of the read / write operation indicating an abnormality, obtaining abnormality detail information about the target hard disk in the kernel layer; Based on the exception detail information, determine a target exception type of the target hard disk and a first occurrence number of the target exception type; In response to the target abnormality type including slow input and output, the preset reset condition as the target reset condition is determined as follows: the number of hard disks online in the kernel layer is not less than a preset number, and the first number of slow input and output occurrences of the target hard disk within a preset time period is not less than a preset number; in response to the target abnormality type including input and output blocking, the preset reset condition as the target reset condition is determined as follows: the first number of input and output blocking occurrences of the target hard disk is not zero; in response to the target abnormality type including input and output errors, the preset reset condition as the target reset condition is determined as follows: the first number of input and output errors occurring of the target hard disk is not less than a preset number; In response to the first occurrence of the target abnormality type satisfying the target reset condition, a reset operation is performed on the target hard disk.
2. The method according to claim 1, characterized in that Before triggering the target hard disk to perform a read / write operation based on the target hard disk being online at the user layer, the method further includes: In response to the storage server starting to start, triggering the candidate hard disk to read data of a preset size, and obtaining a verification result indicating whether the data reading of the candidate hard disk is successful; wherein the storage server stores a plurality of the candidate hard disks; Based on the verification result, performing an initialization operation of the candidate hard disk; The candidate hard disk on which the initialization operation is successfully performed is selected as the target hard disk, and the target hard disk is brought online to the kernel layer and the user layer.
3. The method according to claim 2, characterized in that The performing of the initialization operation of the candidate hard disk based on the verification result includes: In response to the verification result indicating that the data of the candidate hard disk is read successfully, performing the initialization operation of the candidate hard disk; In response to the verification result indicating that data reading of the candidate hard disk fails, the initialization operation of the candidate hard disk is suspended, and in response to the storage server being started up, the initialization operation of the candidate hard disk is restarted.
4. The method according to claim 1, characterized in that: The method further comprises: Detecting abnormal details of the target hard disk; In response to the abnormality detail information at least including at least one of the target hard disk failing to perform an initialization operation and the target hard disk being abnormal for a preset number of consecutive times according to the first detection result and / or the second detection result, a preset hard disk blacklist is updated based on the target hard disk.
5. The method according to claim 1, characterized in that The obtaining of abnormal detailed information about the target hard disk in the kernel layer includes: Obtaining a request time for the target hard disk to perform the read / write operation, and obtaining a request return time for the target hard disk to perform the read / write operation in the kernel layer; Obtaining the time difference between the request return time and the request time; Based on the time difference and the time threshold, the abnormality type of the abnormality detail information of the target hard disk is determined.
6. An electronic device, characterized in that: It comprises a memory and a processor coupled to each other, wherein the processor is used to execute program instructions stored in the memory to implement the hard disk processing method according to any one of claims 1 to 5.
7. A hard disk processing system, characterized in that: It comprises a storage server and a hard disk processor which are communicatively connected, wherein the storage server stores a plurality of target hard disks to perform read / write operations on the target hard disks, and the hard disk processor is the electronic device as claimed in claim 6.
8. A computer-readable storage medium having program instructions stored thereon, characterized in that: When the program instructions are executed by a processor, the hard disk processing method according to any one of claims 1 to 5 is implemented.
