Error recording method, error reading method, device, and computer storage medium

By creating an error bitmap record in the redundant space of the hard disk sector unit to record uncorrectable errors in the hard disk, the problem of error recording in 4K misaligned hard disks is solved, and efficient error management and location are achieved.

CN118708426BActive Publication Date: 2026-01-30SHANGHAI LONGSYS DIGITAL TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310317060.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-27
Publication Date
2026-01-30
Estimated Expiration
2043-03-27

AI Technical Summary

Technical Problem

Existing technologies cannot effectively record uncorrectable errors in 4K misaligned hard drives, making it impossible to accurately locate and manage uncorrectable errors that occur during the use of data storage devices.

Method used

An error bitmap is created in the redundant space of the sector unit of the hard disk. The error data is written into the error bitmap using the location of the target sector, and error bitmap data is generated to record the sector location of uncorrectable errors.

Benefits of technology

It enables the recording of uncorrectable error sector locations in detail without requiring additional storage space when the hard drive is 4K misaligned, reducing additional space overhead and memory usage, and simplifying error recording operations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118708426B_ABST
    Figure CN118708426B_ABST
Patent Text Reader

Abstract

This application discloses an error recording method, an error reading method, an apparatus, and a computer storage medium. The error recording method includes: in response to a high-tech configuration command, acquiring the target sector where an uncorrectable error has occurred; when the sector unit corresponding to the target sector is not 4K aligned, creating an error bitmap in the redundant space of the sector unit; and writing error data into the error bitmap using the location of the target sector. Through the above method, this application can record information about the target sector where an uncorrectable error has occurred in a 4K unaligned disk by creating an error bitmap using redundant space, thereby achieving the recording of an uncorrectable error in the corresponding sector without allocating additional memory space, and obtaining the information that an uncorrectable error has occurred in the sector when reading the sector.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of hard disk management, and in particular to an error recording method, an error reading method, an apparatus, and a computer storage medium. Background Technology

[0002] With the rapid development of the internet, people are generating all kinds of business-related data in various fields of social production and social life. Due to the sheer volume of this data, the requirements for data storage capacity are also increasing.

[0003] Typically, improper operation of data storage devices, such as frequent access during data read / write operations, can cause varying degrees of wear and tear. Furthermore, with the passage of time and inherent quality issues, data storage devices may develop uncorrectable errors (UNCs), rendering them unusable. Therefore, it is necessary to mark areas where uncorrectable errors have occurred to reduce unnecessary time consumption during data read / write operations.

[0004] In the prior art, for uncorrectable errors, error write commands can only be used to record them on data storage devices that are already 4K aligned. These commands are used to record that an uncorrectable error has occurred in a specified logical sector. Summary of the Invention

[0005] The main technical problem addressed by this application is how to record uncorrectable error information on a 4K unaligned hard disk. To this end, this application provides an error recording method, an error reading method, an apparatus, and a computer storage medium.

[0006] To address the aforementioned technical problems, this application provides a technical solution: an error logging method, comprising: in response to a high-tech configuration command, acquiring the target sector where an uncorrectable error has occurred; when the sector unit corresponding to the target sector is not 4K aligned, creating an error bitmap in the redundant space of the sector unit; and writing error data into the error bitmap using the location of the target sector.

[0007] Each sector in the sector unit corresponds to a bit in the error bitmap. When the bit is a first preset value, valid data is written to the corresponding sector; when the bit is a second preset value, erroneous data is written to the corresponding sector.

[0008] The step of writing error data into an error bitmap using the location of the target sector includes: setting the error bitmap data of the target sector to a second preset value and setting the error bitmap data of the remaining sectors to a first preset value; and generating an error bitmap based on the error bitmap data of all sectors in the sector unit.

[0009] After obtaining the target sector where the uncorrectable error occurred, the method further includes: when the sector unit corresponding to the target sector is 4K aligned, changing the sector table entry of the sector unit to a preset specific value according to the target sector.

