Data recovery method and device, computer equipment and storage medium
By obtaining and flashing LBA information when a solid-state drive fails, the problem of data loss after a solid-state drive failure is solved, and the reliability of data recovery and user experience are improved.
Patent Information
- Application Number
- CN202410703057.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-31
- Publication Date
- 2024-08-23
AI Technical Summary
When a solid-state drive fails, the cached data that is not flashed to the flash memory in time is lost due to a power outage. As a result, only old data with lower credibility can be used during data recovery, which reduces the overall credibility of the data recovery results and the user experience. experience.
When the solid-state drive is in the target state, the logical block address LBA information is obtained and written to the flash memory. When the solid-state drive is in the non-target state, it is restored to the solid-state drive. User data is marked to distinguish old data from reliable data to improve the accuracy of data recovery results. reliability.
By flashing and restoring LBA information to flash memory, it ensures that old data can be identified and processed during data recovery, improving the overall reliability and user experience of data recovery results.
Smart Images

Figure CN118535098A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a data recovery method, device, computer equipment and storage medium. Background Art
[0002] The storage system is a system used to store programs and data in a computer. It consists of various storage devices and control components, and includes hardware and software for managing information scheduling. It should be understood that the storage system is a very important part of a computer. It ensures the secure storage and efficient access of data through a variety of storage technologies and devices. Whether it is an individual user or an enterprise, choosing the right storage system is crucial to ensure the efficiency and security of data processing.
[0003] When a storage system fails, for example, in the same storage load environment, a firmware batch problem causes multiple SSDs (Solid State Drives) to fail in a short period of time, which may cause the entire storage system to be paralyzed. At this time, if the upper-layer system disaster recovery mechanism cannot restore the business, then SSD disk data recovery will be the last attempt to save the entire storage system.
[0004] However, in the relevant SSD data recovery solutions, for the cached data that cannot be written to the flash memory in time when the failure occurs, once the SSD is unplugged or the storage system is powered off, the cached data will be lost due to power failure, resulting in that when the data is recovered for the SSD, only the old data corresponding to the cached data can be obtained from the flash memory, and the credibility of the old data is low, which reduces the overall credibility of the data recovery results for the SSD and affects the user experience. Summary of the invention
[0005] In view of this, the present invention provides a data recovery method, apparatus, computer device and storage medium to solve the problem of low overall credibility of SSD data recovery results.
[0006] In a first aspect, the present invention provides a data recovery method, characterized in that the method comprises:
[0007] When the solid state drive is detected to be in a target state, obtaining logical block address LBA information in the solid state drive, wherein the target state is used to indicate that the solid state drive cannot respond to data management instructions for itself, and the LBA information is used to indicate a logical address of user data cached in the solid state drive;
[0008] Flash the LBA information to the flash memory;
[0009] When the solid state drive is in a non-target state, the LBA information is restored to the solid state drive, so as to mark the user data in the solid state drive according to the LBA information.
[0010] In an optional implementation, obtaining logical block address LBA information in a solid state drive includes:
[0011] Obtaining global information corresponding to a cache page in the solid-state drive, wherein the cache page is used to cache received user data and write the user data into the flash memory, and the global information is used to indicate a storage state of the cache page;
[0012] Based on the global information, sequentially matching the storage state of each cache page in the solid-state drive to obtain a target cache page in a preset storage state, wherein the preset storage state is used to indicate that the target cache page contains cached user data;
[0013] Acquire control metadata in the target cache page, wherein the control metadata is used to identify attributes of user data cached in the target cache page;
[0014] The LBA information in the target cache page is read in the control metadata.
[0015] In an embodiment of the present invention, considering that the number of cache units contained in a cache page is very large, when obtaining LBA information, it takes a long time to traverse each cache page in the solid-state drive to obtain the LBA information. Therefore, the present invention can only search for the LBA information of the target cache page containing the cached user data, thereby reducing the time consumption of obtaining LBA information and saving computing resources.
[0016] In an optional implementation, reading LBA information in the target cache page in the control metadata includes:
[0017] Obtaining index information corresponding to the target cache page, wherein the index information is used to indicate a cache unit in the target cache page that contains cached user data, and the cache unit is used to indicate a basic storage unit for caching data in the target cache page;
[0018] According to the index information, traverse each cache unit in the target cache page to obtain the control metadata corresponding to each cache unit;
[0019] Read the control metadata and obtain the LBA information.
[0020] In an embodiment of the present invention, each cache unit in the target cache page can be traversed according to the index information to obtain sub-LBA information, and then the sub-LBA information can be summarized to generate LBA information, providing a technical basis for determining the target data according to the LBA information as described below.
[0021] In an optional implementation, the storage state of the cache page includes: an idle state, an allocated state, and a full storage state, wherein the idle state is used to indicate that the cache page does not contain cached user data, and the allocated state and the full storage state are used to indicate that the cache page contains cached user data;
[0022] The method further includes:
[0023] Monitor the storage status of each cache page in the solid-state drive and obtain a status array;
[0024] Determine global information from the state array.
[0025] In an embodiment of the present invention, a status array can be generated based on the storage status of each cache page in the solid-state drive, and global information can be determined based on the status array to filter the target cache page based on the global information and obtain the LBA information of the target cache page, thereby reducing the time consumption of obtaining the LBA information and saving computing resources.
[0026] In an optional implementation, writing the LBA information into the flash memory includes:
[0027] In response to the cache instruction, cache the LBA information to a preset storage location;
[0028] After the cache instruction is executed, the LBA information in the preset storage location is flushed to the flash memory.
[0029] Considering that the SSD cannot respond to IO instructions to perform data interaction operations when it is in a faulty state, the LBA information of the SSD can be read by the controller manager and stored in the corresponding preset storage area to avoid the loss of LBA information after the SSD loses power.
[0030] In an optional implementation, when the solid state drive is in a non-target state, restoring the LBA information to the solid state drive includes:
[0031] A target cache page corresponding to the LBA information is determined in the solid state drive, and the LBA information is restored to the target cache page.
[0032] In an embodiment of the present invention, user data recovered from a solid state drive may be marked to mark target data as old data, so that in subsequent processing of the user data, the old data that needs to be referenced can be identified, thereby improving the overall reliability of the data recovery results.
[0033] In an optional implementation, marking user data in the solid state drive according to LBA information includes:
[0034] The LBA information is fed back to the data recovery service through a preset interface, so that the data recovery service can mark the user data that matches the LBA information when reading data in the solid-state drive.
[0035] In an embodiment of the present invention, user data recovered from a solid state drive may be marked to mark target data as old data, so that in subsequent processing of the user data, the old data that needs to be referenced can be identified, thereby improving the overall reliability of the data recovery results.
[0036] In a second aspect, the present invention provides a data recovery device, the device comprising:
[0037] an acquisition module, for acquiring logical block address LBA information in the solid-state drive when the solid-state drive is detected to be in a target state, wherein the target state is used to indicate that the solid-state drive cannot respond to data management instructions for itself, and the LBA information is used to indicate a logical address of user data cached in the solid-state drive;
[0038] A flashing module, used for flashing LBA information into the flash memory;
[0039] The marking module is used to restore the LBA information to the solid-state hard disk when the solid-state hard disk is in a non-target state, so as to mark the user data in the solid-state hard disk according to the LBA information.
[0040] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the data recovery method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0041] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the data recovery method of the first aspect or any corresponding embodiment thereof.
[0042] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions for causing a computer to execute the data recovery method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0044] Figure 1 is a flow chart of a data recovery method according to an embodiment of the present invention;
[0045] Figure 2 is a flow chart of another data recovery method according to an embodiment of the present invention;
[0046] Figure 3 It is a schematic diagram of the structure of the cache page;
[0047] Figure 4 is an architectural diagram of a solid state drive according to an embodiment of the present invention;
[0048] Figure 5 is a structural block diagram of a data recovery device according to an embodiment of the present invention;
[0049] Figure 6 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0050] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0051] In conjunction with the application scenarios on which the execution of the data recovery method depends, the application scenarios are described here.
[0052] The storage system is a system used to store programs and data in a computer. It consists of various storage devices and control components, and includes hardware and software for managing information scheduling. It should be understood that the storage system is a very important part of a computer. It ensures the secure storage and efficient access of data through a variety of storage technologies and devices. Whether it is an individual user or an enterprise, choosing the right storage system is crucial to ensure the efficiency and security of data processing.
[0053] When a storage system fails, for example, in the same storage load environment, a firmware batch problem causes multiple SSDs (Solid State Drives) to fail in a short period of time, which may cause the entire storage system to be paralyzed. At this time, if the upper-layer system disaster recovery mechanism cannot restore the business, then SSD disk data recovery will be the last attempt to save the entire storage system.
[0054] However, in the relevant SSD data recovery solutions, for the cached data that cannot be written to the flash memory in time when a failure occurs, once the SSD is unplugged or the storage system is powered off, the cached data will be lost due to power failure, resulting in that when data recovery is performed on the SSD, only the old data corresponding to the cached data can be obtained from the flash memory, and the credibility of the old data is low, which reduces the overall credibility of the data recovery results for the SSD and affects the user experience.
[0055] Based on this, an embodiment of the present invention provides a data recovery method, which can first obtain the logical block address LBA information in the solid-state hard disk when the solid-state hard disk is detected to be in the target state, wherein the target state is used to indicate that the solid-state hard disk cannot respond to the data management instructions for itself, and the LBA information is used to indicate the logical address of the user data cached in the solid-state hard disk. Then, the LBA information can be flushed to the flash memory, and when the solid-state hard disk is in a non-target state, the LBA information can be restored to the solid-state hard disk to mark the user data in the solid-state hard disk according to the LBA information, so that the target data can be determined as old data with low reliability, so that the old data can be marked in the data recovery result, thereby improving the overall reliability of the data recovery result, and thus improving the user experience.
[0056] According to an embodiment of the present invention, a data recovery method embodiment is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0057] In this embodiment, a data recovery method is provided, which can be used in a storage system in a computer device. Figure 1 is a flow chart of a data recovery method according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:
[0058] Step S101, when it is monitored that the solid-state drive is in a target state, obtain the logical block address LBA information in the solid-state drive, wherein the target state is used to indicate that the solid-state drive cannot respond to data management instructions for itself, and the LBA information is used to indicate the logical address of the user data cached in the solid-state drive.
[0059] In an embodiment of the present invention, the above-mentioned target state can be used to indicate that a solid state drive (Solid State Drive, hereinafter referred to as SSD) is in a fault state. At this time, the SSD cannot respond to data management instructions sent by the storage system. The data management instructions may include NVME (Non-Volatile Memory Express, storage device communication protocol) instructions. At this time, the SSD cannot flush the cached user data to the flash memory.
[0060] At this time, the above-mentioned logical block address LBA information can be obtained in the SSD, and the LBA information can be written to the flash memory to save the LBA information. Here, the flash memory can be a NAND (Not AND, non-volatile storage technology) flash memory. It should be understood that the SSD can cache the user data sent by the host and write the user data to the physical address assigned to it in the NAND according to the LBA information.
[0061] Step S102, writing the LBA information into the flash memory.
[0062] In the embodiment of the present invention, it can be seen from the above that when the solid state drive is in the target state, the latest user data cached therein cannot be written to the flash memory, so the old data corresponding to the user data is stored in the target address of the flash memory at this time. Therefore, the LBA information corresponding to the old data can be obtained and written to the flash memory to prevent the LBA information from being lost due to a power failure of the SSD.
[0063] Step S103, when the solid state drive is in a non-target state, the LBA information is restored to the solid state drive, so as to mark the user data in the solid state drive according to the LBA information.
[0064] In an embodiment of the present invention, after detecting that the SSD is powered on and operating normally, it can be determined that the SSD is in a non-target state. At this time, data recovery can be performed on the SSD. Specifically, the user data in the SSD can be recovered, and the L2P (Logical To Physical Table, a mapping table of logical blocks to physical blocks, i.e., FTL mapping table) corresponding to the user data can be rebuilt, and the LBA information can be restored to the solid-state drive at the same time. The L2P can be used to indicate the mapping relationship between the logical address of the user data sent from the Host and the physical address allocated to it in the flash memory, thereby ensuring that the data written to the flash memory can be recovered during the data recovery process.
[0065] As can be seen from the above, when the SSD is in the target state, the latest user data cached therein cannot be written to the flash memory. Therefore, the old data corresponding to the user data is stored in the target address of the flash memory at this time, and the reliability of the old data is poor. Therefore, the above LBA information can be restored to the SSD to mark the old data in the SSD through the LBA information, so that the upper system of the storage system reads the corresponding LBA information when reading the user data in the SSD, thereby distinguishing the read old data from the reliable data to decide whether to enable the old data.
[0066] For example, if the user data includes a document to be restored, only the reliable data in the document can be restored, and the unreliable old data can be discarded. Alternatively, in the restored document, the old data can be marked, for example, the old data can be highlighted. The specific old data processing strategy can be configured according to the specific usage scenario, and the present invention does not specifically limit this.
[0067] It can be known from the above description that in an embodiment of the present invention, first, when it is detected that the solid-state drive is in the target state, the logical block address LBA information can be obtained in the solid-state drive, and the LBA information can be written to the flash memory, wherein the target state is used to indicate that the solid-state drive cannot respond to the data management instructions for itself, and the LBA information is used to indicate the logical address of the user data cached in the solid-state drive. Then, the LBA information can be written to the flash memory, and when the solid-state drive is in a non-target state, the LBA information can be restored to the solid-state drive, so as to mark the user data in the solid-state drive according to the LBA information, so that the target data can be determined as old data with low reliability, so as to mark the old data in the data recovery result, thereby improving the overall reliability of the data recovery result, and thus improving the user experience.
[0068] In this embodiment, another data recovery method is provided, which can be used in a storage system in a computer device. Figure 2 is a flow chart of another data recovery method according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0069] Step S201, when it is monitored that the solid-state drive is in a target state, obtain the logical block address LBA information in the solid-state drive, wherein the target state is used to indicate that the solid-state drive cannot respond to data management instructions for itself, and the LBA information is used to indicate the logical address of the user data cached in the solid-state drive.
[0070] Specifically, the above step S201 includes:
[0071] Step S2011, obtaining global information corresponding to a cache page in the solid state drive, wherein the cache page is used to cache received user data and write the user data into a flash memory, and the global information is used to indicate a storage status of the cache page.
[0072] Step S2012, based on the global information, sequentially match the storage status of each cache page in the solid state drive to obtain a target cache page in a preset storage status, wherein the preset storage status is used to indicate that the target cache page contains cached user data.
[0073] Step S2013: acquiring control metadata in the target cache page, wherein the control metadata is used to identify the attributes of the user data cached in the target cache page.
[0074] Step S2014, reading the LBA information in the target cache page in the control metadata.
[0075] In an embodiment of the present invention, multiple LUN (Logical Unit Number) resources can be pre-divided in the SSD, and the LUN is used to cache the acquired user data. At the same time, the LUN is also a basic unit for executing read, write, and erase commands to the flash memory. Specifically, each LUN resource includes at least two cache pages, so that the operation of flushing data to the flash memory is performed alternately based on the cache pages.
[0076] It should be understood that when SSD stores data, it can use a cache unit (write buffer) as a basic storage unit. One cache unit can be used to store 4k of data. In addition, the cache unit can also be called a data frame (hereinafter referred to as df, i.e., data frame).
[0077] In SSD, cache units can be grouped according to the size of the page in the flash memory. For example, in TLC (Triple Level Cell, a storage technology that can store three bits of data in a single storage cell) type flash memory, each layer of page contains 4 dfs (which can be expressed as df0-df4), then a TLC page buffer contains a total of 12 df-sized write buffers.
[0078] Next, according to the RAID5 mechanism (Redundant Array of Independent Disks 5, a disk array technology), a cache page containing 16 TLC page buffers can be configured. The cache page can be represented as a superpage buffer. Here, Figure 3 The figure shows a schematic diagram of the structure of the cache page, in which a super page buffer can include 15 TLC page buffers for caching user data (i.e., page0-page14 in the figure) and 1 TLC page buffer for storing verification data (i.e., page15 in the figure), and the verification data is used to verify the user data in the super page buffer.
[0079] Considering that when obtaining LBA information, it is often necessary to search each cache unit in the cache page, and the number of cache units contained in each cache page is very large, it is time-consuming and unnecessary to traverse each cache page in the SSD to obtain LBA information. Therefore, in the present invention, global information can be obtained to search for a target cache page in a preset storage state based on the global information, so that only the LBA information in the target cache page needs to be searched.
[0080] Step S202: Write the LBA information to the flash memory. Figure 1 Step S102 of the illustrated embodiment will not be described in detail here.
[0081] Step S203, when the solid state drive is in a non-target state, the LBA information is restored to the solid state drive, so as to mark the user data in the solid state drive according to the LBA information.
[0082] In an embodiment of the present invention, considering that the number of cache units contained in a cache page is very large, when obtaining LBA information, it takes a long time to traverse each cache page in the SSD to obtain the LBA information. Therefore, the present invention can only search for the LBA information of the target cache page containing the cached user data, thereby reducing the time for obtaining LBA information and saving computing resources.
[0083] In some optional implementations, the above step S2014 includes:
[0084] Step a1, obtaining index information corresponding to the target cache page, wherein the index information is used to indicate the cache unit containing cached user data in the target cache page, and the cache unit is used to indicate the basic storage unit for caching data in the target cache page.
[0085] Step a2: traverse each cache unit in the target cache page according to the index information to obtain the control metadata corresponding to each cache unit.
[0086] Step a3, read the control metadata to obtain LBA information.
[0087] In the embodiment of the present invention, Figure 3 It can be seen that the cache unit df contains a 4k Bytes cache space for storing user data and a 16 Bytes controlmeta (control metadata) for storing the sub-LBA information corresponding to the user data. The sub-LBA information is used to indicate the logical address of the user data cached in the corresponding df and the corresponding physical address in the flash memory. Based on this, when obtaining the LBA information corresponding to the target cache page, the sub-LBA information stored in the control meta of each df in the target cache page can be obtained respectively to summarize the sub-LBA information and obtain the LBA information.
[0088] In specific implementation, the index information (i.e., entry_index) field of the above-mentioned target cache page can be read first. The index information is used to indicate the number of cache units in the target cache page that contain cached user data, that is, how many 4k user data the target cache page has received, and at the same time, the offsetindex (i.e., offset index) of the df that is about to receive the user data is identified.
[0089] When traversing each cache unit in the target cache page according to the above index information, it can be determined whether the number of traversed cache units matches the index information. If it matches, the traversal is terminated. If not, the cache units not identified by diff are traversed until the traversal is terminated.
[0090] In an embodiment of the present invention, each cache unit in the target cache page can be traversed according to the index information to obtain sub-LBA information, and then the sub-LBA information can be summarized to generate LBA information, providing a technical basis for determining the target data according to the LBA information as described below.
[0091] In some optional implementations, the storage state of the cache page includes: an idle state, an allocated state, and a full storage state, wherein the idle state is used to indicate that the cache page does not contain cached user data, and the allocated state and the full storage state are used to indicate that the cache page contains cached user data, and the step S201 further includes:
[0092] Step b1, monitoring the storage status of each cache page in the solid state drive to obtain a status array.
[0093] Step b2, determining global information according to the state array.
[0094] In the embodiment of the present invention, when managing the cache page, there are two important fields, namely the index information field and the storage state (buf_state) field. As can be seen from the above, the storage state can include an idle state, an allocated state and a full storage state.
[0095] Specifically, the idle state (i.e., buf_state_idle) may indicate that the cache page has not been allocated. The allocated state (i.e., buf_state_used) indicates that the cache page has been allocated, but the cache page is not yet full. The full storage state (i.e., buf_state_programming) indicates that the cache page is full and the user data in it needs to be flushed to the flash memory. At this time, the buf_state field of the cache page can be modified to the programming state.
[0096] Based on this, in the present invention, the storage status field of each cache page in the SSD can be monitored to obtain a status array (i.e., buf_state_array). The status data can be used as global information in the SSD, thereby instructing the SSD to determine the target cache page based on the global information. The specific method for determining the target cache page is as described in the embodiment corresponding to the above step S2012, and will not be repeated here.
[0097] In an embodiment of the present invention, a status array can be generated based on the storage status of each cache page in the SSD, and global information can be determined based on the status array to filter the target cache page based on the global information and obtain the LBA information of the target cache page, thereby reducing the time consumption of obtaining the LBA information and saving computing resources.
[0098] In some optional implementations, the above step S102 includes:
[0099] Step S11, in response to the cache instruction, cache the LBA information to a preset storage location.
[0100] Step S12, after the cache instruction is executed, the LBA information in the preset storage location is flushed to the flash memory.
[0101] In an embodiment of the present invention, the above-mentioned preset storage location is a storage location in a computer device for storing RAS (a general term for technologies related to the reliability, availability, and serviceability of a computer system) information. The RAS information may include processor memory information, key log information, and system configuration information, etc. Therefore, the preset storage location corresponding to the RAS information may be a log file, a system management tool, a hardware component, etc., and the present invention does not specifically limit this.
[0102] In the above-mentioned preset storage location, firstly, a cache_lba area can be opened for the above-mentioned LBA information, so as to cache the LBA information in the cache_lba area in response to the cache instruction. Specifically, the LBA information can be cached in the cache_lba area through the CM (ControllerManager) in the SSD, wherein, in the present invention, the CM is mainly responsible for managing the RAS information of the computer device, and is also responsible for writing the RAS information into the flash memory.
[0103] Specifically, after caching the LBA information of all target cache pages in the SSD in response to the cache instruction, it can be determined that the execution of the cache instruction is completed. At this time, the LBA information in the RAS information can be flushed to the flash memory, thereby avoiding the loss of LBA information after the computer device is powered off.
[0104] In an embodiment of the present invention, considering that the SSD cannot respond to IO instructions to perform data interaction operations when it is in a faulty state, the LBA information of the SSD can be read through the CM and stored in a preset storage area corresponding to the RAS information to avoid the loss of LBA information after the SSD loses power.
[0105] In some optional implementations, the above step S103 includes:
[0106] The LBA information is fed back to the data recovery service through a preset interface, so that the data recovery service can mark the user data that matches the LBA information when reading data in the solid-state drive.
[0107] In an embodiment of the present invention, the data recovery service is a service for managing data recovery tasks in the SSD during fault recovery in the storage system. When performing data recovery of the SSD, the host can first be instructed to stop writing data to the SSD and monitor whether the target cache page is available. When the target cache page is available, the target data and the corresponding LBA information can be restored to the target cache page, and at the same time, the LBA information can be restored to the control meta of the target cache page.
[0108] Next, the LBA information can be fed back to the data recovery service at the upper layer of the storage system through a preset interface, so that when the data recovery service reads the data in the SSD, it can identify the user data corresponding to the LBA information, mark the user data as old data, and analyze the reliability of the old data.
[0109] For example, the reliability of the old data may be determined according to the corresponding storage time of the old data. For example, the closer the storage time of the old data is to the data with higher reliability in the user data, the higher the reliability of the old data.
[0110] In an embodiment of the present invention, user data recovered from the SSD can be marked to mark target data as old data, so that in the subsequent processing of the user data, the old data that needs to be referenced can be identified, thereby improving the overall reliability of the data recovery results.
[0111] In summary, in an embodiment of the present invention, first, when it is detected that the solid-state drive is in the target state, the logical block address LBA information can be obtained in the solid-state drive, and the LBA information can be written to the flash memory, wherein the target state is used to indicate that the solid-state drive cannot respond to data management instructions for itself, and the LBA information is used to indicate the logical address of the user data cached in the solid-state drive. Then, the LBA information can be written to the flash memory, and when the solid-state drive is in a non-target state, the LBA information can be restored to the solid-state drive, so that the user data in the solid-state drive can be marked according to the LBA information, so that the target data can be determined as old data with low reliability, so that the old data can be marked in the data recovery result, thereby improving the overall reliability of the data recovery result, and thus improving the user experience.
[0112] In this embodiment, an SSD is also provided, and the SSD is used to implement the above embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. Figure 4The following is the architecture diagram of the SSD. The SSD includes: a host, a firmware system and a flash memory. The firmware system includes a DM (Data Manager), a LKM (Linux Kernel Module) and the above-mentioned CM:
[0113] The host is used to obtain user data and transfer the user data to the SSD.
[0114] DM is used to respond to IO commands such as reading and writing user data sent by the Host, and in the IO write process, split the IO command into IO requests with a granularity of 4k and send them to the LKM, so that the LKM allocates a cache unit for the user data.
[0115] In the embodiment of the present invention, DM is the front-end firmware core of the SSD facing the Host (running on the CPU hardware core), and the LKM can notify the DM of the address of the applied cache unit so that the DM can move the user data from the Host to the SSD, and the user data movement is completed through the LKM.
[0116] LKM is used to allocate cache units for user data and update LBA information according to the user data in the cache units.
[0117] CM is used to obtain the above-mentioned LBA information when the SSD is in the above-mentioned target state, cache the LBA information in the cache_lba area of the above-mentioned preset storage location, and flush the LBA information to the flash memory, so that the upper-layer data recovery service in the storage system determines the target data in the recovery result according to the LBA information.
[0118] The flash memory is used to restore the LBA information stored in the SSD when recovering data from the SSD, so as to mark the old data according to the LBA information.
[0119] In this embodiment, a data recovery device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0120] This embodiment provides a data recovery device, such as Figure 5 As shown, including:
[0121] The acquisition module 501 is used to acquire the logical block address LBA information in the solid-state drive when the solid-state drive is detected to be in the target state, wherein the target state is used to indicate that the solid-state drive cannot respond to the data management instruction for itself, and the LBA information is used to indicate the logical address of the user data cached in the solid-state drive;
[0122] Flashing module 502, used for flashing LBA information into flash memory;
[0123] The marking module 503 is used to restore the LBA information to the solid state drive when the solid state drive is in a non-target state, so as to mark the user data in the solid state drive according to the LBA information.
[0124] In some optional implementations, the acquisition module 501 includes:
[0125] A first acquisition unit, configured to acquire global information corresponding to a cache page in the solid state drive, wherein the cache page is used to cache received user data and write the user data into a flash memory, and the global information is used to indicate a storage state of the cache page;
[0126] A matching unit, configured to sequentially match the storage state of each cache page in the solid-state drive based on the global information to obtain a target cache page in a preset storage state, wherein the preset storage state is used to indicate that the target cache page contains cached user data;
[0127] A second acquisition unit is used to acquire control metadata in a target cache page, wherein the control metadata is used to control the target cache page to write cached user data into the flash memory;
[0128] The reading unit is used to read the LBA information in the target cache page in the control metadata.
[0129] In some optional embodiments, the reading unit includes:
[0130] An acquisition subunit is used to acquire index information corresponding to a target cache page, wherein the index information is used to indicate a cache unit in the target cache page that contains cached user data, and the cache unit is used to indicate a basic storage unit for caching data in the target cache page;
[0131] The traversal subunit is used to traverse each cache unit in the target cache page according to the index information to obtain the control metadata corresponding to each cache unit;
[0132] The reading subunit is used to read the control metadata and obtain the LBA information corresponding to each cache unit.
[0133] In some optional implementations, the storage state of the cache page includes: an idle state, an allocated state, and a full storage state, wherein the idle state is used to indicate that the cache page does not contain cached user data, and the allocated state and the full storage state are used to indicate that the cache page contains cached user data; the acquisition module 501 further includes:
[0134] A monitoring unit, used to monitor the storage status of each cache page in the solid state drive to obtain a status array;
[0135] A determination unit is used to determine global information according to a state array.
[0136] In some optional implementations, the acquisition module 501 further includes:
[0137] A cache unit, for caching the LBA information to a preset storage location in response to a cache instruction;
[0138] The flash unit is used to flash the LBA information in the preset storage location to the flash memory after the cache instruction is executed.
[0139] In some optional implementations, the recovery module 502 includes:
[0140] The data recovery unit is used to determine the target cache page corresponding to the LBA information in the solid state drive and restore the LBA information to the target cache page.
[0141] In some optional implementations, the marking module 503 further includes:
[0142] A feedback unit, used to feed back the LBA information to the data recovery service through a preset interface, so that the data recovery service determines the target physical address indicated by the LBA information in the solid-state drive, wherein the data recovery service is used to manage data recovery tasks of the solid-state drive;
[0143] The marking unit is used to mark the user data corresponding to the target physical address.
[0144] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0145] The data recovery device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0146] The embodiment of the present invention also provides a computer device having the above Figure 5The data recovery device shown.
[0147] See also Figure 6 , Figure 6 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 6 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 6 A processor 10 is taken as an example.
[0148] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0149] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.
[0150] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0151] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0152] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.
[0153] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0154] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.
[0155] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A data recovery method, characterized in that: The method comprises: When the solid-state drive is detected to be in a target state, obtaining logical block address LBA information in the solid-state drive, wherein the target state is used to indicate that the solid-state drive cannot respond to a data management instruction for itself, and the LBA information is used to indicate a logical address of user data cached in the solid-state drive; Flashing the LBA information into the flash memory; When the solid state drive is in a non-target state, the LBA information is restored to the solid state drive, so as to mark the user data in the solid state drive according to the LBA information.
2. The method according to claim 1, characterized in that The obtaining of the logical block address LBA information in the solid state drive includes: Acquire global information corresponding to a cache page in the solid-state drive, wherein the cache page is used to cache received user data and write the user data into the flash memory, and the global information is used to indicate a storage state of the cache page; Based on the global information, sequentially matching the storage status of each cache page in the solid-state drive to obtain a target cache page in a preset storage status, wherein the preset storage status is used to indicate that the target cache page contains cached user data; Acquire control metadata in the target cache page, wherein the control metadata is used to identify attributes of user data cached in the target cache page; The LBA information in the target cache page is read in the control metadata.
3. The method according to claim 2, characterized in that The reading the LBA information in the target cache page in the control metadata includes: Acquire index information corresponding to the target cache page, wherein the index information is used to indicate a cache unit in the target cache page that contains cached user data, and the cache unit is used to indicate a basic storage unit for caching data in the target cache page; According to the index information, traverse each cache unit in the target cache page to obtain control metadata corresponding to each cache unit; The control metadata is read to obtain the LBA information.
4. The method according to claim 2, characterized in that: The storage state of the cache page includes: an idle state, an allocated state and a full storage state, wherein the idle state is used to indicate that the cache page does not contain cached user data, and the allocated state and the full storage state are used to indicate that the cache page contains cached user data; The method further comprises: Monitoring the storage status of each cache page in the solid state drive to obtain a status array; Global information is determined based on the state array.
5. The method according to claim 1, characterized in that The step of flashing the LBA information into the flash memory comprises: In response to a cache instruction, cache the LBA information to a preset storage location; After the execution of the cache instruction is completed, the LBA information in the preset storage location is flushed to the flash memory.
6. The method according to claim 1, characterized in that The restoring the LBA information to the solid state drive includes: A target cache page corresponding to the LBA information is determined in the solid state drive, and the LBA information is restored to the target cache page.
7. The method according to claim 1, characterized in that The marking the user data in the solid state drive according to the LBA information includes: The LBA information is fed back to the data recovery service through a preset interface, so that when the data recovery service reads data in the solid state drive, the user data matching the LBA information is marked.
8. A data recovery device, characterized in that: The device comprises: an acquisition module, configured to acquire logical block address LBA information in the solid-state drive when the solid-state drive is detected to be in a target state, wherein the target state is used to indicate that the solid-state drive cannot respond to a data management instruction for itself, and the LBA information is used to indicate a logical address of user data cached in the solid-state drive; A flash writing module, used for flashing the LBA information into a flash memory; The marking module is used to restore the LBA information to the solid-state hard disk when the solid-state hard disk is in a non-target state, so as to mark the user data in the solid-state hard disk according to the LBA information.
9. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the data recovery method according to any one of claims 1 to 7 by executing the computer instructions.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the data recovery method according to any one of claims 1 to 7.
Citation Information
Cited By
Record data processing method, device and system and electronic equipment
CN119201010A
