Hard disk test method and device, equipment and medium

By issuing commands to define failure data in the NVME hard disk and determining abnormal parameters, it covers testing of multiple scenario types, solves the problem of limited content in existing NVME SSD test methods, and improves test results and efficiency.

CN118747140APending Publication Date: 2024-10-08INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410996269.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-24
Publication Date
2024-10-08

AI Technical Summary

Technical Problem

Existing NVME SSD test methods are limited in content, which affects the test results. In particular, the tests on NVME SSD performance, power on and off, high and low temperatures are not comprehensive enough.

Method used

By issuing the define failure data command in the NVME hard disk, it determines whether there are abnormal parameters in the command, and returns error information or test results according to different scenario types, covering the situations of normal and abnormal parameters, meeting the preset format alignment and not meeting the preset Scenarios for format alignment and combination with management commands.

Benefits of technology

It achieves full coverage of NVME hard drive testing, saves human resources, improves testing efficiency, and reuses test plans on different versions of hard drives.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118747140A_ABST
    Figure CN118747140A_ABST
Patent Text Reader

Abstract

The invention discloses a hard disk testing method and device, equipment and a medium, and relates to the technical field of hard disk testing. The method is applied to an NVME hard disk and comprises the steps that a failure data definition command is issued, and whether abnormal parameters exist in the failure data definition command or not is judged; if the abnormal parameters exist, determining that the current scene is a first scene and returning corresponding error information according to different corresponding condition types; if the abnormal parameters do not exist, determining that the current scene is a second scene and judging a corresponding target scene type; the target scene types comprise a scene meeting the preset format alignment, a scene not meeting the preset format alignment and a scene when the definition failure data command is successfully issued and combined with a preset management command, and the different target scene types comprise different situation types; and returning a corresponding test result according to the target scene type. According to the technical scheme, the more complex and complete testing method is provided, and coverage of all scenes during hard disk testing can be achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of hard disk testing, and in particular to a hard disk testing method, device, equipment and medium. Background Art

[0002] The world is entering the era of digital economy, and various large, medium and small data centers have become the infrastructure of the digital economy. In this huge new infrastructure project, data storage technology will inevitably become the cornerstone technology. At present, in the use of SSD (Solid State Drive), the test methods for NVME (Non-Volatile Memory express, non-volatile memory host controller interface specification) SSD mostly involve testing its performance, power on and off, high and low temperature, etc. The test content is relatively limited, which affects the test effect of NVME SSD. Therefore, how to further optimize the test effect for NVME SSD is a problem that technicians in this field need to solve at present. Summary of the invention

[0003] In view of this, the purpose of the present invention is to provide a hard disk test method, device, equipment and medium, to provide a more complex and complete test, and to achieve coverage of all scenarios during hard disk testing. The specific scheme is as follows:

[0004] In a first aspect, the present application discloses a hard disk testing method, which is applied to NVME hard disks, comprising:

[0005] Sending a define invalidation data command in the NVME hard disk, and determining whether there is an abnormal parameter in the define invalidation data command;

[0006] If the abnormal parameter exists in the define invalid data command, it is determined that the current corresponding scenario is the first scenario, and corresponding error information is returned according to different situation types corresponding to the first scenario; the situation types corresponding to the first scenario include that the number of blocks in the define invalid data command is abnormal, the start logical block address in the define invalid data command is abnormal, and the logical block size in the define invalid data command exceeds a preset range;

[0007] If the abnormal parameter does not exist in the define invalidation data command, it is determined that the current corresponding scene is the second scene, and the target scene type corresponding to the second scene is determined; the target scene type includes a scene that satisfies the preset format alignment, a scene that does not satisfy the preset format alignment, and a scene when the define invalidation data command is successfully issued and combined with a preset management command, and different target scene types include different situation types;

[0008] The corresponding test result is returned according to the target scenario type, so as to determine whether the define invalidation data command is issued successfully and whether the interval data in which the define invalidation data command is issued is readable based on the test result, so as to verify whether the define invalidation data command is effective.

[0009] Optionally, returning corresponding error information according to different situation types corresponding to the first scenario includes:

[0010] Determining a first situation type corresponding to the first scenario;

[0011] If the first situation type is a situation type in which the number of blocks in the issued definition invalid data command is abnormal, returning first error information for characterizing a block count error;

[0012] If the first situation type is a situation type in which there is an abnormal start logical block address in the issued define invalid data command, return second error information for characterizing an error in the logical block address range;

[0013] If the first situation type is a situation type in which the logical block size in the issued define invalid data command exceeds a preset range, third error information for characterizing the logical block address range error is returned accordingly according to the format type of the logical block address.

[0014] Optionally, returning a corresponding test result according to the target scenario type includes:

[0015] Verifying the interval data for issuing the define invalidation data command based on the target scenario type to determine whether the interval data is readable;

[0016] If the interval data is readable, it is determined that the command to define invalid data is successfully issued but not effective;

[0017] If the interval data is unreadable, it is determined that the define invalid data command is issued successfully and takes effect.

[0018] Optionally, when the target scene type is a scene that satisfies a preset format alignment, returning a corresponding test result according to the target scene type includes:

[0019] Determine a second situation type corresponding to the scenario that satisfies the preset format alignment;

[0020] If the second situation type is the define invalid data command issued for a single segment area, determine the current format type of the logical block address, then read the first area segment where the define invalid data command is issued based on the current format type, and obtain a corresponding first return instruction, so as to determine a first test result according to the first return instruction;

[0021] If the second situation type is the define invalid data command issued for multiple overlapping areas, the current format type of the logical block address is determined, and then the second area segment where the define invalid data command is issued is read based on the current format type, and the corresponding second return instruction is obtained, so as to determine the second test result according to the second return instruction.

[0022] Optionally, when the target scene type is a scene that does not satisfy the preset format alignment, returning a corresponding test result according to the target scene type includes:

[0023] Determine a third situation type corresponding to the scenario that does not satisfy the preset format alignment;

[0024] If the third situation type is that when the define invalid data command is issued, the starting position of the logic block size satisfies the preset format alignment, the current format type of the logic block address is determined; when the end position of the logic block size is less than the preset format alignment, based on the current format type, a first read command of the logic block address is issued according to the define invalid data command, and a corresponding third return instruction is obtained, so as to determine a third test result according to the third return instruction; when the end position of the logic block size is greater than the preset format alignment, based on the current format type, a second read command of the logic block address is issued according to the define invalid data command, and a corresponding fourth return instruction is obtained, so as to determine a fourth test result according to the fourth return instruction;

[0025] If the third situation type is that when the define invalid data command is issued, the starting position of the logical block size does not satisfy the preset format alignment, the current format type of the logical block address is determined; when the number of the logical block addresses is less than or equal to the preset format alignment, based on the current format type, the third read command of the logical block address is issued according to the define invalid data command, and the corresponding fifth return instruction is obtained so as to determine the fifth test result according to the fifth return instruction; when the number of the logical block addresses spans one of the preset format alignments, based on the current format type, the fourth read command of the logical block address is issued according to the define invalid data command, and the corresponding sixth return instruction is obtained so as to determine the sixth test result according to the sixth return instruction.

[0026] Optionally, when the target scenario type is a scenario in which the command to define invalidation data is issued successfully and then combined with a preset management command, returning a corresponding test result according to the target scenario type includes:

[0027] Determine a fourth situation type corresponding to a scenario when the command to define invalidation data is issued successfully and combined with a preset management command;

[0028] If the fourth situation type is that the disable deletion notification instruction is issued after the define invalid data command is issued successfully, then determine the current format type of the logical block address; based on the current format type, issue a fifth read command of the logical block address according to the define invalid data command, and obtain a corresponding seventh return instruction; issue a sixth read command of the logical block address according to the disable deletion notification instruction, and obtain a corresponding eighth return instruction, so as to determine a seventh test result according to the seventh return instruction and the eighth return instruction;