[0010] The sector table entries are used to record the mapping relationship between logical block addresses and physical block addresses.

[0011] To solve the above-mentioned technical problems, another technical solution adopted in this application is: to provide an error reading method, the method comprising: in response to a read command, obtaining the entries of a sector unit; reading an error bitmap in the redundant space of the sector unit based on the entries of the sector unit; and locating the target sector where an uncorrectable error has occurred according to the error bitmap data of the error bitmap.

[0012] After obtaining the entries of the sector unit, the method further includes: determining whether the entries of the sector unit are preset specific values; if so, returning the location information of the target sector corresponding to the sector unit to locate the target sector where the uncorrectable error occurred; if not, reading the error bitmap in the redundant space of the sector unit based on the entries of the sector unit.

[0013] The process of locating the target sector where an uncorrectable error occurs based on the error bitmap data includes: parsing the error bitmap data to obtain the value of each error bitmap data; obtaining the sector corresponding to the value of the error bitmap data as a second preset value; and using the corresponding sector as the target sector where the uncorrectable error occurs.

[0014] To solve the above-mentioned technical problems, another technical solution adopted in this application is: to provide an error recording device, which includes a processor and a memory, the memory being coupled to the processor, the memory storing program data, and the processor executing the program data to implement the error recording method and / or error reading method as described above.

[0015] To solve the above-mentioned technical problems, another technical solution adopted in this application is to provide a computer-readable storage medium that stores program data, which, when executed, is used to implement the above-mentioned error recording method and / or error reading method.

[0016] The beneficial effects of this application are as follows: Unlike existing technologies, the error recording method provided in this application is applied to an error recording device. The error recording device responds to a high-tech configuration command, acquires the target sector where an uncorrectable error occurred, and creates an error bitmap in the redundant space of the sector unit when the sector unit corresponding to the target sector is not 4K aligned. Error data is written to the error bitmap using the location of the target sector. Through this method, compared to conventional error recording methods, the approach adopted in this application, which uses an error recording device to create an error bitmap in the redundant space of the sector unit to record error data, eliminates the need to allocate additional storage space to record uncorrectable error sectors even when the hard disk is not 4K aligned, reducing additional space overhead. The error recording device provided in this application can record the specific location of uncorrectable error sectors in detail using the error bitmap, and can also record the specific location of uncorrectable error sectors even when the disk is not 4K aligned, without requiring additional memory space to store the error records. This simplifies the operation steps during error recording and reduces the memory usage of error recording. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] in:

[0019] Figure 1 This is a flowchart illustrating an embodiment of the error recording method provided in this application;

[0020] Figure 2 This is a flowchart illustrating the application of the error recording method in the error recording device provided in this application;

[0021] Figure 3 This is a schematic diagram of the error bitmap used in the error logging method provided in this application;

[0022] Figure 4 This is a flowchart illustrating an embodiment of the error reading method provided in this application;

[0023] Figure 5 This is a flowchart illustrating the application of the error reading method in the error recording device provided in this application;

[0024] Figure 6 This is a schematic diagram of the structure of the first embodiment of the error recording device provided in this application;

[0025] Figure 7This is a schematic diagram of the structure of the second embodiment of the error recording device provided in this application;

[0026] Figure 8 This is a schematic diagram of an embodiment of the computer-readable storage medium provided in this application. Detailed Implementation

[0027] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.

[0028] In this document, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " generally indicates that the preceding and following related objects have an "or" relationship. Furthermore, "many" in this document means two or more. Moreover, the term "at least one" in this document means any combination of at least two of any one or more of a plurality of objects. For example, including at least one of A, B, and C can mean including any one or more elements selected from the set consisting of A, B, and C.

[0029] The error recording method provided in this application is mainly applied to an error recording device, wherein the error recording device can be a server or a system in which a server and a terminal device cooperate with each other. Accordingly, the various parts of the error recording device, such as various units, sub-units, modules, and sub-modules, can all be set in the server, or they can be set in the server and the terminal device respectively.

