Method and apparatus for constructing a hard disk to store data, storage device, and electronic device
By determining and modifying the sector data to be written in the target hard disk in the construction method of storing data in the hard disk, the problem of low data accuracy in the prior art is solved, and a higher data construction accuracy is achieved.
Patent Information
- Application Number
- CN202510282505.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-11
- Publication Date
- 2025-06-10
- Estimated Expiration
- 2045-03-11
AI Technical Summary
When constructing UNC data in the prior art, the data accuracy is low and the simulation method is uncontrollable, resulting in the unknown whether the UNC processing flow and the number of UNC simulations are triggered.
By determining the target logical address of the target sector in the target hard disk where the wrong data is to be written, the first data stored in the target sector is obtained, the second data of the target number is determined in the first data, and the third data is modified to obtain the constructed third data, and the third data is written to the target sector.
Improve the accuracy of constructing data, ensure that the target number of data in the specified area is modified, thus solving the problem of low data accuracy.
Smart Images

Figure CN119781698B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of firmware, and more particularly, to a method, apparatus, storage device, and electronic device for constructing hard disk stored data. Background Art
[0002] In the related art, when constructing UNC (Uncorrectable Bit Errors) data, it is usually achieved by artificially simulating the bit flip method by using the unreliable characteristics of nand storage particles in a high-temperature environment with an incubator. However, the overall simulation method is uncontrollable. It is unknown whether UNC and other scenarios will definitely be simulated, the number of UNC simulations is unknown, and whether the UNC processing flow is triggered is also unknown, resulting in low accuracy of the constructed data.
[0003] It can be seen from this that there is a technical problem of low accuracy of constructed data in the related art.
[0004] In view of the above problems existing in the related art, no effective solution has been proposed yet. Summary of the Invention
[0005] The embodiments of the present invention provide a method, apparatus, storage device, and electronic device for constructing hard disk stored data, so as to at least solve the technical problem of low accuracy of constructed data existing in the related art.
[0006] According to an embodiment of the present invention, there is provided a method for constructing hard disk stored data, including: determining a target logical address of a target sector including error data to be written in a target hard disk; obtaining first data stored in the target sector based on the target logical address; determining a target number of second data in the first data, and modifying the second data to obtain third data, where the target number is greater than a preset threshold; and writing the third data into the target sector.
[0007] In an exemplary embodiment, obtaining the first data stored in the target sector based on the target logical address includes: obtaining a mapping table from the logical address to the physical address of the target hard disk; determining a target physical address corresponding to the target logical address in the mapping table; and obtaining the first data from the target physical address of the target sector.
[0008] In an exemplary embodiment, determining a target quantity of second data in the first data includes: determining an encryption method and a verification method of the first data; decrypting the first data according to a decryption method corresponding to the encryption method to obtain fourth data; performing de-verification on the fourth data according to the verification method to obtain fifth data; and determining the target quantity of the second data in the fifth data.
[0009] In an exemplary embodiment, determining the target quantity of the second data in the fifth data includes one of the following: randomly determining the second data from the fifth data; determining a data position included in a received data acquisition instruction, and determining the data at the data position included in the fifth data as the second data.
[0010] In an exemplary embodiment, writing the third data into the target sector includes: encrypting the third data to obtain sixth data; verifying the sixth data to obtain seventh data; and writing the seventh data into the target sector.
[0011] In an exemplary embodiment, after writing the third data into the target sector, the method further includes: testing the target hard disk according to a preset method.
[0012] According to another embodiment of the present invention, there is provided a construction device for storing data in a hard disk, including: a determination module, configured to determine a target logical address of a target sector in a target hard disk that includes error data to be written; an acquisition module, configured to acquire first data stored in the target sector based on the target logical address; a modification module, configured to determine a target quantity of second data in the first data, and modify the second data to obtain third data, where the target quantity is greater than a preset threshold; and a writing module, configured to write the third data into the target sector.
[0013] According to still another embodiment of the present invention, there is further provided a computer-readable storage medium, in which a computer program is stored, where the computer program is configured to execute the steps in any one of the above method embodiments when running.
[0014] According to still another embodiment of the present invention, there is further provided an electronic device, including a memory and a processor, where a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0015] According to another embodiment of the present invention, there is also provided a computer program product, including a computer program which, when executed by a processor, implements the steps of the methods in the various embodiments of the present application.
[0016] Through the present invention, after determining the target logical address of the target sector in the target hard disk where error data is to be constructed, the first data stored in the target sector can be obtained through the target logical address, the target quantity of the second data can be determined in the first data, and the first data can be modified to obtain the constructed third data. The third data is written into the target sector to complete the entire data construction process. Since the first data in the specified area (i.e., the target sector) can be modified by the target quantity, the technical problem of low accuracy of constructing data existing in the related art can be solved, and the technical effect of improving the accuracy of constructing data can be achieved. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 is a hardware structure block diagram of a mobile terminal for a method of constructing stored data in a hard disk according to an embodiment of the present invention;
[0018] Figure 2 is a flowchart of a method of constructing stored data in a hard disk according to an embodiment of the present invention;
[0019] Figure 3 is a data flow process diagram according to an embodiment of the present invention;
[0020] Figure 4 is a schematic diagram of a test device according to an embodiment of the present invention;
[0021] Figure 5 is a flowchart of a method of constructing stored data in a hard disk according to a specific embodiment of the present invention;
[0022] Figure 6 is a structure block diagram of a device for constructing stored data in a hard disk according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0023] In the following, embodiments of the present invention will be described in detail with reference to the drawings and in conjunction with the embodiments.
[0024] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily need to be used to describe a specific order or sequence.
[0025] The method embodiments provided in the embodiments of the present application can be executed on a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 is a hardware structure block diagram of a mobile terminal for a method of constructing stored data in a hard disk according to an embodiment of the present invention. AsFigure 1 As shown, the mobile terminal may include one or more ( Figure 1 only one is shown in the figure) processors 102 (the processor 102 may include, but is not limited to, processing devices such as a microprocessor MCU or a field programmable gate array FPGA) and a memory 104 for storing data. Among them, the above mobile terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those of ordinary skill in the art can understand that Figure 1 the structure shown is only schematic and does not limit the structure of the above mobile terminal. For example, the mobile terminal may further include more or fewer components than Figure 1 shown in the figure, or have a different configuration from Figure 1 shown in the figure.
[0026] The memory 104 can be used to store computer programs. For example, software programs and modules of application software, such as the computer program corresponding to the method for constructing the hard disk storage data in the embodiments of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, implements the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories. In some instances, the memory 104 may further include a memory remotely set relative to the processor 102, and these remote memories can be connected to the mobile terminal through a network. Examples of the above network include, but are not limited to, the Internet, an enterprise intranet, a local area network, a mobile communication network, and combinations thereof.
[0027] The transmission device 106 is used to receive or send data via a network. Specific examples of the above network may include a wireless network provided by a communication provider of the mobile terminal. In one instance, the transmission device 106 includes a network adapter (Network Interface Controller, abbreviated as NIC), which can be connected to other network devices through a base station and thus communicate with the Internet. In one instance, the transmission device 106 may be a radio frequency (Radio Frequency, abbreviated as RF) module, which is used to communicate with the Internet wirelessly.
[0028] In this embodiment, a method for constructing hard disk storage data is provided. Figure 2 is a flowchart of the method for constructing hard disk storage data according to the embodiments of the present invention. As Figure 2 shown, the process includes the following steps:
[0029] Step S202, determining the target logical address of the target sector including the error data to be written in the target hard disk;
[0030] Step S204, obtain the first data stored in the target sector based on the target logical address;
[0031] Step S206, determine a target number of second data from the first data, and modify the second data to obtain third data, where the target number is greater than a preset threshold;
[0032] Step S208, write the third data into the target sector.
[0033] In the above embodiment, the target hard disk may be a new type of memory, such as a solid-state drive ssd (Solid State Drive), a solid-state hybrid drive SSHD (Solid State Hybrid Drive), etc. The memory of the target hard disk may use nand storage particles. After long-term use of the target hard disk, due to the wear of its nand storage particles themselves, or electron loss, high and low temperatures, etc., data bit flips may occur. When the bit flip exceeds a certain error correction ability threshold, a situation where it cannot be corrected will occur. At this time, the data has an UNC (that is, the data will become the above-mentioned error data to be written). It can be understood that there is an irreparable bit error in the flash device, which means that even if the target hard disk itself has exhausted all error tolerance means, the data in the target sector cannot be correctly read. Therefore, quickly constructing UNC data for testing can timely detect errors in the hard disk and then intervene as early as possible.
[0034] In the above embodiment, the target logical address can be understood as the lba (Logical Block Addressing) data logical address, which can be understood as a way of addressing the target hard disk. Each storage block in the target hard disk can be mapped to a unique logical address, enabling the system to access the data in the target hard disk through the logical address instead of the physical address, which can simplify the management and data access of the target hard disk to a certain extent. During the process of addressing the target hard disk, data can usually be addressed through the combination of sectors (Sector). Therefore, lba can regard the target hard disk as a flat logical storage area, and each storage block (that is, the above-mentioned target sector) corresponds to a unique logical address. By determining this unique lba data logical address, the target sector of the UNC data to be constructed in the target hard disk can be determined.
[0035] In the above embodiments, the first data stored in the target sector can be obtained through the determined LBA address, that is, the data in the corresponding NAND storage particle in the target sector. The target number of second data can be determined from the first data, and the second data can be modified to obtain the constructed data UNC (i.e., the above-mentioned third data), and the constructed third data can be written back into the target sector. Among them, the target number can be the number of randomly selected data in the target sector, or can be determined according to the error correction degree of the algorithm inside each target sector. However, in order to ensure that the target disk can never be corrected back to the normal state, the target number should be at least greater than the preset threshold. The preset threshold can be 200, 300, etc., but is not limited thereto.
[0036] In the above embodiments, the data UNC writing of multiple target sectors can also be completed at one time, that is, all required LBA data logical addresses can be integrated into a list, and the LBA addresses in the list can be obtained in sequence for subsequent operations. Example: There are logical addresses of LBA1 = 128k, LBA2 = 64k, and LBA3 = 512k in a list. First, complete the modification and writing of the data in the target sector corresponding to LBA1, and then continue to complete the modification and writing of the data in the target sectors corresponding to LBA2 and LBA3.
[0037] Through the present invention, after determining the target logical address of the target sector in the target hard disk where the error data is to be constructed, the first data stored in the target sector can be obtained through the target logical address, the target number of second data can be determined from the first data, and it can be modified to obtain the constructed third data. The third data is written into the target sector to complete the entire data construction process. Since the first data in the specified area (i.e., the target sector) can be modified by the target number, the technical problem of low accuracy of constructing data in the related art can be solved, and the technical effect of improving the accuracy of constructing data can be achieved.
[0038] Optionally, the execution subject of the above steps can be a processor, a server, or a terminal, but is not limited thereto.
[0039] In an exemplary embodiment, obtaining the first data stored in the target sector based on the target logical address includes: obtaining a mapping table from the logical address to the physical address of the target hard disk; determining the target physical address corresponding to the target logical address in the mapping table; and obtaining the first data from the target physical address of the target sector.
[0040] In the above embodiments, the l2p (Logical to Physical mapping table), i.e., the mapping table from the logical address to the physical address in the solid-state drive, can be queried according to the obtained lba data logical address corresponding to the target sector (i.e., the above-mentioned target logical address). Through the l2p table, the actual physical location of the ppn (Physical PageNumber) data corresponding to the lba logical address (i.e., the above-mentioned target physical address), that is, the actual physical location of the nand storage particles, can be obtained, and the pageread interface of the nand is used to read the real data in the nand corresponding to the lba (i.e., the above-mentioned first data). The ppn format can be seen in Table 1. As shown in Table 1, the ppn can include the ch (Channel) channel where the nand particles are located, ce (Chip Enable), plane, block, page, and cw (Coreword) of the nand particles. Among them, the ch channel can be used to store the command data from the system onto the nand storage particles; the ce signal can be used to enable the controller to communicate with a specific chip and disable other chips; the plane can be understood as an independent storage unit in the chip and can be used to store and manage data; the page can be understood as the smallest addressable unit in the nand storage particles; the block can be understood as the smallest unit that can be erased in the nand storage particles.
[0041] Table 1
[0042]
[0043] In an exemplary embodiment, determining the target quantity of second data in the first data includes: determining the encryption method and verification method of the first data; decrypting the first data according to the decryption method corresponding to the encryption method to obtain fourth data; de-verifying the fourth data according to the verification method to obtain fifth data; and determining the target quantity of the second data in the fifth data.
[0044] In the above embodiments, Figure 3 is the data flow process diagram according to the embodiments of the present invention, as Figure 3As shown, when the host side in the CPU processor writes raw data (i.e., the above-mentioned first data) into a memory (such as a solid-state drive), it usually needs to perform pre-checks through algorithms such as ecc (Ellipse Curve Cryptography) and randomize the data through algorithms such as the aes (Advanced Encryption Standard) encryption algorithm. Therefore, if one wants to obtain the real data written by the host side (i.e., the above-mentioned fifth data), corresponding decryption and de-checking are required, and the target number of second data is selected from the real data.
[0045] In the above embodiment, the process of the aes decryption algorithm (i.e., the decryption method corresponding to the above encryption method) can be divided into three rounds: the initial round, the main round, and the final round. The extended key required for decryption can be determined first, and the extension order is opposite to that during encryption. In the initial round, the ciphertext and the key of the final round can be XORed through the AddRoundKey function. In the main round, the first data and the round key of the current round can be XORed through the AddRoundKey function, the columns of the first data can be inversely mixed through the MixColumns function, the rows of the first data can be inversely shifted through the ShiftRows function, and the inverse non-linear substitution (inverse S-box) can be applied to each byte of the first data through the SubBytes function. In the final round, the AddRoundKey function, ShiftRows function, and SubBytes function in the main round can be executed. After the final round is completed, the decrypted data plaintext (i.e., the above-mentioned fourth data) can be obtained.
[0046] In the above embodiment, the ecc algorithm (i.e., the above-mentioned checking method) can be used to perform ecc de-checking on the decrypted fourth data, so as to obtain the real raw data that has not been processed by the algorithm (i.e., the above-mentioned fifth data). The essence of the ecc de-checking algorithm can be understood as the inverse process of the ecc checking algorithm, which can be used to verify the integrity of the data when reading the data and correct errors if necessary. The de-checking process can include: reading the data and the check code: when reading the data, the ECC check code associated with the data can be read simultaneously; recalculating the check code: the check code can be recalculated according to the ECC algorithm during the process of using the read data; comparing the check codes: the recalculated check code can be compared with the stored check code; error detection: if the check codes do not match, it can indicate that there are errors in the data; error correction: if the ECC algorithm supports error correction, the position of the error can be determined according to the check code and an attempt can be made to correct the error; returning the data: after the error is detected and corrected, the corrected fifth data can be returned for the system to use.
[0047] In an exemplary embodiment, determining the target quantity of the second data from the fifth data includes one of the following: randomly determining the second data from the fifth data; determining a data position included in a received data acquisition instruction, and determining, as the second data, the data in the fifth data that is at the data position.
[0048] In the above embodiment, after obtaining the fifth data written by the host side corresponding to the final lba, the data in the corresponding cw data can be manually modified according to the test requirements, flipping 0 to 1 and 1 to 0. The target quantity of the flipped second data needs to reach an unc quantity that cannot be recovered. Among them, the flipped second data can be randomly selected from the fifth data. It is also possible to determine the flipped second data according to the algorithm error correction degree inside each target sector, that is, to determine the second data to be flipped in the status data according to the data position included in the received data acquisition instruction.
[0049] In an exemplary embodiment, writing the third data to the target sector includes: encrypting the third data to obtain a sixth data; performing a check on the sixth data to obtain a seventh data; and writing the seventh data to the target sector.
[0050] In the above embodiment, due to the characteristics of NAND, NAND needs to be erased first before writing. Therefore, the block erase interface on the NAND side can be called to erase the current block. Continue to refer to Figure 3 The data after flipping (i.e., the above third data) can be encrypted again using the AES encryption algorithm to randomize the third data again, obtaining a sixth data; continue to perform a check operation on the sixth data using the ECC algorithm. The obtained seventh data can be written back to the ppn position corresponding to the target sector lba by calling the page program interface of NAND. Thus, a round of construction and injection of unc lba abnormal data is completed.
[0051] In an exemplary embodiment, after writing the third data to the target sector, the method further includes: testing the target hard disk in a preset manner.
[0052] In the above embodiment, normal read and write operations can be performed on the data rewritten to the target sector, or the data garbage collection, power-off, etc. of the target sector can be triggered. It is possible to check whether the corresponding unc data meets the expectations in various abnormal or normal states such as being read, being moved, and being powered off. At the same time, it is also possible to check whether the unc count is equal to the injected unc number to determine whether it meets the expectations.
[0053] The method for constructing the hard disk storage data will be described below in conjunction with specific embodiments: The above method can be applied to the following test device, Figure 4 which is a schematic diagram of the test device according to an embodiment of the present invention. As Figure 4 shown, the data reading module can be used to read the real data in the corresponding NAND storage particles in the target sector. The data decryption module and the de-checking module can decrypt and de-check the data of the NAND storage particles, and the real raw data without algorithm processing can be obtained. The data fault construction module can re-encrypt and check the real raw data through the data encryption and check module to obtain the constructed UNC data. Finally, the constructed UNC data can be written back to the target sector by using the data writing module, and tested through the data test module to determine whether it meets the expected effect.
[0054] Figure 5 which is a flowchart of the method for constructing the hard disk storage data according to a specific embodiment of the present invention. As Figure 5 shown, the process may include:
[0055] Step S502, access the LBA list address of the unc to be injected;
[0056] Step S504, query the corresponding PPN physical address in the lp2 table, and read the real data using the pageread interface;
[0057] Step S506, decrypt using the AES algorithm to randomize the data;
[0058] Step S508, perform an ECC de-check operation using the ECC algorithm;
[0059] Step S510, obtain the real raw data that has not been encrypted and scrambled;
[0060] Step S512, obtain the CW range that needs to be specifically modified in the raw data according to the above LBA position;
[0061] Step S514, flip 0 to 1 and 1 to 0 in the CW for more than 200 times to reach an unc errorbit quantity that the algorithm cannot correct;
[0062] Step S516, call the blk erase interface to perform an erase operation on the current block;
[0063] Step S518, re-perform ECC check on the raw data after injecting the errorbit;
[0064] Step S520, continue to use the ASE algorithm to perform encryption operations to randomize the data;
[0065] Step S522, call the page program interface to rewrite the rawdata+data after modifying errorbit+ecc+aes to the ppn position corresponding to lba;
[0066] Step S524, determining whether all lba list data injection is completed, if yes, executing step S526; if no, executing step S502;
[0067] Step S526, read and write or gc power-off operation is performed normally, and the corresponding unc data status is checked to see whether it meets expectations, whether the unc times are increased, and whether the bad marking strategy meets expectations;
[0068] Step S528, end.
[0069] In the above embodiment, the UNC data of multiple locations can be quickly constructed in batches by constructing an LBA list, and a large amount of UNC data can be constructed in batches in a short time, which has good test efficiency and test effect. In addition, the UNC data of the specified location can be accurately constructed by selecting the LBA address of the target disk area. In a specific firmware code process, such as ordinary reading and writing, GC garbage collection, power-off process, etc., the constructed UNC data can be accurately pre-embedded in advance, which can make it easier to detect potential problems of the product, especially for test difficulties and test pain points, more valuable problems can be excavated, so that the product quality can be very reliably guaranteed.
[0070] In the above embodiments, the traditional test method is time-consuming and laborious, and the test results are unpredictable, and the test results and test quality are unreliable. However, the present invention can read the real host write data model through the AES decryption algorithm, ECC de-verification and other means, and read the L2P and other methods, modify the number of data error bits in the data model in a targeted manner, and then write it for the second time to achieve the purpose of constructing UNC data in the NAND. It can achieve high efficiency standards, low development and testing costs, good test results, and no need to run for a long time through a traditional incubator.
[0071] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases, the former is a better implementation. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions for causing a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in various embodiments of the present invention.
[0072] In this embodiment, a structure device for storing data on a hard disk is also provided. This device is used to implement the above embodiments and preferred implementation manners, and those that have been described will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that can achieve a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware is also possible and contemplated.
[0073] Figure 6 is a structural block diagram of the structure device for storing data on a hard disk according to an embodiment of the present invention. As Figure 6 shown, the device includes:
[0074] A determination module 602, configured to determine the target logical address of the target sector including the error data to be written in the target hard disk;
[0075] An acquisition module 604, configured to acquire the first data stored in the target sector based on the target logical address;
[0076] A modification module 606, configured to determine a target number of second data in the first data, and modify the second data to obtain third data, where the target number is greater than a preset threshold;
[0077] A writing module 608, configured to write the third data into the target sector.
[0078] In the above embodiment, the determination module 602 and the acquisition module 604 may correspond to the data reading module in the above test device; the modification module 606 may correspond to the above data decryption, de-verification module, data reading failure construction module, data encryption, and re-verification module; the writing module 608 may correspond to the above data writing module.
[0079] In an exemplary embodiment, the obtaining module 604 may obtain the first data stored in the target sector based on the target logical address in the following manner: obtain the mapping table of the logical address to the physical address of the target hard disk; determine the target physical address corresponding to the target logical address in the mapping table; and obtain the first data from the target physical address of the target sector.
[0080] In an exemplary embodiment, the modifying module 606 may determine a target quantity of second data in the first data in the following manner: determine the encryption method and the verification method of the first data; decrypt the first data according to the decryption method corresponding to the encryption method to obtain fourth data; perform de-verification on the fourth data according to the verification method to obtain fifth data; and determine the target quantity of the second data in the fifth data.
[0081] In an exemplary embodiment, the modifying module 606 may determine the target quantity of the second data in the fifth data by at least one of the following methods: randomly determine the second data from the fifth data; determine the data position included in the received data acquisition instruction, and determine the data in the fifth data at the data position as the second data.
[0082] In an exemplary embodiment, the writing module 608 may write the third data into the target sector in the following manner: encrypt the third data to obtain sixth data; verify the sixth data to obtain seventh data; and write the seventh data into the target sector.
[0083] In an exemplary embodiment, after the device writes the third data into the target sector, the device tests the target hard disk according to a preset method.
[0084] It should be noted that the above-mentioned various modules may be implemented by software or hardware. For the latter, it may be implemented in the following manner, but not limited thereto: the above-mentioned modules are all located in the same processor; or, the above-mentioned various modules are respectively located in different processors in any combination form.
[0085] An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, and the computer program is configured to execute the steps in any one of the above method embodiments when running.
[0086] In an exemplary embodiment, the above computer-readable storage medium may include, but is not limited to: various media that can store computer programs such as USB flash drives, read-only memory (ROM for short), random access memory (RAM for short), external hard drives, magnetic disks, or optical discs.
[0087] An embodiment of the present invention further provides an electronic device, including a memory and a processor. A computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0088] In an exemplary embodiment, the above electronic device may further include a transmission device and input / output devices. Among them, the transmission device is connected to the above processor, and the input / output devices are connected to the above processor.
[0089] An embodiment of the present invention further provides a computer program product, including a computer program. When the computer program is executed by a processor, the steps of the methods in various embodiments of the present application are implemented.
[0090] Specific examples in this embodiment may refer to the examples described in the above embodiments and exemplary embodiments, and will not be repeated here.
[0091] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general-purpose computing device. They can be concentrated on a single computing device or distributed on a network composed of multiple computing devices. They can be implemented by program codes executable by the computing device, so that they can be stored in a storage device and executed by the computing device. And in some cases, the steps shown or described can be executed in a different order than here, or they can be separately fabricated into individual integrated circuit modules, or multiple modules or steps among them can be fabricated into a single integrated circuit module to be implemented. Thus, the present invention is not limited to any specific combination of hardware and software.
[0092] The above are only the preferred embodiments of the present invention and are not used to limit the present invention. For those skilled in the art, the present invention can have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A method for constructing a hard disk to store data, characterized in that: include: Determine a target logical address of a target sector in a target hard disk where error data is to be written; Acquire first data stored in the target sector based on the target logical address; Determine second data of a target quantity from the first data, and modify the second data to obtain third data, wherein the target quantity is greater than a preset threshold; Writing the third data into the target sector; Determining the target number of second data in the first data includes: determining an encryption method and a verification method for the first data; decrypting the first data according to a decryption method corresponding to the encryption method to obtain fourth data; de-verifying the fourth data according to the verification method to obtain fifth data; determining the target number of second data in the fifth data; wherein determining the target number of second data in the fifth data includes: determining a data position included in a received data acquisition instruction, and determining the data included in the fifth data and located at the data position as the second data; Before writing the third data into the target sector, the target sector is erased.
2. The method according to claim 1, characterized in that Acquiring first data stored in the target sector based on the target logical address includes: Obtaining a mapping table from the logical address to the physical address of the target hard disk; Determining in the mapping table a target physical address corresponding to the target logical address; The first data is obtained from the target physical address of the target sector.
3. The method according to claim 1, characterized in that The second data for determining the target quantity in the fifth data further includes: The second data is randomly determined from the fifth data.
4. The method according to claim 1, characterized in that: Writing the third data to the target sector comprises: encrypting the third data to obtain sixth data; Verifying the sixth data to obtain seventh data; The seventh data is written to the target sector.
5. The method according to claim 1, characterized in that After writing the third data to the target sector, the method further includes: The target hard disk is tested in a preset manner.
6. A device for constructing hard disk data storage, characterized in that: include: A determination module, used for determining a target logical address of a target sector in a target hard disk where error data is to be written; An acquisition module, configured to acquire first data stored in the target sector based on the target logical address; a modification module, configured to determine a second data of a target quantity from the first data, and modify the second data to obtain a third data, wherein the target quantity is greater than a preset threshold; A writing module, used for writing the third data into the target sector; The determination module determines the target number of second data in the first data in the following manner: determining an encryption method and a verification method for the first data; decrypting the first data in a decryption method corresponding to the encryption method to obtain fourth data; de-verifying the fourth data in accordance with the verification method to obtain fifth data; determining the target number of second data in the fifth data; wherein the determination module determines the target number of second data in the fifth data in the following manner: determining a data position included in a received data acquisition instruction, and determining the data included in the fifth data and located at the data position as the second data; The device is also used for erasing the target sector before writing the third data into the target sector.
7. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program is configured to execute the method according to any one of claims 1 to 5 when executed.
8. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 5.
9. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method described in any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Error correction capability test method and device, readable storage medium and electronic equipment
CN113778822A
Encryption control method for manufacturing solid state disk
CN119004568A