[0029] If the fourth situation type is that the format hard disk instruction is issued after the define invalid data command is issued successfully, then the current format type of the logical block address is determined; based on the current format type, a sixth read command of the logical block address is issued according to the define invalid data command, and a corresponding eighth return instruction is obtained; a seventh read command of the logical block address is issued according to the format hard disk instruction, and a corresponding ninth return instruction is obtained, so as to determine an eighth test result according to the eighth return instruction and the ninth return instruction;

[0030] If the fourth situation type is that the overwrite instruction is issued after the define invalid data command is issued successfully, then the current format type of the logical block address is determined; based on the current format type, the seventh read command of the logical block address is issued according to the define invalid data command, and the corresponding ninth return instruction is obtained; the eighth read command of the logical block address is issued according to the overwrite write instruction, and the corresponding tenth return instruction is obtained, so as to determine the ninth test result according to the ninth return instruction and the tenth return instruction;

[0031] If the fourth situation type is that a reset instruction and / or an unload or load instruction to a driver is issued after the define invalid data command is issued successfully, then the current format type of the logical block address is determined; based on the current format type, an eighth read command of the logical block address is issued according to the define invalid data command, and a corresponding tenth return instruction is obtained; a ninth read command of the logical block address is issued according to the reset instruction and / or the unload or load instruction to a driver, and a corresponding eleventh return instruction is obtained, so as to determine a tenth test result according to the tenth return instruction and the eleventh return instruction;

[0032] If the fourth situation type is that the server operation instruction is issued after the define invalidation data command is successfully issued, the current format type of the logical block address is determined; based on the current format type, the ninth read command of the logical block address is issued according to the define invalidation data command, and the corresponding eleventh return instruction is obtained; the tenth read command of the logical block address is issued according to the server operation instruction, and the corresponding twelfth return instruction is obtained, so as to determine the eleventh test result according to the eleventh return instruction and the twelfth return instruction.

[0033] Optionally, the hard disk testing method further includes:

[0034] The logical block addresses of each format type are traversed, and then the step of determining the current format type of the logical block address is triggered according to the different situation types under the target scenario type to obtain test results corresponding to different format types.

[0035] In a second aspect, the present application discloses a hard disk testing device, which is applied to an NVME hard disk, comprising:

[0036] A command issuing module, used for issuing a command to define invalid data in the NVME hard disk;

[0037] An abnormal parameter judgment module is used to judge whether there are abnormal parameters in the definition failure data command;

[0038] an error information returning module, for determining that the current corresponding scenario is a first scenario if the abnormal parameter exists in the define invalid data command, and returning corresponding error information according to different situation types corresponding to the first scenario; the situation types corresponding to the first scenario include a block number abnormality in the define invalid data command, a start logical block address abnormality in the define invalid data command, and a logical block size in the define invalid data command exceeding a preset range;

[0039] A scenario type judgment module, configured to determine that the currently corresponding scenario is a second scenario if the abnormal parameter does not exist in the define invalidation data command, and to judge the target scenario type corresponding to the second scenario; the target scenario types include scenarios that meet the preset format alignment, scenarios that do not meet the preset format alignment, and scenarios when the define invalidation data command is successfully issued and combined with a preset management command, and different target scenario types include different situation types;

[0040] A test result returning module is used to return corresponding test results according to the target scenario type, so as to judge whether the define invalidation data command is issued successfully and whether the interval data for issuing the define invalidation data command is readable based on the test results, so as to verify whether the define invalidation data command is effective.

[0041] In a third aspect, the present application discloses an electronic device, comprising a processor and a memory; wherein the memory is used to store a computer program, and the computer program is loaded and executed by the processor to implement the hard disk testing method as described above.

[0042] In a fourth aspect, the present application discloses a computer-readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the hard disk testing method as described above.

[0043] The present application provides a hard disk testing method, which is applied to an NVME hard disk, including: issuing a define invalidation data command in the NVME hard disk, and determining whether there is an abnormal parameter in the define invalidation data command; if the abnormal parameter exists in the define invalidation data command, determining that the current corresponding scenario is a first scenario, and returning corresponding error information according to different situation types corresponding to the first scenario; the situation types corresponding to the first scenario include the presence of a block number abnormality in the define invalidation data command, the presence of a start logical block address abnormality in the define invalidation data command, and the logical block size in the define invalidation data command exceeding a preset range; if the abnormal parameter does not exist in the define invalidation data command, determining that the current corresponding scenario is a second scenario, and determining the target scenario type corresponding to the second scenario; the target scenario type includes a scenario that satisfies a preset format alignment, a scenario that does not satisfy a preset format alignment, and a scenario when the define invalidation data command is successfully issued and combined with a preset management command, and different target scenario types include different situation types; returning a corresponding test result according to the target scenario type, so as to determine whether the define invalidation data command is successfully issued and whether the interval data of the issue of the define invalidation data command is readable based on the test result, so as to verify whether the define invalidation data command is effective.

[0044] The beneficial technical effect of the present application is as follows: a hard disk test for NVME hard disks is designed, and the test is carried out by issuing a define failure data command in the NVME hard disk, covering various scenarios involved in the define failure data command. First, it covers the situations of normal and abnormal parameters, and returns corresponding error information for the scenarios with abnormal parameters; for the scenarios without abnormal parameters, different target scenario types are included, covering the scenarios that meet the preset format alignment and do not meet the preset format alignment, as well as the scenario coverage of the define failure data command in combination with other management commands. Different target scenario types also include different situation types, thus achieving full coverage testing of the define failure data command. Moreover, it can be reused on disks of various versions involving this feature, saving manpower investment in repeated design of tests and improving test efficiency.

[0045] In addition, the present application provides a hard disk testing device, equipment and storage medium, which correspond to the above-mentioned hard disk testing method and have the same effect as above. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] In order to more clearly illustrate the embodiments of the present invention 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 embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0047] Figure 1 A flow chart of a hard disk testing method disclosed in this application;

[0048] Figure 2 A flowchart of a specific hard disk testing method disclosed in this application;

[0049] Figure 3 A structural schematic diagram of a hard disk testing device disclosed in this application;

[0050] Figure 4 This is a structural diagram of an electronic device disclosed in this application. DETAILED DESCRIPTION

[0051] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0052] At present, in the process of using SSD, most of the test methods for NVME SSD are aimed at the power on and off, performance, high and low temperature of NVME hard disk; or they are mostly related to write commands, not involving NVME hard disk; or they are related to NVME hard disk, but about failure information, not involving the issuance of failure data definition commands. Therefore, the current test content for hard disk testing is relatively limited, which affects the test effect of NVME SSD.

[0053] To this end, the present application provides a hard disk testing solution that can provide more complex and complete testing and achieve coverage of all scenarios during hard disk testing.

[0054] The embodiment of the present invention discloses a hard disk testing method, which is applied to NVME hard disks. Figure 1 As shown, the method includes:

[0055] Step S11: issuing a define invalidation data command in the NVME hard disk, and determining whether there are abnormal parameters in the define invalidation data command.

[0056] The invalid data definition command is the write uncorrectable command, which is used to define a section of LBA (Logical Block Address) data as invalid data, which is neither released nor overwritten or erased. All read accesses to this area will be denied until the area is trimmed (disabled deletion notification command) or formatted (format hard disk command) or overwritten.

[0057] In the embodiment of the present application, a test for defining invalid data command is proposed during the hard disk test. After defining invalid data command is issued, whether this command is issued successfully and whether it meets the protocol requirements, a relevant test method is needed to cover all scenarios and verify whether the command is successful.

[0058] When the define invalid data command is issued in the NVME hard disk, the parameters in the define invalid data command are first judged to determine whether there are abnormal parameters in it to cover the test of the define invalid data command in normal and abnormal parameter scenarios.

[0059] Step S12: If the abnormal parameter exists in the define failure data command, it is determined that the current corresponding scenario is the first scenario, and corresponding error information is returned according to different situation types corresponding to the first scenario; the situation types corresponding to the first scenario include the existence of a block number abnormality in the define failure data command, the existence of a starting logical block address abnormality in the define failure data command, and the logical block size in the define failure data command exceeds a preset range.