[0030] Furthermore, the aforementioned server can be either hardware or software. When the server is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or as a single server. When the server is software, it can be implemented as multiple software programs or software modules, such as software or software modules used to provide distributed servers, or as a single software program or software module; no specific limitation is made here. In some possible implementations, the error logging method of this application embodiment can be implemented by the processor calling computer-readable instructions stored in memory.

[0031] The error recording method provided in this application is mainly applied to the recording of logical sectors that have experienced uncorrectable errors (UNCs) in data storage devices such as NAND FLASH chips. This allows the error recording device to correctly obtain information about which sectors have experienced uncorrectable errors and the specific physical location of the sectors when reading the data storage device.

[0032] Current error logging methods primarily only allow recording uncorrectable errors in specified logical sectors using the ATA Command WUE (WRITE UNCORRECTABLE EXT) command when the data storage device is 4K aligned. However, this method cannot be used to record sectors with uncorrectable errors when the 4K is not aligned. Therefore, this application provides an error logging method, and the technical solution adopted in this application will be described in detail below.

[0033] See Figure 1 and Figure 2 , Figure 1 This is a flowchart illustrating an embodiment of the error recording method provided in this application; Figure 2 This is a flowchart illustrating the application of the error recording method in the error recording device provided in this application.

[0034] Step 11: In response to the high-tech configuration command, obtain the target sector where the uncorrectable error occurred.

[0035] Specifically, Advanced Technology Attachment (ATA), also known as Integrated Drive Electronics (IDE) interface, is a standard for connecting hard drives to computers. It enables data transfer between the storage device's cache and the host memory. In essence, the ATA interface connects the storage device or disk controller to the computer motherboard via a cable (data cable). Communication between the storage device and the host system is then accomplished by calling instructions from an external control system, such as the Unified Extensible Firmware Interface (UEFI) BIOS or a traditional BIOS, using the ATA instruction set. ATA instructions are used to operate the ATA hard drive, such as reading disk information.

[0036] Specifically, after the error logging device receives the high-tech configuration command, it first determines whether the command is WUE, i.e., the WRITE UNCORRECTABLE EXT command. WUE is used to record an uncorrectable error, i.e., UNC, that has occurred in the specified logical sector.

[0037] Specifically, Uncorrectable Errors (UNC) represent the number of unrepairable sectors on a hard drive, reflecting its stability. UNC is crucial in hard drive testing, providing information about the drive's quality and stability, and is an important parameter for evaluating performance. A high number of unrepairable sectors can lead to data loss or errors; therefore, the UNC level is significant. Generally, a lower UNC level is better. A UNC level below 10 typically indicates good hard drive performance, while a UNC level above 10 suggests potential problems and the possibility of data loss or errors.

[0038] Specifically, after receiving the high-tech configuration command, the error logging device first determines whether the sector unit corresponding to the target sector, i.e., the hard drive, is 4K aligned. 4K alignment means that the SSD's sectors are aligned to an integer multiple of 8 analog sectors, i.e., 512B * 8 = 4096B, and 4096 bytes is 4K. 4K alignment allows the operating system's smallest allocation unit to correspond to one page of flash memory, enabling the operating system to write 4KB of data at a time, thus improving data read and write efficiency.

[0039] A hard drive typically consists of many platters, each divided into sectors, and further divided into tracks along the radius. The sector-shaped area formed by each track and sector is called a physical sector. Logical sectors are software-level sectors defined by the operating system to facilitate the operating system's reading and writing of hard drive data. Their size and specific address can be mapped to physical sector addresses using a specific formula. A sector is the smallest unit for reading and writing information.

[0040] Step 12: When the sector cell corresponding to the target sector is not 4K aligned, create an error bitmap in the redundant space of the sector cell.

