Hard Disk Testing Method, Device, Electronic Device, and Storage Medium
By dividing the hard disk space into multiple partitions and performing alignment and non-alignment consistency testing in it, the problem of inefficiency of traditional testing methods is solved, and faster and more efficient hard disk testing is achieved.
Patent Information
- Application Number
- CN202211337030.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-28
- Publication Date
- 2025-06-10
- Estimated Expiration
- 2042-10-28
AI Technical Summary
Traditional hard disk testing methods require 49-52 hours each in alignment consistency and non-alignment consistency tests, resulting in extremely low testing efficiency and cannot intuitively see the test situation when the alignment and non-alignment run on a hard disk at the same time.
By dividing the hard disk space of the hard disk to be tested into a first partition, a second partition and a third partition, it is used to generate hash values, perform alignment consistency testing and non-alignment consistency testing respectively. Before testing, a first hash value is generated in the first partition, and aligned and non-aligned data blocks are written to the second partition and the third partition for testing. After testing, a second hash value is generated in the first partition to judge the test results.
It greatly shortens the test time, improves the testing efficiency, and can intuitively see the data consistency and disk body impact when aligned and non-aligned are run on a hard disk at the same time.
Smart Images

Figure CN115662489B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and in particular, to a hard disk testing method, a hard disk testing device, an electronic device, and a computer-readable storage medium. Background Art
[0002] Generally, servers use a large number of solid-state drives to store and access data. Solid-state drives include storage units with SLC (Single-Level Cell) particles or MLC (Multi-Level Cell) particles. However, both SLC particles and MLC particles belong to NAND (computer flash memory device) flash memory storage units. The sector of this kind of hard disk is 4K. According to the current NTFS (New Technology File System) specification, the sector position of the starting cluster in the NTFS format is 2M, that is, the 2048K position, which can be divided evenly by 4K, and there is undoubtedly no waste. In the era of Win7, the sector position of the starting cluster in the NTFS format is 1M, that is, the 1024K position, which can also be divided evenly by 4K and there is no waste. This is called the alignment situation. However, there is a situation where the data block cannot be fully occupied or there is a waste of the solid-state drive cluster space, that is, it cannot be divided evenly by 4K. This is called the non-alignment situation.
[0003] To ensure that the integrity of data is of the highest priority, it is necessary to consider Data Integrity in both the alignment situation and the non-alignment situation. However, the traditional testing method tests alignment consistency and non-alignment consistency separately. Each of these two tests requires 49 - 52h (hours), and the total testing time requires more than 100h. The testing efficiency is extremely low, and it is impossible to intuitively see the testing situation when alignment and non-alignment are running simultaneously in a hard disk. Summary of the Invention
[0004] In view of the above problems, embodiments of the present invention are proposed to provide a hard disk testing method that overcomes the above problems or at least partially solves the above problems.
[0005] Embodiments of the present invention also provide a hard disk testing device, an electronic device, and a storage medium to ensure the implementation of the above method.
[0006] To solve the above problems, embodiments of the present invention disclose a hard disk testing method, and the method includes:
[0007] Dividing the hard disk space of the hard disk to be tested into a first partition, a second partition, and a third partition;
[0008] Before the alignment consistency test and the non-alignment consistency test, generate a first hash value for the file system in the first partition;
[0009] Write aligned data blocks to the second partition to perform the alignment consistency test, and write unaligned data blocks to the third partition to perform the non-alignment consistency test;
[0010] After completing the alignment consistency test and the non-alignment consistency test, generate a second hash value for the file system in the first partition, and obtain a first test result for the alignment consistency test and a second test result for the non-alignment consistency test;
[0011] According to the first hash value and the second hash value, determine whether the alignment consistency test and the non-alignment consistency test have damaged the file system, and according to the first test result, determine whether there is data inconsistency in the alignment consistency test, and according to the second test result, determine whether there is data inconsistency in the non-alignment consistency test.
[0012] Optionally, the partitioning of the hard disk space of the hard disk to be tested into a first partition, a second partition, and a third partition includes:
[0013] Query the capacity size of the hard disk space of the hard disk to be tested;
[0014] According to the capacity size, partition the hard disk space of the hard disk to be tested into a first partition, a second partition, and a third partition; wherein, the first partition is smaller than the second partition and the third partition, and the second partition and the third partition are of the same size.
[0015] Optionally, the aligned data blocks include aligned data blocks of different sizes; the writing of the aligned data blocks to the second partition to perform the alignment consistency test includes:
[0016] Write the aligned data blocks of different sizes to the second partition in ascending order, and configure different first queue depths for testing each time an aligned data block is written; wherein, the sizes of the aligned data blocks include 4K, 8K, 16K, 32K, 64K, 128K, 256K, and the first queue depths include 1, 2, 4, 8, 16, 32, 64.
[0017] Optionally, the unaligned data blocks include unaligned data blocks of different sizes; the writing of the unaligned data blocks to the third partition to perform the non-alignment consistency test includes:
[0018] Write the misaligned data blocks of different sizes to the third partition in ascending order, and configure different second queue depths for testing each time a misaligned data block is written; wherein, the sizes of the misaligned data blocks include 512b, 2K, 3K, 17K, 65K, 129K, 257K, and the second queue depths include 1, 2, 4, 8, 16, 32, 64.
[0019] Optionally, the first test result is the first running result log for the alignment consistency test; judging whether there is a data inconsistency in the alignment consistency test according to the first test result includes:
[0020] Check whether there is an error field in the first running result log;
[0021] If there is an error field in the first running result log, it is judged that there is a data inconsistency when the same aligned data block and different first queue depths;
[0022] If there is no error field in the first running result log, it is judged that there is no data inconsistency when the same aligned data block and different first queue depths.
[0023] Optionally, the second test result is the second running result log for the misalignment consistency test; judging whether there is a data inconsistency in the misalignment consistency test according to the second test result includes:
[0024] Check whether there is an error field in the second running result log;
[0025] If there is an error field in the second running result log, it is judged that there is a data inconsistency when the same misaligned data block and different second queue depths;
[0026] If there is no error field in the second running result log, it is judged that there is no data inconsistency when the same misaligned data block and different second queue depths.
[0027] Optionally, the method further includes:
[0028] Adopt the first test result and the second test result to comprehensively analyze the influence of the alignment consistency test and the misalignment consistency test on the disk body of the hard disk to be tested.
[0029] Optionally, judging whether the alignment consistency test and the misalignment consistency test damage the file system according to the first hash value and the second hash value includes:
[0030] Compare the first hash value and the second hash value;
[0031] If the first hash value is the same as the second hash value, it is determined that the aligned consistency test and the misaligned consistency test have not damaged the file system;
[0032] If the first hash value is not the same as the second hash value, it is determined that the aligned consistency test and the misaligned consistency test have damaged the file system.
[0033] Optionally, before partitioning the hard disk space of the hard disk to be tested into a first partition, a second partition, and a third partition, the method further includes:
[0034] Format the hard disk to be tested.
[0035] An embodiment of the present invention also discloses a hard disk testing device, the device includes:
[0036] A partition division module, configured to partition the hard disk space of the hard disk to be tested into a first partition, a second partition, and a third partition;
[0037] A first hash value generation module, configured to generate a first hash value for the file system in the first partition before the aligned consistency test and the misaligned consistency test;
[0038] A test module, configured to write aligned data blocks to the second partition to perform the aligned consistency test, and write misaligned data blocks to the third partition to perform the misaligned consistency test;
[0039] A second hash value generation module, configured to generate a second hash value for the file system in the first partition after completing the aligned consistency test and the misaligned consistency test, and obtain a first test result for the aligned consistency test and a second test result for the misaligned consistency test;
[0040] A judgment module, configured to determine whether the aligned consistency test and the misaligned consistency test have damaged the file system according to the first hash value and the second hash value, determine whether there is data inconsistency in the aligned consistency test according to the first test result, and determine whether there is data inconsistency in the misaligned consistency test according to the second test result.
[0041] Optionally, the partition division module includes:
[0042] A capacity size query sub-module, configured to query the capacity size of the hard disk space of the hard disk to be tested;
[0043] A partition sub-module, configured to divide the hard disk space of the hard disk to be tested into a first partition, a second partition, and a third partition according to the capacity size; wherein, the first partition is smaller than the second partition and the third partition, and the second partition and the third partition are of the same size.
[0044] Optionally, the aligned data blocks include aligned data blocks of different sizes; the test module includes:
[0045] An alignment consistency test sub-module, configured to sequentially write the different-sized aligned data blocks into the second partition in ascending order, and configure different first queue depths for testing each time an aligned data block is written; wherein, the sizes of the aligned data blocks include 4K, 8K, 16K, 32K, 64K, 128K, 256K, and the first queue depths include 1, 2, 4, 8, 16, 32, 64.
[0046] Optionally, the unaligned data blocks include unaligned data blocks of different sizes; the test module includes:
[0047] An unalignment consistency test sub-module, configured to sequentially write the different-sized unaligned data blocks into the third partition in ascending order, and configure different second queue depths for testing each time an unaligned data block is written; wherein, the sizes of the unaligned data blocks include 512b, 2K, 3K, 17K, 65K, 129K, 257K, and the second queue depths include 1, 2, 4, 8, 16, 32, 64.
[0048] Optionally, the first test result is the first operation result log for the alignment consistency test; the judgment module includes:
[0049] A first check sub-module, configured to check whether an error field appears in the first operation result log;
[0050] A first judgment sub-module, configured to, if an error field appears in the first operation result log, judge that data inconsistency occurs at the same aligned data block and different first queue depths;
[0051] A second judgment sub-module, configured to, if no error field appears in the first operation result log, judge that no data inconsistency occurs at the same aligned data block and different first queue depths.
[0052] Optionally, the second test result is the second operation result log for the unalignment consistency test; the judgment module includes:
[0053] A second check sub-module, configured to check whether an error field appears in the second operation result log;
[0054] A third judgment sub-module, configured to, if an error field appears in the second operation result log, determine that a data inconsistency phenomenon occurs at the same misaligned data block and different second queue depths;
[0055] A fourth judgment sub-module, configured to, if no error field appears in the second operation result log, determine that no data inconsistency phenomenon occurs at the same misaligned data block and different second queue depths.
[0056] Optionally, the device further includes:
[0057] A comprehensive analysis module, configured to comprehensively analyze the impact of the alignment consistency test and the misalignment consistency test on the disk body of the hard disk to be tested by using the first test result and the second test result.
[0058] Optionally, the judgment module includes:
[0059] A comparison sub-module, configured to compare the first hash value and the second hash value;
[0060] A fifth judgment sub-module, configured to, if the first hash value and the second hash value are consistent, determine that the alignment consistency test and the misalignment consistency test do not damage the file system;
[0061] A sixth judgment sub-module, configured to, if the first hash value and the second hash value are inconsistent, determine that the alignment consistency test and the misalignment consistency test damage the file system.
[0062] Optionally, before dividing the hard disk space of the hard disk to be tested into a first partition, a second partition, and a third partition, the device further includes:
[0063] A formatting module, configured to format the hard disk to be tested.
[0064] An embodiment of the present invention further discloses an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory complete communication with each other through the communication bus;
[0065] The memory is used for storing a computer program;
[0066] When the processor is configured to execute the program stored in the memory, the hard disk test method as described in the embodiment of the present invention is implemented.
[0067] Embodiments of the present invention also disclose one or more computer-readable media, on which instructions are stored, which, when executed by one or more processors, cause the processors to execute the hard disk test method as described in the embodiments of the present invention.
[0068] Compared with the prior art, the embodiments of the present invention have the following advantages:
[0069] In the embodiments of the present invention, by dividing the hard disk space of the hard disk to be tested into a first partition, a second partition, and a third partition, before the alignment consistency test and the non-alignment consistency test, a first hash value for the file system is generated in the first partition, and then aligned data blocks are written to the second partition to perform the alignment consistency test, and non-aligned data blocks are written to the third partition to perform the non-alignment consistency test. After the alignment consistency test and the non-alignment consistency test are completed, a second hash value for the file system is generated in the first partition, and a first test result for the alignment consistency test and a second test result for the non-alignment consistency test are obtained. According to the first hash value and the second hash value, it is determined whether the alignment consistency test and the non-alignment consistency test have damaged the file system, and according to the first test result, it is determined whether data inconsistency occurs in the alignment consistency test, and according to the second test result, it is determined whether data inconsistency occurs in the non-alignment consistency test. In the embodiments of the present invention, by performing the alignment consistency test and the non-alignment consistency test in parallel in different partitions of the same hard disk, the test time is greatly shortened, the test efficiency is greatly improved, and the data consistency when the alignment consistency and the non-alignment consistency operate simultaneously in the actual application scenario of the hard disk is fully considered. BRIEF DESCRIPTION OF THE DRAWINGS
[0070] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0071] Figure 1 is a flowchart of the steps of a hard disk test method provided by an embodiment of the present invention;
[0072] Figure 2 is a flowchart of the steps of another hard disk test method provided by an embodiment of the present invention;
[0073] Figure 3 is a hard disk test flowchart provided by an embodiment of the present invention;
[0074] Figure 4 is a structural block diagram of a hard disk test device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0075] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0076] Refer to Figure 1 , which shows a step flowchart of a hard disk test method provided by an embodiment of the present invention. The method may specifically include the following steps:
[0077] Step 101, divide the hard disk space of the hard disk to be tested into a first partition, a second partition, and a third partition.
[0078] In the embodiment of the present invention, the hard disk to be tested may be an SSD (Solid State Drives, solid state drive). Among them, an SSD hard disk is a hard disk made of a solid-state electronic storage chip array, which is composed of a control unit and a storage unit. Its interface specifications, definitions, functions, and usage methods are exactly the same as those of traditional hard disks, and its product form and size are also exactly the same as those of traditional hard disks, but its I / O performance is greatly improved compared with traditional hard disks.
[0079] In the embodiment of the present invention, a certain SSD hard disk may be used as the hard disk to be tested, and then the corresponding shell script may be edited through liunx instructions to perform both aligned consistency testing and unaligned consistency testing on the hard disk to be tested. Before the aligned consistency testing and unaligned consistency testing, the hard disk space of the hard disk to be tested may be reasonably divided into three partitions, namely a first partition, a second partition, and a third partition.
[0080] In a specific implementation, the mkpart command may be used to divide the hard disk space of the hard disk to be tested into three partitions. Exemplarily, commands such as "mkpart 1st 0% 20%", "mkpart 2nd 20% 60%", and "mkpart 3rd 60% 100%" may be used to divide the hard disk space of the hard disk to be tested into three partitions, and the ratio of the three partitions may be 2:4:4.
[0081] Step 102, before the aligned consistency testing and unaligned consistency testing, generate a first hash value for the file system in the first partition.
[0082] In the embodiments of the present invention, innovatively, the alignment consistency test and the non-alignment consistency test are performed in parallel in different partitions of the same hard disk, opening a new chapter in the field of consistency testing. However, since it is impossible to rule out whether the parallel testing process will damage the file system, and for the R & D test specifications, the situation of file system damage is not allowed.
[0083] Therefore, before the alignment consistency test and the non-alignment consistency test in the embodiments of the present invention, a first hash value for the file system is generated in the first partition to verify whether the parallel testing process damages the file system.
[0084] In a specific implementation, the fio tool can be used to write verification data blocks in the first partition, thereby mounting the first partition to obtain the first hash value for the file system, and then unmounting it. Among them, the verification data block can be data of a preset size, such as 10 GB of data, and the first hash value can be an md5 value.
[0085] Among them, the fio tool can be used to perform stress testing and verification on the hard disk. It is a tool that can generate many threads or processes and execute specific types of I / O operations specified by the user. The main use of the fio tool is to write and simulate job files that match the I / O load.
[0086] Among them, md5 (Message-Digest Algorithm 5) is a hash function in the field of computer security, used to ensure the integrity and consistency of information transmission.
[0087] Step 103, write aligned data blocks to the second partition to perform the alignment consistency test, and write misaligned data blocks to the third partition to perform the non-alignment consistency test.
[0088] In the embodiments of the present invention, the hash values before and after the consistency test for the file system are generated using the first partition to determine whether the consistency test damages the file system, and then the other two partitions, namely the second partition and the third partition, are used to test the mixed writing of data in the aligned case and the non-aligned case respectively.
[0089] Specifically, the second partition and the third partition can be used for parallel testing of the aligned case and the non-aligned case. Among them, the second partition can be used to perform the alignment consistency test, and the third partition can be used to perform the non-alignment consistency test. The alignment consistency test can be achieved by writing aligned data blocks to the second partition, and the non-alignment consistency test can be achieved by writing misaligned data blocks to the third partition.
[0090] It should be noted that the alignment consistency test and the non-alignment consistency test in the embodiments of the present invention are run simultaneously.
[0091] Step 104, after completing the aligned consistency test and the unaligned consistency test, generate a second hash value for the file system in the first partition, and obtain a first test result for the aligned consistency test and a second test result for the unaligned consistency test.
[0092] In the embodiment of the present invention, after completing the consistency test, that is, after completing the aligned consistency test and the unaligned consistency test, a second hash value for the file system can be generated in the first partition, and a first test result for the aligned consistency test and a second test result for the unaligned consistency test can be obtained. Among them, the second hash value can be an md5 value, and both the first test result and the second test result can include the smart log, system message, dmesg information, and BMC information of the hard disk to be tested.
[0093] Step 105, according to the first hash value and the second hash value, determine whether the aligned consistency test and the unaligned consistency test have damaged the file system, and according to the first test result, determine whether there is data inconsistency in the aligned consistency test, and according to the second test result, determine whether there is data inconsistency in the unaligned consistency test.
[0094] In the embodiment of the present invention, both the first hash value and the second hash value are generated for the file system in the first partition. The first hash value is generated before the consistency test, and the second hash value is generated after the consistency test. Through the first hash value and the second hash value, it can be determined whether the consistency test has damaged the file system, that is, it can be determined whether the aligned consistency test and the unaligned consistency test have damaged the file system.
[0095] In addition, the embodiment of the present invention can also determine whether there is data inconsistency in the consistency test. Specifically, a first test result can be generated during the aligned consistency test, so it can be determined whether there is data inconsistency in the aligned consistency test according to the first test result. Similarly, a second test result can be generated during the unaligned consistency test, so it can be determined whether there is data inconsistency in the unaligned consistency test according to the second test result.
[0096] In summary, in the embodiment of the present invention, the hard disk space of the hard disk to be tested is divided into a first partition, a second partition, and a third partition. Before the alignment consistency test and the non-alignment consistency test, a first hash value for the file system is generated in the first partition, and then aligned data blocks are written to the second partition to perform the alignment consistency test, and non-aligned data blocks are written to the third partition to perform the non-alignment consistency test. After the alignment consistency test and the non-alignment consistency test are completed, a second hash value for the file system is generated in the first partition, and a first test result for the alignment consistency test and a second test result for the non-alignment consistency test are obtained. According to the first hash value and the second hash value, it is determined whether the alignment consistency test and the non-alignment consistency test damage the file system, and according to the first test result, it is determined whether data inconsistency occurs in the alignment consistency test, and according to the second test result, it is determined whether data inconsistency occurs in the non-alignment consistency test. In the embodiment of the present invention, by performing the alignment consistency test and the non-alignment consistency test in parallel in different partitions of the same hard disk, the test time is greatly shortened, the test efficiency is greatly improved, and the data consistency when the alignment consistency and the non-alignment consistency run simultaneously in the actual application scenario of the hard disk is fully considered.
[0097] Referring to Figure 2 , the flowchart of steps of another hard disk test method provided by the embodiment of the present invention is shown, and the method may specifically include the following steps:
[0098] Step 201, format the hard disk to be tested.
[0099] In the embodiment of the present invention, the hard disk to be tested can be formatted first to facilitate subsequent partitioning of the hard disk space of the hard disk to be tested. Specifically, the format command can be used to format the hard disk to be tested. It should be noted that formatting the hard disk to be tested in the embodiment of the present invention is to clean the log data in the hard disk to be tested to avoid affecting the test results.
[0100] Step 202, divide the hard disk space of the hard disk to be tested into a first partition, a second partition, and a third partition.
[0101] In the embodiment of the present invention, the hard disk to be tested can be an SSD hard disk. A certain SSD hard disk can be used as the hard disk to be tested, and then the corresponding shell script can be edited through the liunx command to perform the alignment consistency test and the non-alignment consistency test on the hard disk to be tested simultaneously. Before the alignment consistency test and the non-alignment consistency test, the hard disk space of the hard disk to be tested can be reasonably divided into three partitions, namely the first partition, the second partition, and the third partition.
[0102] In a specific implementation, the mkpart command can be used to divide the hard disk space of the hard disk to be tested into three partitions. Exemplarily, commands such as "mkpart 1st 0% 20%", "mkpart 2nd 20% 60%", and "mkpart 3rd 60% 100%" can be used to divide the hard disk space of the hard disk to be tested into three partitions, and the ratio of the three partitions can be 2:4:4.
[0103] In an alternative embodiment of the present invention, step 202 may include the following sub-steps:
[0104] Sub-step S11, query the capacity size of the hard disk space of the hard disk to be tested;
[0105] Sub-step S12, according to the capacity size, divide the hard disk space of the hard disk to be tested into a first partition, a second partition, and a third partition; wherein, the first partition is smaller than the second partition and the third partition, and the second partition and the third partition are of the same size.
[0106] In the embodiment of the present invention, the capacity size of the hard disk space of the hard disk to be tested can be queried first, and then according to the queried capacity size, in accordance with a preset ratio, such as a ratio of 2:4:4, the hard disk space of the hard disk to be tested is divided into three partitions.
[0107] Since the first partition is used to verify whether the consistency test damages the file system, the smallest partition can be used as the first partition, that is, the first partition can be smaller than the second partition and the third partition. Since the second partition and the third partition are used to parallel test the aligned and non-aligned situations, two partitions of the same size can be used as the second partition and the third partition respectively, that is, the second partition and the third partition are of the same size.
[0108] Step 203, before the aligned consistency test and the non-aligned consistency test, generate a first hash value for the file system in the first partition.
[0109] In the embodiment of the present invention, before the aligned consistency test and the non-aligned consistency test, a first hash value for the file system is generated in the first partition to verify whether the parallel test process damages the file system. Specifically, the fio tool can be used to write verification data blocks in the first partition, thereby mounting the first partition to obtain the first hash value for the file system, and then unmounting. Among them, the verification data block can be data of a preset size, such as 10 GB of data, and the first hash value can be an md5 value.
[0110] Step 204, write aligned data blocks to the second partition to perform the aligned consistency test, and write non-aligned data blocks to the third partition to perform the non-aligned consistency test.
[0111] In an embodiment of the present invention, the second partition and the third partition may be used to concurrently test the aligned and unaligned cases. The second partition may be used to perform the aligned consistency test, and the third partition may be used to perform the unaligned consistency test. The aligned consistency test may be implemented by writing aligned data blocks to the second partition, and the unaligned consistency test may be implemented by writing unaligned data blocks to the third partition.
[0112] It should be noted that the aligned consistency test and the unaligned consistency test in the embodiment of the present invention are run simultaneously.
[0113] In an optional embodiment of the present invention, the aligned data blocks include aligned data blocks of different sizes; step 204 may include the following sub-steps:
[0114] Sub-step S21, in ascending order, write the aligned data blocks of different sizes to the second partition in sequence, and configure different first queue depths for testing each time an aligned data block is written; wherein, the sizes of the aligned data blocks include 4K, 8K, 16K, 32K, 64K, 128K, 256K, and the first queue depths include 1, 2, 4, 8, 16, 32, 64.
[0115] In an embodiment of the present invention, the aligned data blocks may include aligned data blocks of different sizes. The aligned data blocks are data blocks that can be divided evenly by 4K. Exemplarily, the sizes of the aligned data blocks may include 4K, 8K, 16K, 32K, 64K, 128K, 256K.
[0116] It should be noted that each aligned data block may be a kind of data unit. Exemplarily, for an aligned data block of 4K size, its data unit is 4K; for an aligned data block of 8K size, its data unit is 8K; for an aligned data block of 16K size, its data unit is 16K; for an aligned data block of 32K size, its data unit is 32K; for an aligned data block of 64K size, its data unit is 64K; for an aligned data block of 128K size, its data unit is 128K; for an aligned data block of 256K size, its data unit is 256K.
[0117] In the aligned consistency test, the aligned data blocks of 4K, 8K, 16K, 32K, 64K, 128K, and 256K sizes may be written to the second partition in sequence in ascending order.
[0118] Data consistency means, for the same data block, using different QDs (Queue Depth, the maximum number of batch instructions issued by the disk controller), to verify whether there is data inconsistency, where QD is the queue depth.
[0119] Therefore, when writing an aligned data block each time, different first queue depths QD can be configured. 1 Perform tests. Among them, the first queue depth QD 1 can include 1, 2, 4, 8, 16, 32, 64.
[0120] It should be noted that for each aligned data block when configuring each first queue depth QD 1 for testing, the required test time is 0.5h (hours).
[0121] As an example, for the alignment consistency test, a 4K-sized aligned data block A can be written in the second partition first, and the first queue depth QD 1 is respectively configured as 1, 2, 4, 8, 16, 32, 64, thereby obtaining the first test result A for the aligned data block A, and the total test time is 3.5h; then an 8K-sized aligned data block B is written in the second partition, and the first queue depth QD 1 is respectively configured as 1, 2, 4, 8, 16, 32, 64, thereby obtaining the first test result B for the aligned data block B, and the total test time is 3.5h; then a 16K-sized aligned data block C is written in the second partition, and the first queue depth QD 1 is respectively configured as 1, 2, 4, 8, 16, 32, 64, thereby obtaining the first test result C for the aligned data block C, and the total test time is 3.5h; then a 32K-sized aligned data block D is written in the second partition, and the first queue depth QD 1 is respectively configured as 1, 2, 4, 8, 16, 32, 64, thereby obtaining the first test result D for the aligned data block D, and the total test time is 3.5h; then a 64K-sized aligned data block E is written in the second partition, and the first queue depth QD 1 is respectively configured as 1, 2, 4, 8, 16, 32, 64, thereby obtaining the first test result E for the aligned data block E, and the total test time is 3.5h; then a 128K-sized aligned data block F is written in the second partition, and the first queue depth QD 1 is respectively configured as 1, 2, 4, 8, 16, 32, 64, thereby obtaining the first test result F for the aligned data block F, and the total test time is 3.5h; finally, a 256K-sized aligned data block G is written in the second partition, and the first queue depth QD 1 is respectively configured as 1, 2, 4, 8, 16, 32, 64, thereby obtaining the first test result G for the aligned data block G, and the total test time is 3.5h. The above example is only used to help those skilled in the art better understand the embodiments of the present invention, and the present invention makes no limitations thereto.
[0122] In an alternative embodiment of the present invention, the misaligned data blocks include misaligned data blocks of different sizes; step 204 may include the following sub-steps:
[0123] Sub-step S31, write the misaligned data blocks of different sizes to the third partition in ascending order, and configure different second queue depths for testing each time a misaligned data block is written; wherein, the sizes of the misaligned data blocks include 512b, 2K, 3K, 17K, 65K, 129K, 257K, and the second queue depths include 1, 2, 4, 8, 16, 32, 64.
[0124] In an embodiment of the present invention, the misaligned data blocks may include misaligned data blocks of different sizes. A misaligned data block is a data block that cannot be divisible by 4K. Exemplarily, the sizes of the misaligned data blocks may include 512b, 2K, 3K, 17K, 65K, 129K, 257K.
[0125] It should be noted that each misaligned data block may be a kind of data unit. Exemplarily, for a misaligned data block of 512b size, its data unit is 512b; for a misaligned data block of 2K size, its data unit is 2K; for a misaligned data block of 3K size, its data unit is 3K; for a misaligned data block of 17K size, its data unit is 17K; for a misaligned data block of 65K size, its data unit is 65K; for a misaligned data block of 129K size, its data unit is 129K; for a misaligned data block of 257K size, its data unit is 257K.
[0126] In the misaligned consistency test, misaligned data blocks of 512b, 2K, 3K, 17K, 65K, 129K, 257K sizes may be written to the third partition in ascending order.
[0127] Data consistency means verifying whether there is data inconsistency for the same data block using different QDs, where QD is the queue depth.
[0128] Therefore, each time a misaligned data block is written, different second queue depths QD 2 can be configured for testing. Among them, the second queue depth QD 2 may include 1, 2, 4, 8, 16, 32, 64.
[0129] It should be noted that when each misaligned data block is configured with each second queue depth QD 2 for testing, the required test time is 0.5h.
[0130] As another example, for the misaligned consistency test, a misaligned data block H of 512b in size can be written in the third partition first, and the second queue depth QD 2 is configured to be 1, 2, 4, 8, 16, 32, 64 respectively, thereby obtaining the second test result H for the misaligned data block H. The total test time is 3.5h. Then, a misaligned data block I of 2K in size is written in the third partition, and the second queue depth QD 2 is configured to be 1, 2, 4, 8, 16, 32, 64 respectively, thereby obtaining the second test result I for the misaligned data block I. The total test time is 3.5h. Then, a misaligned data block J of 3K in size is written in the third partition, and the second queue depth QD 2 is configured to be 1, 2, 4, 8, 16, 32, 64 respectively, thereby obtaining the second test result J for the misaligned data block J. The total test time is 3.5h. Then, a misaligned data block K of 17K in size is written in the third partition, and the second queue depth QD 2 is configured to be 1, 2, 4, 8, 16, 32, 64 respectively, thereby obtaining the second test result K for the misaligned data block K. Then, a misaligned data block L of 65K in size is written in the third partition, and the second queue depth QD 2 is configured to be 1, 2, 4, 8, 16, 32, 64 respectively, thereby obtaining the second test result L for the misaligned data block L. The total test time is 3.5h. Then, a misaligned data block M of 129K in size is written in the third partition, and the second queue depth QD 2 is configured to be 1, 2, 4, 8, 16, 32, 64 respectively, thereby obtaining the second test result M for the misaligned data block M. The total test time is 3.5h. Finally, a misaligned data block N of 257K in size is written in the third partition, and the second queue depth QD 2 is configured to be 1, 2, 4, 8, 16, 32, 64 respectively, thereby obtaining the second test result N for the misaligned data block N. The total test time is 3.5h. The above example is only used to help those skilled in the art better understand the embodiments of the present invention, and the present invention makes no limitation thereto.
[0131] Step 205, after completing the aligned consistency test and the misaligned consistency test, generate a second hash value for the file system in the first partition, and obtain the first test result for the aligned consistency test and the second test result for the misaligned consistency test.
[0132] In an embodiment of the present invention, after the consistency test is completed, that is, after the aligned consistency test and the unaligned consistency test are completed, a second hash value for the file system can be generated in the first partition, and a first test result for the aligned consistency test and a second test result for the unaligned consistency test can be obtained. Among them, the second hash value can be an md5 value, and both the first test result and the second test result can include the smart log, system message, dmesg information, and BMC information of the hard disk to be tested.
[0133] Step 206, according to the first hash value and the second hash value, determine whether the aligned consistency test and the unaligned consistency test have damaged the file system, and according to the first test result, determine whether there is data inconsistency in the aligned consistency test, and according to the second test result, determine whether there is data inconsistency in the unaligned consistency test, and use the first test result and the second test result to comprehensively analyze the impact of the aligned consistency test and the unaligned consistency test on the disk body of the hard disk to be tested.
[0134] In an embodiment of the present invention, both the first hash value and the second hash value are generated for the file system in the first partition. The first hash value is generated before the consistency test, and the second hash value is generated after the consistency test. Through the first hash value and the second hash value, it can be determined whether the consistency test has damaged the file system, that is, it can be determined whether the aligned consistency test and the unaligned consistency test have damaged the file system.
[0135] In addition, the embodiment of the present invention can also determine whether there is data inconsistency in the consistency test. Specifically, a first test result can be generated during the aligned consistency test, so it can be determined whether there is data inconsistency in the aligned consistency test according to the first test result. Similarly, a second test result can be generated during the unaligned consistency test, so it can be determined whether there is data inconsistency in the unaligned consistency test according to the second test result.
[0136] In addition, the test hard disk may affect the disk body. Since the embodiment of the present invention performs the aligned consistency test and the unaligned consistency test in parallel in different partitions of the same hard disk, the first test result and the second test result can be used to comprehensively analyze the impact of the aligned consistency test and the unaligned consistency test on the disk body of the hard disk to be tested.
[0137] In a specific implementation, the first test result is the first running result log for the alignment consistency test, and the second test result is the second running result log for the non-alignment consistency test. It is possible to check whether there are abnormal logs in the first running result log and the second running result log. If there are abnormal logs, then the R & D personnel can perform log analysis to find out the impact of the consistency test on the disk body of the hard disk under test.
[0138] In an alternative embodiment of the present invention, the first test result is the first running result log for the alignment consistency test; step 206 may include the following sub-steps:
[0139] Sub-step S41, check whether there is an error field in the first running result log;
[0140] Sub-step S42, if there is an error field in the first running result log, then determine that there is a data inconsistency phenomenon when in the same aligned data block and different first queue depths;
[0141] Sub-step S43, if there is no error field in the first running result log, then determine that there is no data inconsistency phenomenon when in the same aligned data block and different first queue depths.
[0142] In an embodiment of the present invention, the first test result may be the first running result log for the alignment consistency test. The first running result log may specifically include the smart log, system message, dmesg information, and BMC information of the hard disk under test.
[0143] In a specific implementation, it is possible to check whether there is an error field in the first running result log. The error field may be an io error. If the error field io error appears in the first running result log, then it can be determined that there is a data inconsistency phenomenon when in the same aligned data block and different first queue depths; if the error field io error does not appear in the first running result log, then it can be determined that there is no data inconsistency phenomenon when in the same aligned data block and different first queue depths.
[0144] As an example, aligned data blocks of sizes 4K, 8K, 16K, 32K, 64K, 128K, and 256K are sequentially written in the second partition, and the first running result logs A to G are sequentially obtained. Assume that the error field io error does not appear in the first running result logs A, C, D, E, and F. This shows that there is no data inconsistency phenomenon for the aligned data block A at different first queue depths QD 1 and there is no data inconsistency phenomenon for the aligned data block C at different first queue depths QD 1There is no data inconsistency, and aligned data block D at different first queue depths QD 1 There is no data inconsistency, and aligned data block E at different first queue depths QD 1 There is no data inconsistency, and aligned data block F at different first queue depths QD 1 There is no data inconsistency, which further indicates that the indicators of 4K, 16K, 32K, 64K, and 128K pass. However, error fields "io error" appear in the first run result logs B and G, which indicates that aligned data block B at different first queue depths QD 1 There is data inconsistency, and aligned data block G at different first queue depths QD 1 There is data inconsistency, which further indicates that the indicators of 8K and 256K do not pass. The above examples are only used to help those skilled in the art better understand the embodiments of the present invention, and the present invention makes no limitations in this regard.
[0145] In an alternative embodiment of the present invention, the second test result is the second run result log for the misalignment consistency test; step 206 may include the following sub-steps:
[0146] Sub-step S51, checking whether an error field appears in the second run result log;
[0147] Sub-step S52, if an error field appears in the second run result log, then determining that there is data inconsistency when the same misaligned data block is at different second queue depths;
[0148] Sub-step S53, if no error field appears in the second run result log, then determining that there is no data inconsistency when the same misaligned data block is at different second queue depths.
[0149] In the embodiments of the present invention, the second test result may be the second run result log for the misalignment consistency test. The second run result log may specifically include the smart log, system message, dmesg information, and BMC information of the hard disk to be tested.
[0150] In a specific implementation, it may be checked whether an error field appears in the second run result log. The error field may be "io error". If the error field "io error" appears in the second run result log, then it can be determined that there is data inconsistency when the same misaligned data block is at different second queue depths; if the error field "io error" does not appear in the second run result log, then it can be determined that there is no data inconsistency when the same misaligned data block is at different second queue depths.
[0151] As another example, non-aligned data blocks of sizes 512b, 2K, 3K, 17K, 65K, 129K, and 257K are successively written into the third partition, and the second operation result logs H to N are obtained successively. Assuming that the error field "io error" does not appear in the second operation result logs I, J, K, and L, this indicates that there is no data inconsistency for the non-aligned data block I at different second queue depths QD 2 and there is no data inconsistency for the non-aligned data block J at different second queue depths QD 2 and there is no data inconsistency for the non-aligned data block K at different second queue depths QD 2 and there is no data inconsistency for the non-aligned data block L at different second queue depths QD 2 and further indicates that the indicators of 2K, 3K, 17K, and 65K pass. However, the error field "io error" appears in the second operation result logs H, M, and N, indicating that there is data inconsistency for the non-aligned data block H at different second queue depths QD 2 and there is data inconsistency for the non-aligned data block M at different second queue depths QD 2 and there is data inconsistency for the non-aligned data block N at different second queue depths QD 2 and further indicates that the indicators of 512b, 129K, and 256K do not pass. The above example is only used to help those skilled in the art better understand the embodiments of the present invention, and the present invention makes no limitation thereto.
[0152] In an optional embodiment of the present invention, step 206 may include the following sub-steps:
[0153] Sub-step S61, comparing the first hash value and the second hash value;
[0154] Sub-step S62, if the first hash value and the second hash value are consistent, it is determined that the aligned consistency test and the non-aligned consistency test have not damaged the file system;
[0155] Sub-step S63, if the first hash value and the second hash value are inconsistent, it is determined that the aligned consistency test and the non-aligned consistency test have damaged the file system.
[0156] In the embodiments of the present invention, both the first hash value and the second hash value are md5 values generated for the file system in the first partition. The first hash value is the md5 value generated before the consistency test, and the second hash value is the md5 value generated after the consistency test. The embodiments of the present invention can determine whether the consistency test damages the file system by comparing the first hash value and the second hash value, that is, determine whether the aligned consistency test and the unaligned consistency test damage the file system.
[0157] If the first hash value and the second hash value are consistent, it is determined that the aligned consistency test and the unaligned consistency test do not damage the file system. Exemplarily, if no new abnormal logs appear, the first hash value remains unchanged, that is, the first hash value and the second hash value are consistent, so it is determined that the aligned consistency test and the unaligned consistency test do not damage the file system.
[0158] If the first hash value and the second hash value are inconsistent, it is determined that the aligned consistency test and the unaligned consistency test damage the file system. Exemplarily, if new abnormal logs appear, the first hash value changes, that is, the first hash value and the second hash value are inconsistent, so it is determined that the aligned consistency test and the unaligned consistency test damage the file system.
[0159] It can be seen that compared with the traditional test method where the aligned consistency and the unaligned consistency are tested separately, each of these two tests takes 49 - 52 hours, and the continuous test takes more than four days in total, with extremely low test efficiency. Moreover, the current mainstream manufacturer platforms do not pay attention to the data consistency and disk body problems in the scenario where the aligned and unaligned are running simultaneously in the actual application scenario. In view of the shortcomings of the prior art, the embodiments of the present invention design a brand-new method, innovatively conduct the aligned consistency and the unaligned consistency in the same scenario test, making up for the shortcoming of the traditional test method. The embodiments of the present invention can simulate the actual application scenario during the use of the storage device, opening a new chapter for the field of consistency testing.
[0160] Specifically, in view of the shortcomings of traditional testing methods, the embodiments of the present invention propose a testing method for improving the data integrity of aligned and unaligned SSD hard disks, which can shorten the total testing time of the original aligned consistency test and unaligned consistency test. Originally, the aligned and unaligned tests each required 48 - 50 hours, and the total required more than 100 hours. The embodiments of the present invention combine the aligned consistency test and the unaligned consistency test by verifying the md5 value of the first partition, and are compatible with the data units of aligned and unaligned for mixed writing. Not only is the original testing time of more than 100 hours shortened to within 50 hours, greatly improving the testing efficiency, but also the data consistency and disk body problems in the actual application scenario where alignment and non - alignment run simultaneously are taken into account. This is a brand - new method that innovatively conducts the aligned consistency and unaligned consistency tests in the same scenario. That is, the embodiments of the present invention issue different data units to different partitions of the SSD hard disk and perform mixed - writing tests on them, so as to observe the impact of data alignment and data non - alignment on the disk when tested simultaneously in an SSD hard disk, thereby simulating the actual application scenario during the use of the storage device, and intuitively seeing the impact of data on the performance data of the tested hard disk during the parallel test of alignment and non - alignment.
[0161] In summary, in the embodiments of the present invention, the hard disk space of the hard disk to be tested is divided into a first partition, a second partition, and a third partition. Before the aligned consistency test and the unaligned consistency test, a first hash value for the file system is generated in the first partition, and then aligned data blocks are written to the second partition for the aligned consistency test, and unaligned data blocks are written to the third partition for the unaligned consistency test. After the aligned consistency test and the unaligned consistency test are completed, a second hash value for the file system is generated in the first partition, and a first test result for the aligned consistency test and a second test result for the unaligned consistency test are obtained. According to the first hash value and the second hash value, it is judged whether the aligned consistency test and the unaligned consistency test have damaged the file system, and according to the first test result, it is judged whether there is data inconsistency in the aligned consistency test, and according to the second test result, it is judged whether there is data inconsistency in the unaligned consistency test. By parallel - testing the aligned consistency test and the unaligned consistency test in different partitions of the same hard disk, the embodiments of the present invention greatly shorten the testing time, greatly improve the testing efficiency, and fully consider the data consistency when the aligned consistency and the unaligned consistency run simultaneously in the actual application scenario of the hard disk.
[0162] In order to enable those skilled in the art to better understand the embodiments of the present invention, the following examples are used to illustrate the embodiments of the present invention:
[0163] Reference Figure 3, which shows the hard disk test flow chart provided by the embodiments of the present invention. The hard disk test flow can be specifically as follows:
[0164] S301, Start;
[0165] S302, Format the hard disk to be tested using the format command;
[0166] S303, Query the capacity of the hard disk space of the hard disk to be tested. According to the capacity, use the mkpart command to divide the hard disk space of the hard disk to be tested into a first partition, a second partition, and a third partition; wherein, the first partition is smaller than the second partition and the third partition, and the second partition and the third partition are of the same size;
[0167] S304, Before the alignment consistency test and the non-alignment consistency test, generate a first hash value for the file system in the first partition;
[0168] S305, The second partition is used for the alignment consistency test: sequentially write aligned data blocks of sizes 4K, 8K, 16K, 32K, 64K, 128K, and 256K to the second partition, and configure first queue depths of sizes 1, 2, 4, 8, 16, 32, and 64 respectively for testing each time an aligned data block is written; and, the third partition is used for the non-alignment consistency test: sequentially write non-aligned data blocks of sizes 512b, 2K, 3K, 17K, 65K, 129K, and 257K to the third partition, and configure second queue depths of sizes 1, 2, 4, 8, 16, 32, and 64 respectively for testing each time a non-aligned data block is written;
[0169] S306, After completing the alignment consistency test and the non-alignment consistency test, generate a second hash value for the file system in the first partition, and obtain a first operation result log for the alignment consistency test and a second operation result log for the non-alignment consistency test;
[0170] S307, Determine whether the first hash value and the second hash value are consistent; and, determine whether an error field appears in the first operation result log; and, determine whether an error field appears in the second operation result log;
[0171] S3081, Determine as no: If the first hash value and the second hash value are inconsistent, it is determined that the alignment consistency test and the non-alignment consistency test have damaged the file system; and, if no error field appears in the first operation result log, it is determined that there is no data inconsistency phenomenon at the same aligned data block and different first queue depths; and, if no error field appears in the second operation result log, it is determined that there is no data inconsistency phenomenon at the same non-aligned data block and different second queue depths;
[0172] S3082, if the judgment is yes: if the first hash value and the second hash value are the same, it is determined that the aligned consistency test and the unaligned consistency test do not damage the file system; and, if an error field appears in the first operation result log, it is determined that data inconsistency occurs at the same aligned data block and different first queue depths; and, if an error field appears in the second operation result log, it is determined that data inconsistency occurs at the same unaligned data block and different second queue depths;
[0173] S309, end.
[0174] Reference Figure 4 , which shows a structural block diagram of a hard disk testing device provided by an embodiment of the present invention, and specifically may include the following modules:
[0175] The partition division module 401 is used to divide the hard disk space of the hard disk to be tested into a first partition, a second partition, and a third partition;
[0176] The first hash value generation module 402 is used to generate a first hash value for the file system in the first partition before the aligned consistency test and the unaligned consistency test;
[0177] The testing module 403 is used to write aligned data blocks to the second partition to perform the aligned consistency test, and write unaligned data blocks to the third partition to perform the unaligned consistency test;
[0178] The second hash value generation module 404 is used to generate a second hash value for the file system in the first partition after the aligned consistency test and the unaligned consistency test are completed, and obtain a first test result for the aligned consistency test and a second test result for the unaligned consistency test;
[0179] The judgment module 405 is used to judge whether the aligned consistency test and the unaligned consistency test damage the file system according to the first hash value and the second hash value, and judge whether data inconsistency occurs in the aligned consistency test according to the first test result, and judge whether data inconsistency occurs in the unaligned consistency test according to the second test result.
[0180] In an optional embodiment of the present invention, the partition division module 401 may include:
[0181] The capacity size query sub-module is used to query the capacity size of the hard disk space of the hard disk to be tested;
[0182] A partition sub-module for partitioning the hard disk space of the hard disk to be tested into a first partition, a second partition, and a third partition according to the capacity size; wherein, the first partition is smaller than the second partition and the third partition, and the second partition and the third partition are of the same size.
[0183] In an optional embodiment of the present invention, the aligned data blocks include aligned data blocks of different sizes; the test module 403 may include:
[0184] An alignment consistency test sub-module for sequentially writing the different-sized aligned data blocks into the second partition in ascending order, and configuring different first queue depths for testing each time an aligned data block is written; wherein, the sizes of the aligned data blocks include 4K, 8K, 16K, 32K, 64K, 128K, 256K, and the first queue depths include 1, 2, 4, 8, 16, 32, 64.
[0185] In an optional embodiment of the present invention, the unaligned data blocks include unaligned data blocks of different sizes; the test module 403 may include:
[0186] An unalignment consistency test sub-module for sequentially writing the different-sized unaligned data blocks into the third partition in ascending order, and configuring different second queue depths for testing each time an unaligned data block is written; wherein, the sizes of the unaligned data blocks include 512b, 2K, 3K, 17K, 65K, 129K, 257K, and the second queue depths include 1, 2, 4, 8, 16, 32, 64.
[0187] In an optional embodiment of the present invention, the first test result is the first operation result log for the alignment consistency test; the judgment module 405 may include:
[0188] A first check sub-module for checking whether an error field appears in the first operation result log;
[0189] A first judgment sub-module for judging that there is a data inconsistency phenomenon when the same aligned data block and different first queue depths if an error field appears in the first operation result log;
[0190] A second judgment sub-module for judging that there is no data inconsistency phenomenon when the same aligned data block and different first queue depths if no error field appears in the first operation result log.
[0191] In an optional embodiment of the present invention, the second test result is the second operation result log for the unalignment consistency test; the judgment module 405 may include:
[0192] A second checking sub-module, configured to check whether an error field appears in the second operation result log;
[0193] A third judging sub-module, configured to, if an error field appears in the second operation result log, judge that data inconsistency occurs when in the same misaligned data block and different second queue depths;
[0194] A fourth judging sub-module, configured to, if no error field appears in the second operation result log, judge that data inconsistency does not occur when in the same misaligned data block and different second queue depths.
[0195] In an optional embodiment of the present invention, the device may further include:
[0196] A comprehensive analysis module, configured to adopt the first test result and the second test result to comprehensively analyze the influence of the alignment consistency test and the misalignment consistency test on the disk body of the hard disk to be tested.
[0197] In an optional embodiment of the present invention, the judging module 405 may include:
[0198] A comparison sub-module, configured to compare the first hash value and the second hash value;
[0199] A fifth judging sub-module, configured to, if the first hash value and the second hash value are consistent, judge that the alignment consistency test and the misalignment consistency test do not damage the file system;
[0200] A sixth judging sub-module, configured to, if the first hash value and the second hash value are inconsistent, judge that the alignment consistency test and the misalignment consistency test damage the file system.
[0201] In an optional embodiment of the present invention, before dividing the hard disk space of the hard disk to be tested into a first partition, a second partition, and a third partition, the device may further include:
[0202] A formatting module, configured to format the hard disk to be tested.
[0203] In summary, in the embodiments of the present invention, the hard disk space of the hard disk to be tested is divided into a first partition, a second partition, and a third partition. Before the alignment consistency test and the misalignment consistency test, a first hash value for the file system is generated in the first partition. Then, aligned data blocks are written to the second partition to perform the alignment consistency test, and misaligned data blocks are written to the third partition to perform the misalignment consistency test. After the alignment consistency test and the misalignment consistency test are completed, a second hash value for the file system is generated in the first partition, and a first test result for the alignment consistency test and a second test result for the misalignment consistency test are obtained. According to the first hash value and the second hash value, it is determined whether the alignment consistency test and the misalignment consistency test have damaged the file system, and according to the first test result, it is determined whether data inconsistency occurs in the alignment consistency test, and according to the second test result, it is determined whether data inconsistency occurs in the misalignment consistency test. In the embodiments of the present invention, by performing the alignment consistency test and the misalignment consistency test in parallel in different partitions of the same hard disk, the test time is greatly shortened, the test efficiency is extremely improved, and the data consistency when the alignment consistency and the misalignment consistency operate simultaneously in the actual application scenario of the hard disk is fully considered.
[0204] For the device embodiments, since they are basically similar to the method embodiments, the description is relatively simple. For the related parts, please refer to the partial description of the method embodiments.
[0205] The embodiments of the present invention further provide an electronic device, including: a processor, a memory, and a computer program stored on the memory and executable on the processor. When the computer program is executed by the processor, it implements each process of the above-mentioned hard disk test method embodiment and can achieve the same technical effect. To avoid repetition, it will not be described here again.
[0206] The embodiments of the present invention further provide a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by the processor, it implements each process of the above-mentioned hard disk test method embodiment and can achieve the same technical effect. To avoid repetition, it will not be described here again.
[0207] Each embodiment in this specification is described in a progressive manner. The key point of each embodiment is to illustrate the differences from other embodiments. The same or similar parts among the embodiments can be referred to each other.
[0208] Those skilled in the art should understand that the embodiments of the present invention can be provided as methods, devices, or computer program products. Therefore, the embodiments of the present invention can take the form of all-hardware embodiments, all-software embodiments, or embodiments combining software and hardware aspects. Moreover, the embodiments of the present invention can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0209] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each flow and / or block in the flowchart and / or block diagram, and the combination of flows and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal devices to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal devices generate a device for realizing the functions specified in one Figure 1 one flow or multiple flows and / or blocks Figure 1 or multiple blocks.
[0210] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal device to work in a specific manner, so that the instructions stored in the computer-readable memory generate a manufactured article including an instruction device, and the instruction device realizes the functions specified in one Figure 1 one flow or multiple flows and / or blocks Figure 1 or multiple blocks.
[0211] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device, so that a series of operation steps are executed on the computer or other programmable terminal device to generate a computer-implemented process. Thus, the instructions executed on the computer or other programmable terminal device provide steps for realizing the functions specified in one Figure 1 one flow or multiple flows and / or blocks Figure 1 or multiple blocks.
[0212] Although the preferred embodiments of the embodiments of the present invention have been described, those skilled in the art can make additional changes and modifications to these embodiments once they know the basic creative concepts. Therefore, the appended claims are intended to be construed to include the preferred embodiments and all changes and modifications falling within the scope of the embodiments of the present invention.
[0213] Finally, it should also be noted that in this text, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, such that a process, method, article or terminal device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or terminal device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or terminal device comprising the element.
[0214] The above has introduced in detail the hard disk testing method, device, electronic device and computer-readable storage medium provided by the present invention. Specific examples are used in this text to elaborate on the principle and implementation manner of the present invention. The description of the above embodiments is only used to help understand the method and its core idea of the present invention; at the same time, for those of ordinary skill in the art, according to the idea of the present invention, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation to the present invention.
Claims
1. A hard disk testing method, characterized in that, the method includes: dividing the hard disk space of the hard disk to be tested into a first partition, a second partition, and a third partition; before the aligned consistency test and the misaligned consistency test, generating a first hash value for the file system in the first partition; writing aligned data blocks to the second partition to perform the aligned consistency test, and writing misaligned data blocks to the third partition to perform the misaligned consistency test; after completing the aligned consistency test and the misaligned consistency test, generating a second hash value for the file system in the first partition, and obtaining a first test result for the aligned consistency test and a second test result for the misaligned consistency test; judging whether the aligned consistency test and the misaligned consistency test damage the file system according to the first hash value and the second hash value, judging whether data inconsistency occurs in the aligned consistency test according to the first test result, and judging whether data inconsistency occurs in the misaligned consistency test according to the second test result.
2. The method according to claim 1, characterized in that, the step of dividing the hard disk space of the hard disk to be tested into a first partition, a second partition, and a third partition includes: querying the capacity size of the hard disk space of the hard disk to be tested; dividing the hard disk space of the hard disk to be tested into a first partition, a second partition, and a third partition according to the capacity size; wherein, the first partition is smaller than the second partition and the third partition, and the second partition and the third partition are of the same size.
3. The method according to claim 1, characterized in that, the aligned data blocks include aligned data blocks of different sizes; the step of writing aligned data blocks to the second partition to perform the aligned consistency test includes: writing the different-sized aligned data blocks to the second partition in ascending order, and configuring different first queue depths for testing each time an aligned data block is written; wherein, the sizes of the aligned data blocks include 4K, 8K, 16K, 32K, 64K, 128K, 256K, and the first queue depths include 1, 2, 4, 8, 16, 32, 64.
4. The method according to claim 1, characterized in that, the misaligned data blocks include misaligned data blocks of different sizes; the step of writing misaligned data blocks to the third partition to perform the misaligned consistency test includes: writing the different-sized misaligned data blocks to the third partition in ascending order, and configuring different second queue depths for testing each time a misaligned data block is written; wherein, the sizes of the misaligned data blocks include 512b, 2K, 3K, 17K, 65K, 129K, 257K, and the second queue depths include 1, 2, 4, 8, 16, 32, 64.
5. The method according to claim 3, characterized in that, The first test result is the first running result log for the alignment consistency test; judging whether there is a data inconsistency in the alignment consistency test according to the first test result includes: Checking whether there is an error field in the first running result log; If there is an error field in the first running result log, it is determined that there is a data inconsistency when in the same alignment data block and different first queue depths; If there is no error field in the first running result log, it is determined that there is no data inconsistency when in the same alignment data block and different first queue depths.
6. The method according to claim 4, wherein, The second test result is the second running result log for the misalignment consistency test; judging whether there is a data inconsistency in the misalignment consistency test according to the second test result includes: Checking whether there is an error field in the second running result log; If there is an error field in the second running result log, it is determined that there is a data inconsistency when in the same misalignment data block and different second queue depths; If there is no error field in the second running result log, it is determined that there is no data inconsistency when in the same misalignment data block and different second queue depths.
7. The method according to claim 1, wherein, The method further includes: Using the first test result and the second test result to comprehensively analyze the impact of the alignment consistency test and the misalignment consistency test on the disk body of the hard disk to be tested.
8. The method according to claim 1, wherein, Judging whether the alignment consistency test and the misalignment consistency test damage the file system according to the first hash value and the second hash value includes: Comparing the first hash value and the second hash value; If the first hash value and the second hash value are the same, it is determined that the alignment consistency test and the misalignment consistency test do not damage the file system; If the first hash value and the second hash value are different, it is determined that the alignment consistency test and the misalignment consistency test damage the file system.
9. The method according to claim 1, wherein, Before dividing the hard disk space of the hard disk to be tested into a first partition, a second partition and a third partition, the method further includes: Formatting the hard disk to be tested.
10. A hard disk test device, wherein, The device includes: A partition division module for dividing the hard disk space of the hard disk to be tested into a first partition, a second partition and a third partition; A first hash value generation module for generating a first hash value for the file system in the first partition before the alignment consistency test and the misalignment consistency test; A test module for writing alignment data blocks to the second partition to perform the alignment consistency test, and writing misalignment data blocks to the third partition to perform the misalignment consistency test; A second hash value generation module, configured to generate a second hash value for the file system in the first partition after completing the aligned consistency test and the unaligned consistency test, and obtain a first test result for the aligned consistency test and a second test result for the unaligned consistency test; A judgment module, configured to judge whether the aligned consistency test and the unaligned consistency test damage the file system according to the first hash value and the second hash value, judge whether there is data inconsistency in the aligned consistency test according to the first test result, and judge whether there is data inconsistency in the unaligned consistency test according to the second test result.
11. An electronic device, characterized in that, comprising: A processor, a memory, and a computer program stored on the memory and executable on the processor, where when the computer program is executed by the processor, the steps of the hard disk test method according to any one of claims 1 to 9 are implemented.
12. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the hard disk test method according to any one of claims 1 to 9 are implemented.
Citation Information
Patent Citations
Hard disk test method and device, and storage medium
CN110992992A
Distributed storage QOS implementation method
CN111708494A