[0060] In a specific implementation, if there are abnormal parameters in the definition failure data command, a corresponding error message will be returned and the test ends. In the embodiment of the present application, the scenario corresponding to the presence of abnormal parameters in the definition failure data command is taken as the first scenario. Among them, the first scenario corresponds to different situation types, and corresponding error messages will be returned according to different situation types.

[0061] It should be pointed out that when there are abnormal parameters in the defined invalid data command issued, it includes the situation type that the defined invalid data command has an abnormal number of blocks, the situation type that the defined invalid data command has an abnormal start logical block address (SLBA, Start Logical Block Address), and the situation type that the logical block size in the defined invalid data command exceeds the preset range, such as the single logical block size issued exceeds the single maximum range of 1024K. Further, after issuing the defined invalid data command, error information corresponding to different situation types is returned.

[0062] Step S13: If the abnormal parameter does not exist in the define invalidation data command, it is determined that the current corresponding scene is the second scene, and the target scene type corresponding to the second scene is judged; the target scene types include scenes that meet the preset format alignment, scenes that do not meet the preset format alignment, and scenes when the define invalidation data command is successfully issued and combined with a preset management command, and different target scene types include different situation types.

[0063] In another specific implementation, if there are no abnormal parameters in the invalid data definition command, the current corresponding scenario is used as the second scenario. Among them, the second scenario includes different scenario types, and different scenario types can perform coverage tests on scenarios of whether the preset format alignment is met and other preset management commands issued after the invalid data definition command is successfully issued, such as trim, format, overwrite, reset, unload and load drive, power on and off commands. Among them, the scenario of whether the preset format alignment is met is described by taking the example of judging whether the data is 4K aligned. It can be understood by those of ordinary skill in the art that the 4K alignment scenario is only for illustration and does not limit the above-mentioned preset format alignment scenario type. The following embodiments are all described by taking the 4K alignment scenario or the non-4K alignment scenario as an example, and will not be repeated later.

[0064] It should be noted that different scenario types include different situation types. For example, for 4K alignment scenarios, it further includes situation types for single-segment, multi-segment non-overlapping LBA and overlapping LBA; for non-4K alignment scenarios, it further includes situation types for 4K alignment and non-4K alignment of the starting position of the command to define invalid data.

[0065] Step S14: Return corresponding test results according to the target scenario type, so as to determine whether the define invalidation data command is issued successfully and whether the interval data in which the define invalidation data command is issued is readable based on the test results, so as to verify whether the define invalidation data command is effective.

[0066] In an embodiment of the present application, when the parameters in the issued command to define invalid data are normal, corresponding test results will be returned for different target scenario types, including what is considered a successful command issuance, and after issuing this command, checking the corresponding issued interval to determine whether the command is effective by whether the data is unreadable.

[0067] Specifically, the process of returning the corresponding test result according to the target scenario type includes: verifying the interval data of the defined invalidation data command based on the target scenario type to determine whether the interval data is readable; if the interval data is readable, determining that the defined invalidation data command is successfully issued but not effective; if the interval data is unreadable, determining that the defined invalidation data command is successfully issued and effective. It is understandable that the defined invalidation data command is issued successfully under different target scenario types, and after the defined invalidation data command is issued, the internal data of the hard disk will indeed become unreadable, so the test shows that the hard disk internal command is actually issued successfully.

[0068] In a feasible implementation, after the test is completed, the obtained test results can be displayed visually, or the obtained test results can be analyzed and recorded, so as to locate and analyze the problem according to the test results.

[0069] The present application provides a hard disk testing method, which is applied to an NVME hard disk, including: issuing a define invalidation data command in the NVME hard disk, and determining whether there is an abnormal parameter in the define invalidation data command; if the abnormal parameter exists in the define invalidation data command, determining that the current corresponding scenario is a first scenario, and returning corresponding error information according to different situation types corresponding to the first scenario; the situation types corresponding to the first scenario include the presence of a block number abnormality in the define invalidation data command, the presence of a start logical block address abnormality in the define invalidation data command, and the logical block size in the define invalidation data command exceeding a preset range; if the abnormal parameter does not exist in the define invalidation data command, determining that the current corresponding scenario is a second scenario, and determining the target scenario type corresponding to the second scenario; the target scenario type includes a scenario that satisfies a preset format alignment, a scenario that does not satisfy a preset format alignment, and a scenario when the define invalidation data command is successfully issued and combined with a preset management command, and different target scenario types include different situation types; returning a corresponding test result according to the target scenario type, so as to determine whether the define invalidation data command is successfully issued and whether the interval data of the issue of the define invalidation data command is readable based on the test result, so as to verify whether the define invalidation data command is effective.

[0070] The beneficial technical effect of the present application is as follows: a hard disk test for NVME hard disks is designed, and the test is carried out by issuing a define failure data command in the NVME hard disk, covering various scenarios involved in the define failure data command. First, it covers the situations of normal and abnormal parameters, and returns corresponding error information for the scenarios with abnormal parameters; for the scenarios without abnormal parameters, different target scenario types are included, covering the scenarios that meet the preset format alignment and do not meet the preset format alignment, as well as the scenario coverage of the define failure data command in combination with other management commands. Different target scenario types also include different situation types, thus achieving full coverage testing of the define failure data command. Moreover, it can be reused on disks of various versions involving this feature, saving manpower investment in repeated design of tests and improving test efficiency.

[0071] For the scenario where there are abnormal parameters in the issued definition failure data command, the hard disk testing method, step S12 returns corresponding error information according to different situation types corresponding to the first scenario, including:

[0072] Determining a first situation type corresponding to the first scenario;

[0073] If the first situation type is a situation type in which the number of blocks in the issued definition invalid data command is abnormal, returning first error information for characterizing a block count error;

[0074] If the first situation type is a situation type in which there is an abnormal start logical block address in the issued define invalid data command, return second error information for characterizing an error in the logical block address range;

[0075] If the first situation type is a situation type in which the logical block size in the issued define invalid data command exceeds a preset range, third error information for characterizing the logical block address range error is returned accordingly according to the format type of the logical block address.

[0076] For the first scenario, in a first specific implementation, the first situation type corresponding to the first scenario is that the number of blocks in the defined invalid data command issued is abnormal, and the first error information used to characterize the block count error is returned. Exemplary: nvme write-uncor / dev / nvme0 –n1 –s0 –c-1 is issued to the specified area of ​​NVME. If the number of blocks in the defined invalid data command is abnormal, the error information of Block count error should be returned.

[0077] In a second specific implementation, the first situation type corresponding to the first scenario is that the starting logical block address in the defined invalid data command is abnormal, and the second error information used to characterize the logical block address range error is returned. Exemplary: nvme write-uncor / dev / nvme0 –n1 –s-1 –c1 is issued to the specified area of ​​NVME. If the starting logical block address in the defined invalid data command is abnormal, the error information of LBA Range error should be returned.

[0078] In a third specific implementation, the first situation type corresponding to the first scenario is that the logical block size in the defined invalid data command issued exceeds the preset range. For example, if the size of a single logical block issued exceeds the maximum range of 1024K that can be issued in a single transaction, a third error message for characterizing the error in the logical block address range is returned accordingly according to the format type of the logical block address. Among them, the format type of the logical block address (LBAF, LBA Format) includes 4 LBAF types, namely 0, 1, 2, and 3, corresponding to 512B, 512B+8, 4K, and 4K+8. Exemplary: for lba0 or lba1, nvme write-uncor / dev / nvme0 -n1 -s0 -c2048 is issued; for lba2 or lba3, nvme write-uncor / dev / nvme0 -n1 -s0 -c256 is issued; accordingly, according to the format type of different logical block addresses, an error message of LBARange error is returned after issuing the command.

[0079] For a scenario where there are no abnormal parameters in the issued definition failure data command, when the target scenario type is a scenario that satisfies the preset format alignment, the hard disk testing method, step S14, returns a corresponding test result according to the target scenario type, including:

[0080] Determine a second situation type corresponding to the scenario that satisfies the preset format alignment;