[0041] Specifically, when the error recording device obtains information that the sector unit corresponding to the target sector is not 4K aligned, the error recording device will search for the meta part, i.e., the redundant space, in the data storage device such as the NADA FLASH chip, and establish a bitmap, i.e., an error bitmap, in it to record WUE data. The error bitmap is used to record the UNC information of the sector unit.

[0042] Specifically, the generation of the error bitmap is based on the number of sectors in the sector unit. For example, if the sector unit contains 8 sectors, the error bitmap contains 8 bits.

[0043] Specifically, each sector in the sector unit corresponds to one bit in the error bitmap. When the number of bits is a first preset value, valid data is written to the corresponding sector; when the number of bits is a second preset value, erroneous data is written to the corresponding sector. The first preset value can be 0, indicating that the corresponding sector is valid, and the second preset value can be 1, indicating that an uncorrectable error has occurred in the corresponding sector. The values ​​of the first and second preset values ​​can be set by the user and are not limited here.

[0044] Optionally, when the error logging device obtains information that the sector unit corresponding to the target sector is 4K aligned, it will change the sector table entry of the sector unit to a preset specific value according to the target sector.

[0045] Specifically, a sector unit typically comprises 8 sectors, or 4K. Each sector unit has a corresponding entry, which records the mapping relationship between logical block addresses and physical block addresses. When the error logging device responds to an ATA command injected into the WUE, it changes the entry to a preset specific value to indicate that all sectors in that 4K data are UNC.

[0046] Step 13: Write the error data into the error bitmap using the location of the target sector.

[0047] Specifically, the error recording device sets the error bitmap data of the target sector to a second preset value and sets the error bitmap data of the remaining sectors to a first preset value; and generates an error bitmap based on the error bitmap data of all sectors in the sector unit.

[0048] See Figure 3 , Figure 3 This is a schematic diagram of the error bitmap used in the error logging method provided in this application. In the case of 4K sector cell non-alignment, such as... Figure 3 The 4K data shown includes both valid data and injected WUE data. Taking a first preset value of 0 and a second preset value of 1 as an example, the error recording device defines the injected WUE sector as 1 and the normally functioning sector as 0. Therefore... Figure 3 For example, the diagram shows that sectors 5, 6, and 7 were injected with WUE, meaning that uncorrectable errors occurred in sectors 5, 6, and 7. Sectors 0-4 are normally functioning sectors, meaning that the error bitmap data for sectors 0-4 is 0, and the error bitmap data for sectors 5-7 is 1.

[0049] Specifically, after obtaining the error bitmap data corresponding to each sector, the error recording device combines the error bitmap data corresponding to each sector in the sector unit in sequence. Taking the above example, the error data of the error bitmap corresponding to this sector unit is 00000111, which is 0xE0 in hexadecimal.

[0050] Specifically, after obtaining the error bitmap, the error recording device writes the error bitmap into the data storage device.

[0051] In one embodiment of this application, the user can also send information to the error recording device to read erroneous sectors, in order to understand which sectors have experienced uncorrectable errors. See also... Figure 4 and Figure 5 , Figure 4 This is a flowchart illustrating an embodiment of the error reading method provided in this application;

[0052] Figure 5 This is a flowchart illustrating the application of the error reading method in the error recording device provided in this application.

[0053] Step 41: In response to the read command, retrieve the entry for the sector cell.

[0054] Specifically, after receiving an error read command from a user or host, the error recording device obtains the entry for that sector cell based on the sector cell address in the read command.

[0055] Specifically, the error recording device determines whether the entry in the sector unit is a preset specific value; if so, it reads the error bitmap in the redundant space of the sector unit based on the entry in the sector unit; if not, it returns the location information of the target sector corresponding to the sector unit to locate the target sector where the uncorrectable error occurred.

[0056] Specifically, after obtaining the entry of a sector unit, the error recording device determines whether the value of the entry is a preset specific value corresponding to WUE. This preset specific value indicates that all sectors corresponding to the sector unit are in the UNC state.