[0081] If the second situation type is the define invalid data command issued for a single segment area, determine the current format type of the logical block address, then read the first area segment where the define invalid data command is issued based on the current format type, and obtain a corresponding first return instruction, so as to determine a first test result according to the first return instruction;

[0082] If the second situation type is the define invalid data command issued for multiple overlapping areas, the current format type of the logical block address is determined, and then the second area segment where the define invalid data command is issued is read based on the current format type, and the corresponding second return instruction is obtained, so as to determine the second test result according to the second return instruction.

[0083] In the embodiment of the present application, for the second scenario, if the target scenario type corresponding to the second scenario is that the logical block size of the defined invalidation data command issued is 4K aligned, then the 4K alignment scenario includes the second situation type.

[0084] In the first specific implementation, the second situation type is to test the issuance of a define invalid data command for a single-segment area. Since the logical block address includes different format types, firstly, the current format type of the logical block address is determined; secondly, the define invalid data command is issued to the single-segment area based on the current format type. According to the contents disclosed in the aforementioned embodiments, if the internal data becomes unreadable after the define invalid data command is issued, it proves that the command is issued successfully and takes effect. Therefore, after the define invalid data command is issued to the single-segment area, the first area segment in which the define invalid data command is issued is read; then, the define invalid data command is issued and returns success, and the read command returns Unrecovered ReadError when reading. In this way. It proves that the command is issued successfully and takes effect, and the corresponding first test result is obtained. It can be understood that since the logical block address includes different format types, after the logical block address of the current format type executes the above steps, the logical block addresses of other format types are traversed and the above steps are repeated.

[0085] In the second specific implementation, the second situation type is to test the issuance of a define invalid data command for multiple overlapping areas. Similarly, based on the aforementioned steps, it can be known that the current format type of the logical block address is also determined first; secondly, based on the current format type, a define invalid data command is issued to multiple overlapping areas, and then the second area segment where the define invalid data command is issued is read; further, the define invalid data command is issued and returns successfully, and the read command reads and returns Unrecovered Read Error. In this way. It proves that the command is issued successfully and takes effect, and the corresponding second test result is obtained. It can be understood that since the logical block address includes different format types, after the logical block address of the current format type executes the above steps, the logical block addresses of other format types are traversed and the above steps are repeated.

[0086] For a scenario where there is no abnormal parameter in the issued definition failure data command, when the target scenario type is a scenario that does not satisfy the preset format alignment, the hard disk testing method, step S14, returns a corresponding test result according to the target scenario type, including:

[0087] Determine the third situation type corresponding to the scenario that does not satisfy the preset format alignment.

[0088] In the embodiment of the present application, for the second scenario, if the target scenario type corresponding to the second scenario is that the logical block size of the defined invalidation data command issued is non-4K aligned, then the non-4K aligned scenario includes the third situation type.

[0089] If the third situation type is that when the define invalid data command is issued, the starting position of the logical block size satisfies the preset format alignment, the current format type of the logical block address is determined; when the end position of the logical block size is smaller than the preset format alignment, based on the current format type, a first read command of the logical block address is issued according to the define invalid data command, and a corresponding third return instruction is obtained so as to determine a third test result according to the third return instruction; when the end position of the logical block size is larger than the preset format alignment, based on the current format type, a second read command of the logical block address is issued according to the define invalid data command, and a corresponding fourth return instruction is obtained so as to determine a fourth test result according to the fourth return instruction.

[0090] In the first specific implementation, the third situation type is that when the command to define invalid data is issued, the starting position of the logical block size is aligned to 4K. Furthermore, there are situations where the end position is less than 4K aligned and greater than 4K aligned, and corresponding test results are returned for different situations. First, the current format type of the logical block address needs to be determined; since the logical block address includes different format types, taking the current format type of LBA0 as an example, the following will exemplarily explain them respectively.

[0091] 1. Send the command to define invalid data. When the logical block size starts with 4K alignment and ends with less than 4K alignment, perform the following steps:

[0092] (1) The low-level logical block size is LBA0 (512b);

[0093] (2) Issue nvme write-uncor / dev / nvme0 –n1 –s0 –c6;

[0094] (3) Issue the read command to read the first 7 lba: nvme read / dev / nvme0n1 –s0 –c6 –z3584;

[0095] (4) The command to define invalid data returns successfully, and the read command reads data successfully, which proves that the command to define invalid data returns successfully but is not actually effective;

[0096] (5) Traverse the LBAs of all format types and repeat steps (1) to (4).

[0097] 2. Send the command to define invalid data. When the logical block size starts with 4K alignment and ends with more than 4K alignment, perform the following steps:

[0098] (1) The low-level logical block size is LBA0 (512b);

[0099] (2) Issue nvme write-uncor / dev / nvme0 –n1 –s0 –c8;

[0100] (3) Issue the read command to read the first 8 lba: nvme read / dev / nvme0n1 –s0 –c7 –z4096;

[0101] (4) Issue the read command to read the 9th lba: nvme read / dev / nvme0n1 –s8 –c0 –z512;

[0102] (5) The read in step (3) returns Unrecovered Read Error, which proves that the command to define invalid data was successfully issued and took effect;

[0103] (6) Step (4) returns a successful read;

[0104] (7) Traverse the LBAs of all format types and repeat steps (1) to (6).

[0105] If the third situation type is that when the define invalid data command is issued, the starting position of the logical block size does not satisfy the preset format alignment, the current format type of the logical block address is determined; when the number of the logical block addresses is less than or equal to the preset format alignment, based on the current format type, the third read command of the logical block address is issued according to the define invalid data command, and the corresponding fifth return instruction is obtained so as to determine the fifth test result according to the fifth return instruction; when the number of the logical block addresses spans one of the preset format alignments, based on the current format type, the fourth read command of the logical block address is issued according to the define invalid data command, and the corresponding sixth return instruction is obtained so as to determine the sixth test result according to the sixth return instruction.

[0106] In the second specific implementation, the third situation type is that when issuing a command to define invalid data, the starting position of the logical block size is not 4K aligned. Furthermore, there are situations where the number of logical block addresses is less than or equal to 4K alignment, and the number of logical block addresses spans a 4K alignment, that is, corresponding to the situation where the number of logical block addresses is greater than 4K alignment, and corresponding test results are returned for different situations. Similarly, it is first necessary to determine the current format type of the logical block address; since the logical block address includes different format types, taking the current format type of LBA0 as an example, the following will exemplarily explain them separately.

[0107] 1. Send the command to define invalid data. When the starting position of the logical block size is not 4K aligned and the number of LBAs is less than or equal to 4K aligned, perform the following steps:

[0108] (1) The low-level logical block size is LBA0 (512b);

[0109] (2) Send nvme write-uncor / dev / nvme0 –n1 –s7 –c6 (alignment is less than 4K); or send nvme write-uncor / dev / nvme0 –n1 –s7 –c7 (alignment is equal to 4K);

[0110] (3) Issue a read command to read the above area;

[0111] (4) The command to define invalid data returns successfully, and the read command reads data successfully, which proves that the command to define invalid data returns successfully but is not actually effective;

[0112] (5) Traverse the LBAs of all format types and repeat steps (1) to (4).

[0113] 2. Send the command to define invalid data. When the starting position of the logical block size is not 4K aligned and the number of LBAs spans a 4K alignment, perform the following steps:

[0114] (1) The low-level logical block size is LBA0 (512b);

[0115] (2) Issue nvme write-uncor / dev / nvme0 –n1 –s7 –c8;

[0116] (3) Issue a read command to read the above area;

[0117] (4) Define the invalid data command to return success. The read command reads lba7 data successfully, reads lba8-lba15 and returns Unrecovered Read Error. lba16 reads data successfully.

[0118] (5) Traverse the LBAs of all format types and repeat steps (1) to (4).

[0119] It is understandable that, since the logical block addresses include different format types, after the logical block addresses of the current format type execute the above steps, they must finally traverse the logical block addresses of other format types to complete the test of the invalid data command defined under each format type.

[0120] For the scenario where there is no abnormal parameter in the issued define invalidation data command, when the target scenario type is a scenario where the define invalidation data command is issued successfully and then combined with a preset management command, the hard disk testing method, step S14, returns a corresponding test result according to the target scenario type, including:

[0121] Determine a fourth situation type corresponding to a scenario in which the command to define invalidation data is successfully issued and combined with a preset management command.

[0122] In the embodiment of the present application, for the second scenario, if the target scenario type corresponding to the second scenario is to issue other management commands after the definition invalidation data command is successfully issued, the scenario when the definition invalidation data command is successfully issued and combined with the preset management command includes the fourth situation type. It is understandable that when the definition invalidation data command is successfully issued, issuing other management commands may cause the definition invalidation data command to fail. Therefore, relevant tests on the definition invalidation data command are performed for different situation types in this scenario.

[0123] If the fourth situation type is that a disable delete notification instruction is issued after the define invalid data command is successfully issued, the current format type of the logical block address is determined; based on the current format type, a fifth read command of the logical block address is issued according to the define invalid data command, and the corresponding seventh return instruction is obtained; a sixth read command of the logical block address is issued according to the disable delete notification instruction, and the corresponding eighth return instruction is obtained, so as to determine the seventh test result according to the seventh return instruction and the eighth return instruction.

[0124] In the first specific implementation, the fourth situation type is to issue a disable deletion notification instruction after successfully issuing the define invalid data command, that is, to issue a trim command after successfully issuing the define invalid data command. First, it is necessary to determine the current format type of the logical block address; since the logical block address includes different format types, the current format type is LBA0 as an example, and the following will be explained exemplarily. When the trim command is issued after successfully issuing the define invalid data command, the following steps are performed:

[0125] (1) The low-level logical block size is LBA0 (512b);

[0126] (2) Issue nvme write-uncor / dev / nvme0 –n1 –s0 –c7;

[0127] (3) Send nvme read / dev / nvme0n1 –s0 –c7 –z4096;

[0128] (4) Send nvme dsm / dev / nvme0 –n1 –s0 –b7 –d;

[0129] (5) Send nvme read / dev / nvme0n1 –s0 –c7 –z4096;

[0130] (6) The reading in step (3) returns Unrecovered Read Error, which proves that the command to define invalid data was successfully issued and took effect;

[0131] (7) The read in step (5) is successful, and the read data is 0, which proves that trim makes the command to define invalid data invalid, and this area becomes readable;

[0132] (8) Traverse the LBAs of all format types and repeat steps (1) to (7).

[0133] If the fourth situation type is that the format hard disk instruction is issued after the define invalid data command is successfully issued, the current format type of the logical block address is determined; based on the current format type, the sixth read command of the logical block address is issued according to the define invalid data command, and the corresponding eighth return instruction is obtained; the seventh read command of the logical block address is issued according to the format hard disk instruction, and the corresponding ninth return instruction is obtained, so as to determine the eighth test result according to the eighth return instruction and the ninth return instruction.

[0134] In the second specific implementation, the fourth situation type is to issue a hard disk formatting instruction after successfully issuing a define invalid data command, that is, to issue a format command after successfully issuing a define invalid data command. First, it is necessary to determine the current format type of the logical block address; since the logical block address includes different format types, the current format type is LBA0 as an example, and the following will be explained exemplarily. When issuing a format command after successfully issuing a define invalid data command, perform the following steps:

[0135] (1) The low-level logical block size is LBA0 (512b);

[0136] (2) Issue nvme write-uncor / dev / nvme0 –n1 –s0 –c7;

[0137] (3) Send nvme read / dev / nvme0n1 –s0 –c7 –z4096;

[0138] (4) Send nvme format / dev / nvme0 –n1 –s0 –l0;

[0139] (5) Send nvme read / dev / nvme0n1 –s0 –c7 –z4096;

[0140] (6) The reading in step (3) returns Unrecovered Read Error, which proves that the command to define invalid data was successfully issued and took effect;

[0141] (7) The reading in step (5) is successful, and the data read is 0, which proves that the format makes the command to define invalid data invalid, and this area becomes readable;

[0142] (8) Traverse the LBAs of all format types and repeat steps (1) to (7).

[0143] If the fourth situation type is that the overwrite write instruction is issued after the define invalid data command is successfully issued, the current format type of the logical block address is determined; based on the current format type, the seventh read command of the logical block address is issued according to the define invalid data command, and the corresponding ninth return instruction is obtained; the eighth read command of the logical block address is issued according to the overwrite write instruction, and the corresponding tenth return instruction is obtained, so as to determine the ninth test result according to the ninth return instruction and the tenth return instruction.

[0144] In the third specific implementation, the fourth situation type is to issue an overwrite instruction after the invalidation data definition command is issued successfully, that is, the overwrite command is issued after the invalidation data definition command is issued successfully. First, the current format type of the logical block address needs to be determined; since the logical block address includes different format types, the current format type is LBA0 as an example, and the following will be explained exemplarily. When the overwrite command is issued after the invalidation data definition command is issued successfully, the following steps are performed:

[0145] (1) The low-level logical block size is LBA0 (512b);

[0146] (2) Issue nvme write-uncor / dev / nvme0 –n1 –s0 –c7;

[0147] (3) Send nvme read / dev / nvme0n1 –s0 –c7 –z4096;

[0148] (4) Issue nvme write / dev / nvme0n1–s0 –c7 –z 4096 –d file;

[0149] (5) Send nvme read / dev / nvme0n1 –s0 –c7 –z4096;

[0150] (6) The reading in step (3) returns Unrecovered Read Error, which proves that the command to define invalid data was successfully issued and took effect;

[0151] (7) The read in step (5) is successful, and the data read is the data written in step (4), proving that the overwrite makes the command to define invalid data invalid, and this area becomes readable;

[0152] (8) Traverse the LBAs of all format types and repeat steps (1) to (7).

[0153] If the fourth situation type is that a reset instruction and / or an unload or load instruction to the driver is issued after the define invalid data command is successfully issued, the current format type of the logical block address is determined; based on the current format type, the eighth read command of the logical block address is issued according to the define invalid data command, and the corresponding tenth return instruction is obtained; the ninth read command of the logical block address is issued according to the reset instruction and / or the unload or load instruction to the driver, and the corresponding eleventh return instruction is obtained, so as to determine the tenth test result according to the tenth return instruction and the eleventh return instruction.

[0154] In the fourth specific implementation, the fourth situation type is to issue a reset instruction and / or an unload or load instruction to the driver after the define invalid data command is successfully issued, that is, to issue a reset, unload / load driver command after the define invalid data command is successfully issued. First, it is necessary to determine the current format type of the logical block address; since the logical block address includes different format types, the current format type is LBA0 as an example, and it will be explained exemplarily below. When the reset, unload / load driver command is issued after the define invalid data command is successfully issued, perform the following steps:

[0155] (1) The low-level logical block size is LBA0 (512b);

[0156] (2) Issue nvme write-uncor / dev / nvme0 –n1 –s0 –c7;

[0157] (3) Send nvme read / dev / nvme0n1 –s0 –c7 –z4096;

[0158] (4) Issue nvme reset / dev / nvme0 (reset command) and / or rmmod nvme (unload nvme driver) and / or modprobe nvme (load nvme driver);

[0159] (5) Send nvme read / dev / nvme0n1 –s0 –c7 –z4096;

[0160] (6) The reading in step (3) returns Unrecovered Read Error, which proves that the command to define invalid data was successfully issued and took effect;

[0161] (7) The read in step (5) returns Unrecovered Read Error, which proves that the reset or unload / load driver command has not affected the status of the command that defines the invalid data;

[0162] (8) Traverse the LBAs of all format types and repeat steps (1) to (7).

[0163] If the fourth situation type is that the server operation instruction is issued after the define invalidation data command is successfully issued, the current format type of the logical block address is determined; based on the current format type, the ninth read command of the logical block address is issued according to the define invalidation data command, and the corresponding eleventh return instruction is obtained; the tenth read command of the logical block address is issued according to the server operation instruction, and the corresponding twelfth return instruction is obtained, so as to determine the eleventh test result according to the eleventh return instruction and the twelfth return instruction.