[0057] Optionally, if the error recording device obtains a value for an entry that is equal to a preset specific value, it outputs to the user on the display screen the sector number corresponding to the sector unit and a message that all sectors in the sector unit are UNC.

[0058] Step 42: Read the error bitmap in the redundant space of the sector cell based on the entry of the sector cell.

[0059] Optionally, when the value of the entry obtained by the error recording device is not a preset specific value, the error bitmap in the NAND flash memory corresponding to the entry will be read based on the entry. The specific structure of the error bitmap is the same as described in step 13 above, and will not be repeated here.

[0060] Memory chips, also known as flash memory, are a type of non-volatile storage that retains its data even when power is off. There are many variations of flash memory chips, among which NAND flash memory is commonly used in solid-state drives and mobile phone storage.

[0061] Specifically, after the error recording device reads the error bitmap, it parses the error bitmap to obtain the error data corresponding to the error bitmap.

[0062] Step 43: Locate the target sector where the uncorrectable error occurred based on the error bitmap data of the error bitmap.

[0063] Specifically, continue with Figure 3 Taking the error bitmap as an example, the error recording device will first determine whether the error data corresponding to the error bitmap is zero. If it is zero, the error recording device will directly return the information that all sectors in the sector unit corresponding to the error bitmap are valid to the host. At the same time, it will output the sector number corresponding to the sector unit and the message that all sectors in the sector unit are valid to the user on the display screen.

[0064] Specifically, when the error data is not zero, the error recording device parses the error bitmap data to obtain the value of each error bitmap data. It then identifies the sector corresponding to the second preset value and designates that sector as the target sector where an uncorrectable error has occurred. For ease of calculation, the second preset value can be 1. The specific value of the second preset value is determined by the user and is not limited here.

[0065] Specifically, after the error recording device obtains the number of the target sector where the uncorrectable error occurred, it will output the number to the user on the display screen, along with a message that the sector corresponding to the number in the sector unit is UNC.

[0066] After the error recording device provided in this application records the uncorrectable error sectors in 4K aligned and 4K misaligned sector units, the location information of the uncorrectable sector can be quickly obtained when reading the sector unit; and by using the redundant space in the data storage device to record the uncorrectable error sectors, no additional space needs to be allocated for storing and managing WUE, thus reducing the space overhead during runtime.

[0067] Unlike existing technologies, the error recording method provided in this application is applied to an error recording device. The error recording device, in response to a high-tech configuration command, acquires the target sector where an uncorrectable error has occurred. When the sector unit corresponding to the target sector is not 4K aligned, an error bitmap is created in the redundant space of the sector unit. Error data is written to the error bitmap using the location of the target sector. Compared to conventional error recording methods, this application's method of using an error recording device to create an error bitmap in the redundant space of the sector unit to record error data eliminates the need for additional storage space to record uncorrectable error sectors even when the hard disk is not 4K aligned, reducing additional space overhead. The error recording device provided in this application can record the specific location of uncorrectable error sectors in detail using the error bitmap, even when the disk is not 4K aligned, without requiring additional memory space for error recording. This simplifies the error recording operation steps and reduces the memory usage of error recording.

[0068] The method described in the above embodiments can be implemented using an error recording device, as described below. Figure 6 Describe, Figure 6 This is a schematic diagram of the structure of the first embodiment of the error recording device provided in this application.

[0069] like Figure 6 As shown, the error recording device 60 of this application embodiment includes an error acquisition module 61, a bitmap creation module 62, and a writing module 63.

[0070] Among them, the error acquisition module 61 is used to acquire the target sector where an uncorrectable error has occurred in response to a high-tech configuration command.

[0071] Bitmap creation module 62 is used to create an error bitmap in the redundant space of the sector unit when the sector unit corresponding to the target sector is not 4K aligned.

[0072] The writing module 63 is used to write error data into the error bitmap using the location of the target sector.