[0164] In a fifth specific implementation, the fourth situation type is to issue a server operation instruction after the definition of invalid data command is successfully issued, for example, to perform normal, abnormal power on and off, or restart operations on the server after the definition of invalid data command is successfully issued. First, it is necessary to determine the current format type of the logical block address; since the logical block address includes different format types, the current format type is LBA0 as an example, and an exemplary description will be given below. When the server is powered on and off normally, abnormally, or restarted after the definition of invalid data command is successfully issued, the following steps are performed:

[0165] (1) The low-level logical block size is LBA0 (512b);

[0166] (2) Issue nvme write-uncor / dev / nvme0 –n1 –s0 –c7;

[0167] (3) Send nvme read / dev / nvme0n1 –s0 –c7 –z4096;

[0168] (4) Power on, off, or restart the server normally or abnormally;

[0169] (5) Issue nvme read / dev / nvme0n1 –s0 –c –z4096;

[0170] (6) The reading in step (3) returns Unrecovered Read Error, which proves that the command to define invalid data was successfully issued and took effect;

[0171] (7) The read in step (5) returns Unrecovered Read Error, which proves that normal or abnormal power on / off or restart does not affect the defined invalid data command status;

[0172] (8) Traverse the LBAs of all format types and repeat steps (1) to (7).

[0173] It is understandable that, since the logical block addresses include different format types, after the logical block addresses of the current format type execute the above steps, they must finally traverse the logical block addresses of other format types to complete the test of the invalid data command defined under each format type.

[0174] Specifically, based on the above embodiments, the logical block addresses of each format type are traversed, and then the step of determining the current format type of the logical block address is triggered according to the different situation types under the target scenario type to obtain test results corresponding to different format types.

[0175] like Figure 2 As shown, a specific hard disk test flow chart is provided in combination with the content disclosed in the above embodiments. The test flow of defining the invalid data command is respectively tested for the non-4K alignment of the logical block issued, the single-segment and multi-segment areas under 4K alignment, and the combination of defining the invalid data command with other trim, format, overwrite, reset, unload and load drivers, and power on and off commands after the definition of invalid data command is successfully issued. First, the definition of invalid data command is issued in the hard disk to determine whether there are abnormal parameters. For the scenario where there are abnormal parameters, an error is returned according to the corresponding situation type, and the test is terminated. For the scenario where there are no abnormal parameters, it is further determined whether the size of the logical block issued is 4K aligned. In the scenario where the size of the logical block issued is 4K aligned, the definition of invalid data command can be directly issued, otherwise it is necessary to further determine the different situation types in the non-4K alignment scenario. Among them, for the two scenarios of whether 4K alignment is 4K aligned, it is further tested for all scenarios of trim, format, overwrite, reset, unload and load drivers, power on and off, etc. issued after the definition of invalid data command is issued. Finally, by verifying whether the interval data of the issued command is readable, it is determined whether the command to define the invalid data is issued successfully and takes effect, or whether it is issued successfully but does not take effect, and the test result is obtained, and the test ends.

[0176] Correspondingly, the embodiment of the present application also discloses a hard disk testing device, which is applied to NVME hard disks, see Figure 3 As shown, the device comprises:

[0177] A command issuing module 11, used for issuing a command to define invalid data in the NVME hard disk;

[0178] An abnormal parameter judgment module 12 is used to judge whether there are abnormal parameters in the definition failure data command;

[0179] The error information return module 13 is used to determine that the current corresponding scenario is the first scenario if the abnormal parameter exists in the define invalid data command, and return corresponding error information according to different situation types corresponding to the first scenario; the situation types corresponding to the first scenario include the existence of a block number abnormality in the define invalid data command, the existence of a start logical block address abnormality in the define invalid data command, and the logical block size in the define invalid data command exceeds a preset range;

[0180] A scene type judgment module 14 is used to determine that the current corresponding scene is the second scene if the abnormal parameter does not exist in the define invalidation data command, and to judge the target scene type corresponding to the second scene; the target scene types include scenes that meet the preset format alignment, scenes that do not meet the preset format alignment, and scenes when the define invalidation data command is successfully issued and combined with a preset management command, and different target scene types include different situation types;

[0181] The test result returning module 15 is used to return the corresponding test result according to the target scenario type, so as to judge whether the define invalidation data command is issued successfully and whether the interval data for issuing the define invalidation data command is readable based on the test result, so as to verify whether the define invalidation data command is effective.

[0182] Among them, for more specific working processes of the above-mentioned modules, please refer to the corresponding contents disclosed in the aforementioned embodiments, which will not be repeated here.

[0183] It can be seen that the above scheme of this embodiment is applied to NVME hard disk, including: issuing a define invalid data command in the NVME hard disk, and judging whether there is an abnormal parameter in the define invalid data command; if the abnormal parameter exists in the define invalid data command, determining that the current corresponding scenario is the first scenario, and returning corresponding error information according to different situation types corresponding to the first scenario; the situation types corresponding to the first scenario include the existence of a block number abnormality in the define invalid data command, the existence of a starting logical block address abnormality in the define invalid data command, and the logical block size in the define invalid data command exceeding a preset range; if the define invalid data command exists, If the abnormal parameter does not exist in the invalid data command, it is determined that the current corresponding scene is the second scene, and the target scene type corresponding to the second scene is judged; the target scene type includes scenes that meet the preset format alignment, scenes that do not meet the preset format alignment, and scenes when the define invalid data command is successfully issued and combined with a preset management command, and different target scene types include different situation types; according to the target scene type, a corresponding test result is returned to judge whether the define invalid data command is successfully issued and whether the interval data for issuing the define invalid data command is readable based on the test result, so as to verify whether the define invalid data command is effective.

[0184] The beneficial technical effect of the present application is as follows: a hard disk test for NVME hard disks is designed, and the test is carried out by issuing a define failure data command in the NVME hard disk, covering various scenarios involved in the define failure data command. First, it covers the situations of normal and abnormal parameters, and returns corresponding error information for the scenarios with abnormal parameters; for the scenarios without abnormal parameters, different target scenario types are included, covering the scenarios that meet the preset format alignment and do not meet the preset format alignment, as well as the scenario coverage of the define failure data command in combination with other management commands. Different target scenario types also include different situation types, thus achieving full coverage testing of the define failure data command. Moreover, it can be reused on disks of various versions involving this feature, saving manpower investment in repeated design of tests and improving test efficiency.

[0185] In a specific implementation manner, the error information returning module 13 is specifically used to:

[0186] Determining a first situation type corresponding to the first scenario;

[0187] If the first situation type is a situation type in which the number of blocks in the issued definition invalid data command is abnormal, returning first error information for characterizing a block count error;

[0188] If the first situation type is a situation type in which there is an abnormal start logical block address in the issued define invalid data command, return second error information for characterizing an error in the logical block address range;

[0189] If the first situation type is a situation type in which the logical block size in the issued define invalid data command exceeds a preset range, third error information for characterizing the logical block address range error is returned accordingly according to the format type of the logical block address.

[0190] In a specific implementation manner, the test result returning module 15 is specifically used to:

[0191] Verifying the interval data for issuing the define invalidation data command based on the target scenario type to determine whether the interval data is readable;

[0192] If the interval data is readable, it is determined that the command to define invalid data is successfully issued but not effective;

[0193] If the interval data is unreadable, it is determined that the define invalid data command is issued successfully and takes effect.

[0194] In a specific implementation manner, when the target scene type is a scene that satisfies a preset format alignment, the test result returning module 15 is specifically used to:

[0195] Determine a second situation type corresponding to the scenario that satisfies the preset format alignment;

[0196] If the second situation type is the define invalid data command issued for a single segment area, determine the current format type of the logical block address, then read the first area segment where the define invalid data command is issued based on the current format type, and obtain a corresponding first return instruction, so as to determine a first test result according to the first return instruction;