[0073] The method described in the above embodiments can be implemented using an error recording device, as described below. Figure 7 , Figure 7 This is a schematic diagram of the structure of the second embodiment of the error recording device provided in this application. The error recording device 70 includes a memory 71 and a processor 72. The memory 71 is used to store program data, and the processor 72 is used to execute the program data to implement the following method:

[0074] In response to the high-tech configuration command, the target sector where the uncorrectable error occurred is obtained; if the sector cell corresponding to the target sector is not 4K aligned, an error bitmap is created in the redundant space of the sector cell; the error data is written to the error bitmap using the location of the target sector.

[0075] See Figure 8 , Figure 8 This is a schematic diagram of an embodiment of the computer-readable storage medium 80 provided in this application. The computer-readable storage medium 80 stores program data 81, which, when executed by a processor, is used to implement the following method:

[0076] In response to the high-tech configuration command, the target sector where the uncorrectable error occurred is obtained; if the sector cell corresponding to the target sector is not 4K aligned, an error bitmap is created in the redundant space of the sector cell; the error data is written to the error bitmap using the location of the target sector.

[0077] When the embodiments of this application are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0078] The above description is merely an embodiment of this application and does not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.

Claims

1. An error recording method characterized by comprising: The error recording method comprises: in response to a high-technology configuration command, obtaining a target sector in which an uncorrectable error occurs; wherein the high-technology configuration command is an ATA command; when a sector unit corresponding to the target sector is not 4K-aligned, creating an error bitmap in a redundant space of the sector unit; the error bitmap is used to record uncorrectable error information of the sector unit; writing error data into the error bitmap by using a position of the target sector, comprising: setting error bitmap data of the target sector to a second preset value, and setting error bitmap data of the remaining sectors to a first preset value; generating the error bitmap based on the error bitmap data of all sectors in the sector unit.

2. The error recording method according to claim 1, wherein each sector in the sector unit corresponds to a bit number in the error bitmap; when the bit number is the first preset value, valid data is written into the corresponding sector; and when the bit number is the second preset value, the error data is written into the corresponding sector.

3. The error recording method according to claim 1, wherein after the target sector in which the uncorrectable error occurs is obtained, the method further comprises: when the sector unit corresponding to the target sector is 4K-aligned, changing a sector table entry of the sector unit to a preset specific value according to the target sector.

4. The error recording method according to claim 3, wherein the sector table entry is used to record a mapping relationship between a logical block address and a physical block address.

5. A method of error reading, characterized by, The error reading method comprises: in response to a read command, obtaining a table entry of a sector unit; the table entry is used to record a mapping relationship between a logical block address and a physical block address; judging whether the table entry of the sector unit is a preset specific value; the preset specific value represents that all sectors corresponding to the sector unit are in an uncorrectable error state; if yes, returning position information of all sectors corresponding to the sector unit to locate a target sector in which an uncorrectable error occurs; if no, reading an error bitmap in a redundant space of the sector unit based on the table entry of the sector unit; locating the target sector in which the uncorrectable error occurs according to error bitmap data of the error bitmap, comprising: analyzing the error bitmap data to obtain a value of each error bitmap data; obtaining a sector corresponding to the error bitmap data whose value is the second preset value; taking the corresponding sector as the target sector in which the uncorrectable error occurs.

6. An error recording apparatus characterized by comprising: The error recording device comprises a memory and a processor coupled with the memory; wherein the memory is used to store program data, and the processor is used to execute the program data to implement the error recording method according to any one of claims 1 to 4 and / or the error reading method according to claim 5.

7. A computer storage medium, characterized in that The computer storage medium is used to store program data, and the program data is used to implement the error recording method according to any one of claims 1 to 4 and / or the error reading method according to claim 5 when executed by a computer.

Citation Information

Patent Citations

  • Data recording / reproduction device and data recording / reproduction method

    US20050005193A1

  • Control circuit capable of identifying error data in flash memory and storage system and method thereof

    US20100325524A1