[0197] If the second situation type is the define invalid data command issued for multiple overlapping areas, the current format type of the logical block address is determined, and then the second area segment where the define invalid data command is issued is read based on the current format type, and the corresponding second return instruction is obtained, so as to determine the second test result according to the second return instruction.

[0198] In a specific implementation manner, when the target scene type is a scene that does not satisfy the preset format alignment, the test result returning module 15 is specifically used to:

[0199] Determine a third situation type corresponding to the scenario that does not satisfy the preset format alignment;

[0200] If the third situation type is that when the define invalid data command is issued, the starting position of the logic block size satisfies the preset format alignment, the current format type of the logic block address is determined; when the end position of the logic block size is less than the preset format alignment, based on the current format type, a first read command of the logic block address is issued according to the define invalid data command, and a corresponding third return instruction is obtained, so as to determine a third test result according to the third return instruction; when the end position of the logic block size is greater than the preset format alignment, based on the current format type, a second read command of the logic block address is issued according to the define invalid data command, and a corresponding fourth return instruction is obtained, so as to determine a fourth test result according to the fourth return instruction;

[0201] If the third situation type is that when the define invalid data command is issued, the starting position of the logical block size does not satisfy the preset format alignment, the current format type of the logical block address is determined; when the number of the logical block addresses is less than or equal to the preset format alignment, based on the current format type, the third read command of the logical block address is issued according to the define invalid data command, and the corresponding fifth return instruction is obtained so as to determine the fifth test result according to the fifth return instruction; when the number of the logical block addresses spans one of the preset format alignments, based on the current format type, the fourth read command of the logical block address is issued according to the define invalid data command, and the corresponding sixth return instruction is obtained so as to determine the sixth test result according to the sixth return instruction.

[0202] In a specific implementation manner, when the target scenario type is a scenario in which the definition invalidation data command is issued successfully and then combined with a preset management command, the test result return module 15 is specifically used to:

[0203] Determine a fourth situation type corresponding to a scenario when the command to define invalidation data is issued successfully and combined with a preset management command;

[0204] If the fourth situation type is that the disable deletion notification instruction is issued after the define invalid data command is issued successfully, then determine the current format type of the logical block address; based on the current format type, issue a fifth read command of the logical block address according to the define invalid data command, and obtain a corresponding seventh return instruction; issue a sixth read command of the logical block address according to the disable deletion notification instruction, and obtain a corresponding eighth return instruction, so as to determine a seventh test result according to the seventh return instruction and the eighth return instruction;

[0205] If the fourth situation type is that the format hard disk instruction is issued after the define invalid data command is issued successfully, then the current format type of the logical block address is determined; based on the current format type, a sixth read command of the logical block address is issued according to the define invalid data command, and a corresponding eighth return instruction is obtained; a seventh read command of the logical block address is issued according to the format hard disk instruction, and a corresponding ninth return instruction is obtained, so as to determine an eighth test result according to the eighth return instruction and the ninth return instruction;

[0206] If the fourth situation type is that the overwrite instruction is issued after the define invalid data command is issued successfully, then the current format type of the logical block address is determined; based on the current format type, the seventh read command of the logical block address is issued according to the define invalid data command, and the corresponding ninth return instruction is obtained; the eighth read command of the logical block address is issued according to the overwrite write instruction, and the corresponding tenth return instruction is obtained, so as to determine the ninth test result according to the ninth return instruction and the tenth return instruction;

[0207] If the fourth situation type is that a reset instruction and / or an unload or load instruction to a driver is issued after the define invalid data command is issued successfully, then the current format type of the logical block address is determined; based on the current format type, an eighth read command of the logical block address is issued according to the define invalid data command, and a corresponding tenth return instruction is obtained; a ninth read command of the logical block address is issued according to the reset instruction and / or the unload or load instruction to a driver, and a corresponding eleventh return instruction is obtained, so as to determine a tenth test result according to the tenth return instruction and the eleventh return instruction;

[0208] If the fourth situation type is that the server operation instruction is issued after the define invalidation data command is successfully issued, the current format type of the logical block address is determined; based on the current format type, the ninth read command of the logical block address is issued according to the define invalidation data command, and the corresponding eleventh return instruction is obtained; the tenth read command of the logical block address is issued according to the server operation instruction, and the corresponding twelfth return instruction is obtained, so as to determine the eleventh test result according to the eleventh return instruction and the twelfth return instruction.

[0209] In a specific implementation, the hard disk testing device further includes:

[0210] The traversal module is used to traverse the logical block addresses of each format type, and then trigger the step of determining the current format type of the logical block address according to the different situation types under the target scenario type to obtain test results corresponding to different format types.

[0211] Furthermore, the present application also discloses an electronic device. Figure 4 This is a structural diagram of an electronic device 20 according to an exemplary embodiment, and the content in the diagram cannot be considered as any limitation on the scope of use of the present application.

[0212] Figure 4 The present invention provides a schematic diagram of the structure of an electronic device 20 provided in an embodiment of the present application. The electronic device 20 may specifically include: at least one processor 21, at least one memory 22, a power supply 23, a communication interface 24, an input / output interface 25, and a communication bus 26. The memory 22 is used to store a computer program, which is loaded and executed by the processor 21 to implement the relevant steps in the hard disk test method disclosed in any of the aforementioned embodiments. In addition, the electronic device 20 in this embodiment may specifically be a computer.

[0213] In this embodiment, the power supply 23 is used to provide working voltage for each hardware device on the electronic device 20; the communication interface 24 can create a data transmission channel between the electronic device 20 and the external device, and the communication protocol it follows is any communication protocol that can be applied to the technical solution of the present application, and is not specifically limited here; the input and output interface 25 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs and is not specifically limited here.

[0214] In addition, the memory 22 as a carrier for resource storage may be a read-only memory, a random access memory, a disk or an optical disk, etc. The resources stored thereon may include an operating system 221, a computer program 222 and data 223, etc. The data 223 may include various data. The storage method may be temporary storage or permanent storage.

[0215] The operating system 221 is used to manage and control the hardware devices and computer program 222 on the electronic device 20, which can be Windows Server, Netware, Unix, Linux, etc. In addition to including a computer program that can be used to complete the hard disk testing method performed by the electronic device 20 disclosed in any of the aforementioned embodiments, the computer program 222 can further include a computer program that can be used to complete other specific tasks.

[0216] Furthermore, the embodiment of the present application also discloses a computer-readable storage medium, wherein the computer-readable storage medium mentioned here includes 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 magnetic disk or an optical disk, or any other form of storage medium known in the technical field. Wherein, when the computer program is executed by the processor, the aforementioned hard disk test method is implemented. For the specific steps of the method, reference can be made to the corresponding contents disclosed in the aforementioned embodiment, and no further description will be given here.

[0217] Furthermore, an embodiment of the present application also provides a computer program product, including a computer program / instruction, which implements any one of the above-mentioned hard disk testing methods when executed by a processor.

[0218] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0219] The steps of the hard disk test method or algorithm described in the embodiments disclosed herein can be implemented directly by hardware, software modules executed by a processor, or a combination of the two. The software module can 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 technical field.

[0220] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0221] The hard disk testing method, device, equipment and medium provided by the present invention are introduced in detail above. The principle and implementation mode of the present invention are explained in detail by using specific examples. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of ​​the present invention, there will be changes in the specific implementation mode and application scope. In summary, the content of this specification should not be understood as limiting the present invention.

Claims

1. A hard disk testing method, characterized in that: Applied to NVME hard disks, including: Sending a define invalidation data command in the NVME hard disk, and determining whether there is an abnormal parameter in the define invalidation data command; If the abnormal parameter exists in the define invalid data command, it is determined that the current corresponding scenario is the first scenario, and corresponding error information is returned according to different situation types corresponding to the first scenario; the situation types corresponding to the first scenario include that the number of blocks in the define invalid data command is abnormal, the start logical block address in the define invalid data command is abnormal, and the logical block size in the define invalid data command exceeds a preset range; If the abnormal parameter does not exist in the define invalidation data command, it is determined that the current corresponding scene is the second scene, and the target scene type corresponding to the second scene is determined; the target scene type includes a scene that satisfies the preset format alignment, a scene that does not satisfy the preset format alignment, and a scene when the define invalidation data command is successfully issued and combined with a preset management command, and different target scene types include different situation types; The corresponding test result is returned according to the target scenario type, so as to determine whether the define invalidation data command is issued successfully and whether the interval data in which the define invalidation data command is issued is readable based on the test result, so as to verify whether the define invalidation data command is effective.

2. The hard disk testing method according to claim 1, characterized in that: The returning corresponding error information according to different situation types corresponding to the first scenario includes: Determining a first situation type corresponding to the first scenario; If the first situation type is a situation type in which the number of blocks in the issued definition invalid data command is abnormal, returning first error information for characterizing a block count error; If the first situation type is a situation type in which there is an abnormal start logical block address in the issued define invalid data command, return second error information for characterizing an error in the logical block address range; If the first situation type is a situation type in which the logical block size in the issued define invalid data command exceeds a preset range, third error information for characterizing the logical block address range error is returned accordingly according to the format type of the logical block address.

3. The hard disk testing method according to claim 1, characterized in that: The returning corresponding test results according to the target scenario type includes: Verifying the interval data for issuing the define invalidation data command based on the target scenario type to determine whether the interval data is readable; If the interval data is readable, it is determined that the command to define invalid data is successfully issued but not effective; If the interval data is unreadable, it is determined that the define invalid data command is issued successfully and takes effect.

4. The hard disk testing method according to claim 1, characterized in that: When the target scene type is a scene that satisfies a preset format alignment, returning a corresponding test result according to the target scene type includes: Determine a second situation type corresponding to the scenario that satisfies the preset format alignment; If the second situation type is the define invalid data command issued for a single segment area, determine the current format type of the logical block address, then read the first area segment where the define invalid data command is issued based on the current format type, and obtain a corresponding first return instruction, so as to determine a first test result according to the first return instruction; If the second situation type is the define invalid data command issued for multiple overlapping areas, the current format type of the logical block address is determined, and then the second area segment where the define invalid data command is issued is read based on the current format type, and the corresponding second return instruction is obtained, so as to determine the second test result according to the second return instruction.

5. The hard disk testing method according to claim 1, characterized in that: When the target scene type is a scene that does not satisfy the preset format alignment, returning a corresponding test result according to the target scene type includes: Determine a third situation type corresponding to the scenario that does not satisfy the preset format alignment; If the third situation type is that when the define invalid data command is issued, the starting position of the logic block size satisfies the preset format alignment, the current format type of the logic block address is determined; when the end position of the logic block size is less than the preset format alignment, based on the current format type, a first read command of the logic block address is issued according to the define invalid data command, and a corresponding third return instruction is obtained, so as to determine a third test result according to the third return instruction; when the end position of the logic block size is greater than the preset format alignment, based on the current format type, a second read command of the logic block address is issued according to the define invalid data command, and a corresponding fourth return instruction is obtained, so as to determine a fourth test result according to the fourth return instruction; If the third situation type is that when the define invalid data command is issued, the starting position of the logical block size does not satisfy the preset format alignment, the current format type of the logical block address is determined; when the number of the logical block addresses is less than or equal to the preset format alignment, based on the current format type, the third read command of the logical block address is issued according to the define invalid data command, and the corresponding fifth return instruction is obtained so as to determine the fifth test result according to the fifth return instruction; when the number of the logical block addresses spans one of the preset format alignments, based on the current format type, the fourth read command of the logical block address is issued according to the define invalid data command, and the corresponding sixth return instruction is obtained so as to determine the sixth test result according to the sixth return instruction.

6. The hard disk testing method according to claim 1, characterized in that: When the target scenario type is a scenario in which the command to define invalidation data is issued successfully and combined with a preset management command, returning a corresponding test result according to the target scenario type includes: Determine a fourth situation type corresponding to a scenario when the command to define invalidation data is issued successfully and combined with a preset management command; If the fourth situation type is that the disable deletion notification instruction is issued after the define invalid data command is issued successfully, then determine the current format type of the logical block address; based on the current format type, issue a fifth read command of the logical block address according to the define invalid data command, and obtain a corresponding seventh return instruction; issue a sixth read command of the logical block address according to the disable deletion notification instruction, and obtain a corresponding eighth return instruction, so as to determine a seventh test result according to the seventh return instruction and the eighth return instruction; If the fourth situation type is that the format hard disk instruction is issued after the define invalid data command is issued successfully, then the current format type of the logical block address is determined; based on the current format type, a sixth read command of the logical block address is issued according to the define invalid data command, and a corresponding eighth return instruction is obtained; a seventh read command of the logical block address is issued according to the format hard disk instruction, and a corresponding ninth return instruction is obtained, so as to determine an eighth test result according to the eighth return instruction and the ninth return instruction; If the fourth situation type is that the overwrite instruction is issued after the define invalid data command is issued successfully, then the current format type of the logical block address is determined; based on the current format type, the seventh read command of the logical block address is issued according to the define invalid data command, and the corresponding ninth return instruction is obtained; the eighth read command of the logical block address is issued according to the overwrite write instruction, and the corresponding tenth return instruction is obtained, so as to determine the ninth test result according to the ninth return instruction and the tenth return instruction; If the fourth situation type is that a reset instruction and / or an unload or load instruction to a driver is issued after the define invalid data command is issued successfully, then the current format type of the logical block address is determined; based on the current format type, an eighth read command of the logical block address is issued according to the define invalid data command, and a corresponding tenth return instruction is obtained; a ninth read command of the logical block address is issued according to the reset instruction and / or the unload or load instruction to a driver, and a corresponding eleventh return instruction is obtained, so as to determine a tenth test result according to the tenth return instruction and the eleventh return instruction; If the fourth situation type is that the server operation instruction is issued after the define invalidation data command is successfully issued, the current format type of the logical block address is determined; based on the current format type, the ninth read command of the logical block address is issued according to the define invalidation data command, and the corresponding eleventh return instruction is obtained; the tenth read command of the logical block address is issued according to the server operation instruction, and the corresponding twelfth return instruction is obtained, so as to determine the eleventh test result according to the eleventh return instruction and the twelfth return instruction.

7. The hard disk testing method according to any one of claims 4 to 6, characterized in that: Also includes: The logical block addresses of each format type are traversed, and then the step of determining the current format type of the logical block address is triggered according to the different situation types under the target scenario type to obtain test results corresponding to different format types.

8. A hard disk testing device, characterized in that: Applied to NVME hard disks, including: A command issuing module, used for issuing a command to define invalid data in the NVME hard disk; An abnormal parameter judgment module is used to judge whether there are abnormal parameters in the definition failure data command; an error information returning module, for determining that the current corresponding scenario is a first scenario if the abnormal parameter exists in the define invalid data command, and returning corresponding error information according to different situation types corresponding to the first scenario; the situation types corresponding to the first scenario include a block number abnormality in the define invalid data command, a start logical block address abnormality in the define invalid data command, and a logical block size in the define invalid data command exceeding a preset range; A scenario type judgment module, configured to determine that the currently corresponding scenario is a second scenario if the abnormal parameter does not exist in the define invalidation data command, and to judge the target scenario type corresponding to the second scenario; the target scenario types include scenarios that meet the preset format alignment, scenarios that do not meet the preset format alignment, and scenarios when the define invalidation data command is successfully issued and combined with a preset management command, and different target scenario types include different situation types; A test result returning module is used to return corresponding test results according to the target scenario type, so as to judge whether the define invalidation data command is issued successfully and whether the interval data for issuing the define invalidation data command is readable based on the test results, so as to verify whether the define invalidation data command is effective.

9. An electronic device, characterized in that: The electronic device comprises a processor and a memory; wherein the memory is used to store a computer program, and the computer program is loaded and executed by the processor to implement the hard disk testing method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: Used to store computer programs; wherein the computer program, when executed by a processor, implements the hard disk testing method as claimed in any one of claims 1 to 7.