A file system recovery method and device on a flash memory device, an apparatus, and a medium
Patent Information
- Application Number
- CN202610832371.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-10
- Publication Date
- 2026-09-11
- Estimated Expiration
- 2046-06-10
AI Technical Summary
但主机侧参与恢复,需要占用主机大量运算资源与传输带宽,依赖主机系统驱动适配,适配性差且恢复流程繁琐;直接进行全盘镜像备份与还原,修复针对性极差,不仅恢复效率低下而且存储空间占用高
[0018] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the method described in the first aspect.
Smart Images

Figure CN122363994B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of electronic digital data processing technology, and specifically relates to a file system recovery method, apparatus, device and medium on a flash memory device. Background Technology
[0002] Flash memory devices, with their advantages of high speed, low power consumption, and strong shock resistance, have become the core medium for data storage. The file system, as the cornerstone of managing user data on flash memory devices, directly affects the availability of user data due to its integrity and reliability. However, in actual use, flash memory devices are highly susceptible to various anomalies, such as unexpected power outages, improper hot-swapping, flash media wear and bad block propagation, or virus attacks. These anomalies can all lead to the corruption of the file system on the flash memory device, resulting in the inability to read user data normally.
[0003] The flash management firmware inside a flash memory device deals with encrypted or randomized data after logical block address mapping. The flash management firmware itself cannot understand the meaning of the written data, making it difficult to accurately repair the file system. Therefore, existing technologies either require host-side participation in file system anomaly detection and recovery, or directly perform full disk image backup and restore. However, host-side participation in recovery requires a large amount of host computing resources and transmission bandwidth, relies on host system driver adaptation, has poor compatibility, and the recovery process is cumbersome; directly performing full disk image backup and restore has extremely poor repair targeting, resulting in low recovery efficiency and high storage space consumption. Summary of the Invention
[0004] This application provides a method, apparatus, device, and medium for recovering a file system on a flash memory device, with the aim of enabling the flash memory device to perform targeted and efficient autonomous backup and recovery of file system construction data.
[0005] In a first aspect, embodiments of this application provide a file system recovery method on a flash memory device, the method being executed by the flash memory device; the method includes: In response to a write instruction for file system construction data, the initial logical blocks in the file system construction data are parsed to obtain file system feature information, and the file system type is determined based on the file system feature information. The file system build data is copied to a preset backup area, and basic logical block write record information corresponding to the file system build data is generated. The target sum weight is determined based on the file system type, and the recovery reference value of each logical block in the basic logical block write record information is determined based on the target sum weight; logical blocks whose recovery reference values exceed a preset recovery reference value threshold are identified as candidate logical blocks; the candidate logical blocks are validated based on the basic logical block write record information, and the candidate logical blocks that pass the validation are identified as key logical blocks; the key logical blocks are marked to obtain the target logical block write record information; When the file system construction data is idle, the system identifies whether the file system is complete. If the file system is identified as incomplete, the system restores the file system construction data based on the target logical block write record information to restore the file system.
[0006] Furthermore, the target summation weights include the summation weights corresponding to the directory recovery reference value, file recovery reference value, and metadata recovery reference value, respectively; Accordingly, determining the recovery reference value of each logical block in the basic logical block write record information based on the target summation weight includes: For each logical block in the basic logical block write record information, the logical block is masked and the file system recovery is simulated based on the remaining logical blocks in the basic logical block write record information to obtain the directory recovery reference value, file recovery reference value and metadata recovery reference value corresponding to the logical block; Based on the summation weights corresponding to the directory recovery reference value, the file recovery reference value, and the metadata recovery reference value, a weighted summation is performed on the directory recovery reference value, the file recovery reference value, and the metadata recovery reference value to obtain the recovery reference value of the logical block.
[0007] Furthermore, the target summing weights include summing weights corresponding to the time series reference values and the structural reference values, respectively; Accordingly, determining the recovery reference value of each logical block in the basic logical block write record information based on the target summation weight includes: The reference relationships between logical blocks in the basic logical block write record information are determined according to the file system type; For each logic block in the basic logic block write record information, determine the writing order position of the logic block in the basic logic block write record information, and determine the number of times the logic block is referenced and the reference level depth according to the reference relationship; The timing reference value corresponding to the logic block is determined based on the write order position, and the structural reference value corresponding to the logic block is determined based on the number of references and the reference level depth. Based on the weighted summation of the timing reference value and the structural reference value, respectively, a weighted summation is performed on the timing reference value and the structural reference value to obtain the recovery reference value of the logic block.
[0008] Furthermore, the step of validating the candidate logic block based on the basic logic block write record information includes: Obtain the historical update count of each logic block in the basic logic block write record information; The relatively stable reference value corresponding to the candidate logic block is determined based on the historical update count; Candidate logic blocks whose relatively stable reference values exceed a preset stable reference value threshold are identified as candidate logic blocks that pass the validity check.
[0009] Furthermore, the step of recovering the file system construction data based on the target logical block write record information includes: The write order position corresponding to the key logic block is determined based on the write record information of the target logic block, and the key logic blocks are sorted according to the write order position to obtain the key logic block recovery sequence. The corresponding key logic blocks are restored sequentially according to the key logic block restoration sequence, and after the corresponding key logic blocks are restored, the logic blocks that have a reference relationship with the corresponding key logic blocks are restored. The target logic block is written into the record information and the unrecovered logic blocks are recovered sequentially according to the writing order.
[0010] Furthermore, the process of identifying whether file system build data is written to the idle state includes: The real-time write-free duration of the file system construction data is obtained, and if the real-time write-free duration reaches a preset duration threshold, the write-free state of the file system construction data is determined to be idle. or, Obtain the real-time size of the file system, and if the real-time size reaches a preset size, determine that the file system construction data writing is idle.
[0011] Secondly, embodiments of this application provide a file system recovery apparatus on a flash memory device, the apparatus being deployed on the flash memory device; the apparatus includes: The system type determination module is used to parse the initial logical blocks in the file system construction data in response to the write instruction of the file system construction data, obtain file system characteristic information, and determine the file system type based on the file system characteristic information. The write sequence recording module is used to copy the file system construction data to a preset backup area and generate basic logical block write record information corresponding to the file system construction data. The key marking module is specifically used for: determining the target sum weight based on the file system type, and determining the recovery reference value of each logical block in the basic logical block write record information based on the target sum weight; identifying logical blocks whose recovery reference values exceed a preset recovery reference value threshold as candidate logical blocks; performing validity verification on the candidate logical blocks based on the basic logical block write record information, and identifying the candidate logical blocks that pass the validity verification as key logical blocks; marking the key logical blocks to obtain the target logical block write record information; The file system recovery module is used to identify whether the file system is complete when the file system construction data is idle, and to recover the file system construction data based on the target logical block write record information when the file system is identified as incomplete, so as to recover the file system.
[0012] Furthermore, the target summation weights include the summation weights corresponding to the directory recovery reference value, file recovery reference value, and metadata recovery reference value, respectively; Accordingly, the key marker writing module is specifically used for: For each logical block in the basic logical block write record information, the logical block is masked and the file system recovery is simulated based on the remaining logical blocks in the basic logical block write record information to obtain the directory recovery reference value, file recovery reference value and metadata recovery reference value corresponding to the logical block; Based on the summation weights corresponding to the directory recovery reference value, the file recovery reference value, and the metadata recovery reference value, a weighted summation is performed on the directory recovery reference value, the file recovery reference value, and the metadata recovery reference value to obtain the recovery reference value of the logical block.
[0013] Furthermore, the target summing weights include summing weights corresponding to the time series reference values and the structural reference values, respectively; Accordingly, the key marker writing module is specifically used for: The reference relationships between logical blocks in the basic logical block write record information are determined according to the file system type; For each logic block in the basic logic block write record information, determine the writing order position of the logic block in the basic logic block write record information, and determine the number of times the logic block is referenced and the reference level depth according to the reference relationship; The timing reference value corresponding to the logic block is determined based on the write order position, and the structural reference value corresponding to the logic block is determined based on the number of references and the reference level depth. Based on the weighted summation of the timing reference value and the structural reference value, respectively, a weighted summation is performed on the timing reference value and the structural reference value to obtain the recovery reference value of the logic block.
[0014] Furthermore, the key marker writing module is specifically used for: Obtain the historical update count of each logic block in the basic logic block write record information; The relatively stable reference value corresponding to the candidate logic block is determined based on the historical update count; Candidate logic blocks whose relatively stable reference values exceed a preset stable reference value threshold are identified as candidate logic blocks that pass the validity check.
[0015] Furthermore, the file system recovery module is specifically used for: The write order position corresponding to the key logic block is determined based on the write record information of the target logic block, and the key logic blocks are sorted according to the write order position to obtain the key logic block recovery sequence. The corresponding key logic blocks are restored sequentially according to the key logic block restoration sequence, and after the corresponding key logic blocks are restored, the logic blocks that have a reference relationship with the corresponding key logic blocks are restored. The target logic block is written into the record information and the unrecovered logic blocks are recovered sequentially according to the writing order.
[0016] Furthermore, the file system recovery module is specifically used for: The real-time write-free duration of the file system construction data is obtained, and if the real-time write-free duration reaches a preset duration threshold, the write-free state of the file system construction data is determined to be idle. or, Obtain the real-time size of the file system, and if the real-time size reaches a preset size, determine that the file system construction data writing is idle.
[0017] Thirdly, embodiments of this application provide an electronic device including a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the method described in the first aspect.
[0018] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the method described in the first aspect.
[0019] In this embodiment, in response to a write instruction for file system construction data, the initial logical blocks in the file system construction data are parsed to obtain file system feature information, and the file system type is determined based on the file system feature information; the file system construction data is copied to a preset backup area, and basic logical block write record information corresponding to the file system construction data is generated; a target sum weight is determined based on the file system type, and a recovery reference value for each logical block in the basic logical block write record information is determined based on the target sum weight; logical blocks whose recovery reference values exceed a preset recovery reference value threshold are identified as candidate logical blocks; the candidate logical blocks are validated based on the basic logical block write record information, and candidate logical blocks that pass the validation are identified as key logical blocks; the key logical blocks are marked to obtain target logical block write record information; when the file system construction data is idle, the integrity of the file system is identified, and if the file system is identified as incomplete, the file system construction data is restored based on the target logical block write record information to restore the file system. The above-described file system recovery method on a flash memory device enables the flash memory device to perform targeted and efficient autonomous backup and recovery of file system construction data. Attached Figure Description
[0020] Figure 1 This is a flowchart illustrating a file system recovery method on a flash memory device provided in an embodiment of this application; Figure 2 This is a flowchart illustrating another file system recovery method on a flash memory device provided in an embodiment of this application; Figure 3 This is a flowchart illustrating another method for restoring a file system on a flash memory device provided in an embodiment of this application; Figure 4 This is a flowchart illustrating another method for restoring a file system on a flash memory device provided in an embodiment of this application; Figure 5 This is a schematic diagram of the structure of a file system recovery device on a flash memory device provided in an embodiment of this application; Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0021] To make the objectives, technical solutions, and advantages of this application clearer, specific embodiments of this application will be described in further detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are merely for explaining this application and not for limiting it. It should also be noted that, for ease of description, only the parts relevant to this application are shown in the drawings, not all of them. Before discussing exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe operations (or steps) as sequential processes, many of these operations can be performed in parallel, concurrently, or simultaneously. Furthermore, the order of the operations can be rearranged. The process can be terminated when its operation is completed, but may also have additional steps not included in the drawings. The process can correspond to a method, function, procedure, subroutine, subprogram, etc.
[0022] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.
[0023] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such terms can be used interchangeably where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0024] The following description, in conjunction with the accompanying drawings, details the file system recovery method, apparatus, device, and medium on the flash memory device provided in this application, through specific embodiments and application scenarios.
[0025] First, this application applies to scenarios where a file system on a flash memory device is backed up for recovery after file system corruption. Based on the above use case, it is understood that the entity executing this application can be a flash memory device.
[0026] The flash memory device can be any type of solid-state storage device that uses NAND flash memory as its core storage medium. In this solution, the flash memory device can specifically be an SSD (Solid State Drive).
[0027] The file system can be a disk file management format deployed within the flash memory device, used to manage the organization structure, index relationships, and read / write permissions of stored data. It serves as the underlying scheduling medium for data interaction between the host and the flash memory device. Specifically, the host can be a master terminal device running an operating system that can communicate and interact with the flash memory device.
[0028] Figure 1 This is a flowchart illustrating a file system recovery method on a flash memory device provided in an embodiment of this application. Figure 1 As shown, the specific steps include the following: S101, in response to the write instruction for file system construction data, the initial logical block in the file system construction data is parsed to obtain file system feature information, and the file system type is determined based on the file system feature information.
[0029] The file system build data is the physical data carrier on which the file system instance is stored. Once the complete file system build data is deployed in the flash memory device, it constitutes a usable file system. Specifically, the file system build data can be the underlying raw data used to build the file system architecture, which may include partition boot sector data, superblock data, and file system metadata, etc.
[0030] The write command for file system build data can be a write command issued by the host to write the file system build data to the flash memory device.
[0031] In one embodiment, the method of receiving write instructions for file system build data can be that the flash device receives write instructions for file system build data from the host through a front-end interface.
[0032] The initial logical block can be the first logical block (LBA 0) in the file system construction data. Specifically, a logical block can be the smallest logical addressing unit for data interaction between the flash memory device and the host. The host uniformly allocates logical addresses, corresponding to a contiguous physical flash memory storage space.
[0033] Among them, the file system characteristic information can be the file system's unique binary identifier.
[0034] In one embodiment, the method for parsing the initial logical blocks in the file system construction data to obtain file system feature information can be to read the original binary data of the initial logical blocks in the file system construction data, remove invalid sector padding data and redundant check data, and extract the fixed offset field specified by the file system protocol as the file system feature information.
[0035] The file system type can be a type of file system format, which may include NTFS, FAT32, EXT4, and exFAT file systems, etc.
[0036] In one embodiment, determining the file system type based on file system characteristic information can be achieved by pre-constructing a mapping table between file system characteristic information and file system types. The current file system characteristic information is then used as the query condition to search this mapping table to obtain the corresponding file system type. Specifically, the mapping table between file system characteristic information and file system types may include: if the file system characteristic information is EB 52 90, the corresponding file system type is NTFS; if the file system characteristic information is EB 58 90, the corresponding file system type is FAT32; if the file system characteristic information is 0xEF53, the corresponding file system type is EXT4; and if the file system characteristic information is EB 76 90, the corresponding file system type is exFAT.
[0037] S102, the file system construction data is copied to a preset backup area, and basic logical block write record information corresponding to the file system construction data is generated.
[0038] The preset backup area can be a storage area reserved inside the flash memory device specifically for backing up file system construction data, such as a contiguous physical block area.
[0039] In one embodiment, the method of copying file system build data to a preset backup area can be to asynchronously copy the file system build data to the preset backup area while the file system build data is being written to the user storage space.
[0040] Specifically, the logical block write record information can be a data structure that records the write information of each logical block. Correspondingly, the basic logical block write record information can be the logical block write record information initially generated during the data write process of file system construction.
[0041] In one embodiment, the method for generating basic logical block write record information corresponding to file system construction data can be to sequentially record the logical block identifier, logical address, and write timestamp of each logical block when writing to the file system construction data, thereby obtaining basic logical block write record information.
[0042] S103, determine the target summation weight according to the file system type, and determine the recovery reference value of each logical block in the basic logical block write record information based on the target summation weight; determine the logical blocks whose recovery reference values exceed the preset recovery reference value threshold as candidate logical blocks; perform validity verification on the candidate logical blocks according to the basic logical block write record information, and determine the candidate logical blocks that pass the validity verification as key logical blocks; mark the key logical blocks to obtain the target logical block write record information.
[0043] The target sum weight can be a set of weighting coefficients corresponding to the file system type, and each weighting coefficient corresponds to a feature dimension used to evaluate the importance of logical blocks.
[0044] In one embodiment, the method for determining the target sum weight based on the file system type can be to pre-build a mapping table between file system types and sum weights, and then query the mapping table using the current file system type as the query condition to obtain the corresponding target sum weight.
[0045] The recovery reference value can be a quantitative assessment value used to measure the criticality of logical blocks in file system recovery.
[0046] Among them, candidate logical blocks can be logical blocks that are initially determined to contain key file system information.
[0047] The preset recovery reference value threshold can be a lower limit of the recovery reference value used to filter out non-critical logic blocks with low recovery reference values.
[0048] If the recovery reference value of a logical block exceeds the preset recovery reference value threshold, it indicates that the logical block has high potential value or recovery necessity in the file system recovery process, and therefore the logical block can be identified as a candidate logical block.
[0049] Among them, the key logic block can be the core logic block that plays a decisive role in the integrity of the file system architecture, the availability of mounts, and the effectiveness of data indexes.
[0050] In one embodiment, the step of validating the candidate logic block based on the basic logic block write record information includes: obtaining the historical update count of each logic block in the basic logic block write record information; determining the relative stable reference value corresponding to the candidate logic block based on the historical update count; and determining the candidate logic block whose relative stable reference value exceeds a preset stable reference value threshold as a candidate logic block that passes the validity check.
[0051] It is understandable that during subsequent use of the flash memory device after the file system build data has been written, the file system build data in the flash memory device can be overwritten and updated.
[0052] Furthermore, the historical update count is the total number of times a logical block has been overwritten and updated since the file system was created.
[0053] In one embodiment, the method for obtaining the historical update count of each logical block in the basic logical block write record information can be to maintain a write counter for each logical block in the write operation record module of the flash memory device, and increment the counter by 1 each time a write command for that logical block is received.
[0054] The relatively stable reference value can be a quantitative value used to characterize the stability of the logical block content.
[0055] In one embodiment, the method for determining the relatively stable reference value corresponding to the candidate logic block based on the number of historical updates can be to sum the number of historical updates with 1 and divide 1 by the sum to obtain the relatively stable reference value.
[0056] The preset stability reference threshold can be a preset lower limit of stability reference value used to determine whether a candidate logic block is stable enough to be considered a reliable key logic block.
[0057] If the relative stability reference value of a candidate logical block exceeds the preset stability reference value threshold, it means that the candidate logical block is rarely modified during the use of the file system, its content has long-term stability, and can serve as a reliable basis for file system recovery. Therefore, the candidate logical block can be identified as having passed the validity check, that is, the candidate logical block can be identified as a critical logical block.
[0058] The advantage of this approach is that by introducing the historical update count of logical blocks as a stability criterion, it can effectively exclude frequently modified temporary data blocks or log blocks, ensuring that the critical logical blocks referenced during recovery have high stability and traceability, thereby improving the accuracy and reliability of file system recovery.
[0059] The target logic block write record information can be the logic block write record information that distinguishes between key logic blocks and ordinary logic blocks by adding a marker field to the basic logic block write record information.
[0060] In one embodiment, the method of marking key logic blocks in the basic logic block write record information to obtain the target logic block write record information can be achieved by setting a marker field in the basic logic block write record information and assigning the marker field corresponding to the identified key logic block as a key.
[0061] S104, when the file system construction data writing is idle, identify whether the file system is complete, and if the file system is identified as incomplete, restore the file system construction data based on the target logical block write record information to restore the file system.
[0062] In one embodiment, the method for identifying whether file system build data has been written to an idle state can be to use a flash device to check if the write cache is empty; if it is empty, then it is determined that the file system build data has been written to an idle state.
[0063] In one embodiment, the process of identifying whether file system build data is idle includes: obtaining the real-time no-write duration of the file system build data, and determining that the file system build data is idle when the real-time no-write duration reaches a preset duration threshold; or, obtaining the real-time size of the file system, and determining that the file system build data is idle when the real-time size reaches a preset size.
[0064] Among them, the real-time no-write duration can be the continuous idle time during which the host has no data to write, that is, the continuous time from the end of the last write operation on the flash memory device to the current moment.
[0065] In one embodiment, the real-time write-free duration of file system construction data can be obtained by using a timer built into the flash device to monitor the write instruction queue in real time, and starting the timer after the last write instruction is completed to continuously count the real-time write-free duration.
[0066] The preset duration threshold can be a pre-configured fixed idle waiting time parameter.
[0067] Among them, when the real-time no-write duration reaches the preset duration threshold, it means that no more file system-related write tasks will be issued in a short period of time, so it can be determined that the file system construction data writing is idle.
[0068] The real-time size of the file system can be the total storage space occupied by the written file system build data, such as the number of logical blocks that have been written.
[0069] In one embodiment, the real-time size of the file system can be obtained by using the management unit of the flash memory device to count the number of logical blocks that have been written as the real-time size of the file system.
[0070] The preset size can be the sum of the overall estimated size of the file system construction data and the preset redundancy size.
[0071] In one embodiment, when the real-time size of the file system reaches a preset size, it indicates that the file system build data has been written to the expected size, and there will be no more large-scale file system build data writing. Therefore, it can be determined that the file system build data writing is idle.
[0072] The advantage of this solution is that by using two independent judgment conditions—real-time no-write duration and real-time file system size—it can flexibly and accurately identify the idle time for writing data to the file system, avoid triggering file system integrity checks too early or too late, improve the timeliness and reliability of recovery operations, and reduce interference with the normal write process.
[0073] In one embodiment, the method for identifying whether a file system is complete can be to obtain the current file system characteristic information and compare the current file system characteristic information with the file system characteristic information parsed in response to the write instruction for file system construction data. If they are inconsistent, the file system is determined to be incomplete.
[0074] In one embodiment, the method of restoring file system construction data based on target logical block write record information can be as follows: according to the writing order of each key logical block in the target logical block write record information, the corresponding backup data is read from the preset backup area one by one according to the logical address of the key logical block and written back to the user storage space; and according to the writing order of each ordinary logical block in the target logical block write record information, the corresponding backup data is read from the preset backup area one by one according to the logical address of the ordinary logical block and written back to the user storage space.
[0075] In this embodiment, in response to a write instruction for file system construction data, the initial logical blocks in the file system construction data are parsed to obtain file system feature information, and the file system type is determined based on the file system feature information; the file system construction data is copied to a preset backup area, and basic logical block write record information corresponding to the file system construction data is generated; a target sum weight is determined based on the file system type, and a recovery reference value for each logical block in the basic logical block write record information is determined based on the target sum weight; logical blocks whose recovery reference values exceed a preset recovery reference value threshold are identified as candidate logical blocks; the candidate logical blocks are validated based on the basic logical block write record information, and candidate logical blocks that pass the validation are identified as key logical blocks; the key logical blocks are marked to obtain target logical block write record information; when the file system construction data is idle, the integrity of the file system is identified, and if the file system is identified as incomplete, the file system construction data is restored based on the target logical block write record information to restore the file system. The above-described file system recovery method on a flash memory device enables the flash memory device to perform targeted and efficient autonomous backup and recovery of file system construction data.
[0076] Figure 2 This is a flowchart illustrating another file system recovery method on a flash memory device provided in an embodiment of this application. Figure 2 As shown, the specific steps include the following: S201, in response to the write instruction for file system construction data, the initial logical block in the file system construction data is parsed to obtain file system feature information, and the file system type is determined based on the file system feature information.
[0077] S202, the file system construction data is copied to a preset backup area, and basic logical block write record information corresponding to the file system construction data is generated.
[0078] S203, determine the target summing weight according to the file system type; wherein, the target summing weight includes the summing weights corresponding to the timing reference value and the structural reference value respectively.
[0079] The timing reference value can be a quantified value used to characterize the importance of the order in which logical blocks are written; the structure reference value can be a quantified value used to characterize the importance of logical blocks in the file system reference structure.
[0080] Accordingly, the mapping table between file system type and summed weights can include: if the file system type is NTFS, the summed weights corresponding to the timing reference value and the structure reference value are 0.4 and 0.6, respectively; if the file system type is FAT32, the summed weights corresponding to the timing reference value and the structure reference value are 0.6 and 0.4, respectively; if the file system type is EXT4, the summed weights corresponding to the timing reference value and the structure reference value are 0.5 and 0.5, respectively; and if the file system type is exFAT, the summed weights corresponding to the timing reference value and the structure reference value are 0.5 and 0.5, respectively.
[0081] S204, determine the reference relationship between each logical block in the basic logical block write record information according to the file system type.
[0082] The reference relationship between logical blocks can be a logical association where one logical block points to another logical block through an internal pointer, index item, or metadata field.
[0083] In one embodiment, determining the reference relationships between logical blocks in the basic logical block write record information based on the file system type can be achieved by obtaining the metadata layout specification corresponding to the file system type, parsing the internal data structure of each logical block based on the metadata layout specification, and extracting the logical block address pointer field to construct a directed reference graph, thus obtaining the reference relationships between the logical blocks. The metadata layout specification can be a set of metadata storage formats, index pointer storage offsets, and block addressing rules predefined by the file system corresponding to the file system type.
[0084] S205, for each logic block in the basic logic block write record information, determine the writing order position of the logic block in the basic logic block write record information, and determine the number of times the logic block is referenced and the reference level depth according to the reference relationship.
[0085] The writing order position of the logic block in the basic logic block write record information can be the sequence number of the logic block in the basic logic block write record information.
[0086] In one embodiment, the method for determining the write order position of a logic block in the basic logic block write record information can be to traverse the basic logic block write record information and assign an incremental sequential number to each logic block according to the record order.
[0087] The number of times a logic block is referenced can refer to the total number of times the logic block is referenced by other logic blocks; the reference depth of a logic block can be the number of layers required to reach the farthest logic block from the starting point of the logic block along the reference direction.
[0088] In one embodiment, the method for determining the number of times a logical block is referenced and the reference level depth based on the reference relationship can be to perform graph traversal on the directed reference graph, calculate the in-degree of each node as the number of times it is referenced, and calculate the length of the longest path starting from that node as the reference level depth using a depth-first search algorithm.
[0089] S206, determine the timing reference value corresponding to the logic block according to the write order position, and determine the structural reference value corresponding to the logic block according to the number of references and the reference level depth.
[0090] In one embodiment, the timing reference value corresponding to the logic block can be determined based on the write order position by normalizing the write order position to the [0,1] interval. That is, the write order position is subtracted from the sum of the total number of logic blocks and 1, and the result of the subtraction is divided by the total number of logic blocks to obtain the timing reference value.
[0091] In one embodiment, the method of determining the structural reference value corresponding to the logic block based on the number of references and the reference level depth can be achieved by normalizing the number of references and the reference level depth to the [0,1] interval respectively, and taking the maximum value of the two normalization results as the structural reference value.
[0092] S207, according to the summation weights corresponding to the timing reference value and the structural reference value respectively, the timing reference value and the structural reference value are weighted and summed to obtain the recovery reference value of the logic block.
[0093] In one embodiment, the method of obtaining the recovery reference value of the logic block by weighted summation of the timing reference value and the structural reference value according to the weights corresponding to the timing reference value and the structural reference value can be achieved by multiplying the timing reference value and the structural reference value by their corresponding weights respectively, and finally summing the two multiplication results to obtain the recovery reference value.
[0094] S208, the logic block whose recovery reference value exceeds the preset recovery reference value threshold is determined as a candidate logic block; the candidate logic block is validated according to the basic logic block write record information, and the candidate logic block that passes the validity validation is determined as a key logic block.
[0095] S209, mark the key logic block to obtain the target logic block write record information.
[0096] S210, when the file system construction data writing is idle, identify whether the file system is complete, and if the file system is identified as incomplete, restore the file system construction data based on the target logical block write record information to restore the file system.
[0097] The advantage of this approach is that by decomposing the importance of logical blocks into temporal and structural dimensions and assigning differentiated weights to the characteristics of different file system types, it is possible to more accurately identify key logical blocks. The temporal dimension ensures that basic metadata written earlier receives a higher score, while the structural dimension ensures that metadata that is widely referenced or deeply nested receives a higher score. The combination of the two avoids the bias of a single dimension and improves the accuracy and robustness of key logical block identification.
[0098] Figure 3 This is a flowchart illustrating another file system recovery method on a flash memory device provided in this application embodiment. For example... Figure 3 As shown, the specific steps include the following: S301, in response to the write instruction for file system construction data, the initial logical block in the file system construction data is parsed to obtain file system feature information, and the file system type is determined based on the file system feature information.
[0099] S302, the file system construction data is copied to a preset backup area, and basic logical block write record information corresponding to the file system construction data is generated.
[0100] S303, determine the target summing weight according to the file system type; wherein, the target summing weight includes the summing weights corresponding to the directory recovery reference value, the file recovery reference value, and the metadata recovery reference value, respectively.
[0101] The directory recovery reference value can be the integrity of the directory structure successfully recovered after simulating the file system recovery process by disabling the current logical block; the file recovery reference value can be the integrity of the file data successfully recovered after simulating the file system recovery process by disabling the current logical block; and the metadata recovery reference value can be the integrity of the metadata successfully recovered after simulating the file system recovery process by disabling the current logical block.
[0102] Accordingly, the mapping table between file system type and summed weights can include: if the file system type is NTFS, the summed weights of the directory recovery reference value, file recovery reference value, and metadata recovery reference value are 0.2, 0.2, and 0.6, respectively; if the file system type is FAT32, the summed weights of the directory recovery reference value, file recovery reference value, and metadata recovery reference value are 0.4, 0.4, and 0.2, respectively; if the file system type is EXT4, the summed weights of the directory recovery reference value, file recovery reference value, and metadata recovery reference value are 0.3, 0.3, and 0.4, respectively; and if the file system type is exFAT, the summed weights of the directory recovery reference value, file recovery reference value, and metadata recovery reference value are 0.35, 0.35, and 0.3, respectively.
[0103] S304, for each of the logical blocks in the basic logical block write record information, the logical block is masked and the remaining logical blocks in the basic logical block write record information are used to simulate file system recovery, and the directory recovery reference value, file recovery reference value and metadata recovery reference value corresponding to the logical block are obtained.
[0104] The remaining logic blocks can be all logic blocks other than the currently masked logic blocks, which are written into the basic logic block record information.
[0105] In one embodiment, the method of masking logical blocks and simulating file system recovery based on the remaining logical blocks in the basic logical block write record information to obtain the directory recovery reference value, file recovery reference value, and metadata recovery reference value corresponding to the logical blocks can be achieved by removing one logical block from the basic logical block write record information one by one, simulating file system recovery using the backup data corresponding to the remaining logical blocks, and calculating the ratio of the number of recovered directory entries to the total number of original directory entries, the ratio of the number of recovered files to the total number of original files, and the ratio of the number of recovered metadata blocks to the total number of original metadata blocks. These three ratios are then normalized to the [0,1] interval and used as the directory recovery reference value, file recovery reference value, and metadata recovery reference value, respectively.
[0106] S305, based on the summation weights corresponding to the directory recovery reference value, the file recovery reference value, and the metadata recovery reference value, a weighted summation calculation is performed on the directory recovery reference value, the file recovery reference value, and the metadata recovery reference value to obtain the recovery reference value of the logical block.
[0107] In one embodiment, the recovery reference value of the logical block is obtained by weighted summation of the directory recovery reference value, file recovery reference value, and metadata recovery reference value according to their respective weights. This can be achieved by multiplying the directory recovery reference value, file recovery reference value, and metadata recovery reference value by their respective weights, and then summing the three multiplication results to obtain the recovery reference value.
[0108] S306, the logic block whose recovery reference value exceeds the preset recovery reference value threshold is determined as a candidate logic block; the candidate logic block is validated according to the basic logic block write record information, and the candidate logic block that passes the validity validation is determined as a key logic block.
[0109] S307, mark the key logic block to obtain the target logic block write record information.
[0110] S308, when the file system construction data writing is idle, identify whether the file system is complete, and if the file system is identified as incomplete, restore the file system construction data based on the target logical block write record information to restore the file system.
[0111] The advantage of this approach is that by disabling logical blocks one by one and simulating file system recovery, the actual contribution of each logical block to directory recovery, file recovery, and metadata recovery can be obtained, thereby quantifying the criticality of the logical block. This method based on simulated recovery results is more accurate and comprehensive than methods that rely on prior weights or feature extraction.
[0112] Figure 4 This is a flowchart illustrating another file system recovery method on a flash memory device provided in an embodiment of this application. Figure 4 As shown, the specific steps include the following: S401, in response to the write instruction for file system construction data, the initial logical block in the file system construction data is parsed to obtain file system feature information, and the file system type is determined based on the file system feature information.
[0113] S402, the file system construction data is copied to a preset backup area, and basic logical block write record information corresponding to the file system construction data is generated.
[0114] S403, determine the target summation weight according to the file system type, and determine the recovery reference value of each logical block in the basic logical block write record information based on the target summation weight; determine the logical blocks whose recovery reference values exceed the preset recovery reference value threshold as candidate logical blocks; perform validity verification on the candidate logical blocks according to the basic logical block write record information, and determine the candidate logical blocks that pass the validity verification as key logical blocks; mark the key logical blocks to obtain the target logical block write record information.
[0115] S404, when the file system construction data writing is idle, identify whether the file system is complete.
[0116] S405, if the file system is identified as incomplete, the write order position corresponding to the key logical block is determined according to the write record information of the target logical block, and the key logical blocks are sorted according to the write order position to obtain the key logical block recovery sequence.
[0117] The critical logic block recovery sequence can be an ordered list obtained by arranging the identified critical logic blocks in ascending order of their write positions (i.e., from earliest to latest write timestamps).
[0118] In one embodiment, the method of sorting the key logic blocks according to their write order to obtain the key logic block recovery sequence can be achieved by arranging the key logic blocks in ascending order of their write order to generate the key logic block recovery sequence.
[0119] S406, restore the corresponding key logic blocks in sequence according to the key logic block restoration sequence, and restore the logic blocks that have a reference relationship with the corresponding key logic blocks after restoring the corresponding key logic blocks.
[0120] The process of restoring the corresponding key logic blocks sequentially according to the key logic block recovery sequence, and then restoring the logic blocks that reference the corresponding key logic blocks after the key logic blocks have been restored, may include: for the current key logic block in the key logic block recovery sequence, firstly reading the backup data corresponding to the key logic block from the preset backup area and writing it back to the user storage space; identifying the logic blocks that reference the key logic block, sequentially reading the backup data corresponding to these logic blocks from the preset backup area and writing them back to the user storage space; continuing to process the next key logic block in the key logic block recovery sequence, that is, repeating the above steps until all key logic blocks in the key logic block recovery sequence have been restored.
[0121] S407, the unrecovered logical blocks in the target logical block are written to the record information and restored sequentially according to the writing order, in order to restore the file system.
[0122] In one embodiment, the method of restoring the unrecovered logical blocks in the target logical block writing record information in order of writing position can be as follows: after restoring all key logical blocks and logical blocks that reference key logical blocks, traverse the target logical block writing record information, filter out the logical blocks that have not yet been restored, sort these logical blocks in ascending order of writing position, and then read the corresponding backup data from the preset backup area in sequence and write them back to the user storage space.
[0123] The advantage of this approach is that by prioritizing the recovery of critical logical blocks and their directly referenced logical blocks, the core skeleton of the file system can be rebuilt first, thereby quickly restoring the basic directory structure of the file system and improving recovery efficiency.
[0124] Figure 5 This is a schematic diagram of a file system recovery device on a flash memory device provided in an embodiment of this application. Figure 5 As shown, the device includes: The system type determination module 510 is used to parse the initial logical blocks in the file system construction data in response to the write instruction of the file system construction data, obtain file system characteristic information, and determine the file system type based on the file system characteristic information. The write sequence recording module 520 is used to copy the file system construction data to a preset backup area and generate basic logical block write record information corresponding to the file system construction data. The key marking module 530 is specifically used for: determining the target sum weight according to the file system type, and determining the recovery reference value of each logical block in the basic logical block write record information based on the target sum weight; identifying logical blocks whose recovery reference values exceed a preset recovery reference value threshold as candidate logical blocks; performing validity verification on the candidate logical blocks according to the basic logical block write record information, and identifying the candidate logical blocks that pass the validity verification as key logical blocks; marking the key logical blocks to obtain the target logical block write record information; The file system recovery module 540 is used to identify whether the file system is complete when the file system construction data is idle, and to recover the file system construction data based on the target logical block write record information when the file system is identified as incomplete, so as to recover the file system.
[0125] Furthermore, the target summation weights include the summation weights corresponding to the directory recovery reference value, file recovery reference value, and metadata recovery reference value, respectively; Accordingly, the key marker writing module 530 is specifically used for: For each logical block in the basic logical block write record information, the logical block is masked and the file system recovery is simulated based on the remaining logical blocks in the basic logical block write record information to obtain the directory recovery reference value, file recovery reference value and metadata recovery reference value corresponding to the logical block; Based on the summation weights corresponding to the directory recovery reference value, the file recovery reference value, and the metadata recovery reference value, a weighted summation is performed on the directory recovery reference value, the file recovery reference value, and the metadata recovery reference value to obtain the recovery reference value of the logical block.
[0126] Furthermore, the target summing weights include summing weights corresponding to the time series reference values and the structural reference values, respectively; Accordingly, the key marker writing module 530 is specifically used for: The reference relationships between logical blocks in the basic logical block write record information are determined according to the file system type; For each logic block in the basic logic block write record information, determine the writing order position of the logic block in the basic logic block write record information, and determine the number of times the logic block is referenced and the reference level depth according to the reference relationship; The timing reference value corresponding to the logic block is determined based on the write order position, and the structural reference value corresponding to the logic block is determined based on the number of references and the reference level depth. Based on the weighted summation of the timing reference value and the structural reference value, respectively, a weighted summation is performed on the timing reference value and the structural reference value to obtain the recovery reference value of the logic block.
[0127] Furthermore, the key marker writing module 530 is specifically used for: Obtain the historical update count of each logic block in the basic logic block write record information; The relatively stable reference value corresponding to the candidate logic block is determined based on the historical update count; Candidate logic blocks whose relatively stable reference values exceed a preset stable reference value threshold are identified as candidate logic blocks that pass the validity check.
[0128] Furthermore, the file system recovery module 540 is specifically used for: The write order position corresponding to the key logic block is determined based on the write record information of the target logic block, and the key logic blocks are sorted according to the write order position to obtain the key logic block recovery sequence. The corresponding key logic blocks are restored sequentially according to the key logic block restoration sequence, and after the corresponding key logic blocks are restored, the logic blocks that have a reference relationship with the corresponding key logic blocks are restored. The target logic block is written into the record information and the unrecovered logic blocks are recovered sequentially according to the writing order.
[0129] Furthermore, the file system recovery module 540 is specifically used for: The real-time write-free duration of the file system construction data is obtained, and if the real-time write-free duration reaches a preset duration threshold, the write-free state of the file system construction data is determined to be idle. or, Obtain the real-time size of the file system, and if the real-time size reaches a preset size, determine that the file system construction data writing is idle.
[0130] In this embodiment, the system type determination module is used to parse the initial logical blocks in the file system construction data in response to the write instruction of the file system construction data, obtain file system feature information, and determine the file system type based on the file system feature information; the write sequence recording module is used to copy the file system construction data to a preset backup area and generate basic logical block write record information corresponding to the file system construction data; the write key marking module is specifically used to: determine the target sum weight according to the file system type, and determine the recovery reference value of each logical block in the basic logical block write record information based on the target sum weight; determine the logical blocks whose recovery reference values exceed a preset recovery reference value threshold as candidate logical blocks; perform validity verification on the candidate logical blocks according to the basic logical block write record information, and determine the candidate logical blocks that pass the validity verification as key logical blocks; mark the key logical blocks to obtain target logical block write record information; and the file system recovery module is used to identify whether the file system is complete when the file system construction data is idle, and if the file system is identified as incomplete, recover the file system construction data based on the target logical block write record information to recover the file system. The file system recovery device on the aforementioned flash memory device enables the flash memory device to perform targeted and efficient autonomous backup and recovery of file system construction data.
[0131] The file system recovery device on the flash memory device in this application embodiment can be a device, or it can be a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. For example, mobile electronic devices can be mobile phones, tablets, laptops, PDAs, in-vehicle electronic devices, wearable devices, ultra-mobile personal computers (UMPCs), netbooks, or personal digital assistants (PDAs), etc., while non-mobile electronic devices can be servers, network attached storage (NAS), personal computers (PCs), televisions (TVs), ATMs, or self-service machines, etc. This application embodiment does not make specific limitations.
[0132] The file system recovery device on the flash memory device in this application embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit it.
[0133] The file system recovery device on the flash memory device provided in this application embodiment can realize the various processes implemented in the above embodiments. To avoid repetition, it will not be described again here.
[0134] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. For example... Figure 6 As shown, this application embodiment also provides an electronic device 600, including a processor 601, a memory 602, and a program or instructions stored in the memory 602 and executable on the processor 601. When the program or instructions are executed by the processor 601, they implement the various processes of the file system recovery embodiment on the flash memory device described above, and can achieve the same technical effect. To avoid repetition, they will not be described again here.
[0135] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.
[0136] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the file system recovery embodiment on the flash memory device described above, and can achieve the same technical effect. To avoid repetition, they will not be described again here.
[0137] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.
[0138] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
[0139] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0140] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
[0141] The above description is merely a preferred embodiment and the technical principles employed in this application. This application is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions that can be made by those skilled in the art will not depart from the scope of protection of this application. Therefore, although this application has been described in detail through the above embodiments, this application is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of this application, the scope of which is determined by the scope of the claims.
Claims
1. A method of file system recovery on a flash memory device, the method comprising: The method is performed by a flash memory device; the method includes: In response to a write instruction for file system construction data, the initial logical blocks in the file system construction data are parsed to obtain file system feature information, and the file system type is determined based on the file system feature information. The file system build data is copied to a preset backup area, and basic logical block write record information corresponding to the file system build data is generated. The target sum weight is determined based on the file system type, and the recovery reference value of each logical block in the basic logical block write record information is determined based on the target sum weight; logical blocks whose recovery reference values exceed a preset recovery reference value threshold are identified as candidate logical blocks; the candidate logical blocks are validated based on the basic logical block write record information, and the candidate logical blocks that pass the validation are identified as key logical blocks; the key logical blocks are marked to obtain the target logical block write record information; When the file system construction data is idle, the system identifies whether the file system is complete. If the file system is identified as incomplete, the system restores the file system construction data based on the target logical block write record information to restore the file system.
2. The file system recovery method on a flash memory device according to claim 1, wherein, The target summation weights include the summation weights corresponding to the directory recovery reference value, file recovery reference value, and metadata recovery reference value, respectively. Accordingly, determining the recovery reference value of each logical block in the basic logical block write record information based on the target summation weight includes: For each logical block in the basic logical block write record information, the current logical block is masked and file system recovery is simulated based on the remaining logical blocks in the basic logical block write record information to obtain the directory recovery reference value, file recovery reference value, and metadata recovery reference value corresponding to the current logical block; wherein, the remaining logical blocks are all other logical blocks in the basic logical block write record information except for the masked current logical block; Based on the summation weights corresponding to the directory recovery reference value, the file recovery reference value, and the metadata recovery reference value, a weighted summation is performed on the directory recovery reference value, the file recovery reference value, and the metadata recovery reference value to obtain the recovery reference value of the current logical block.
3. The file system recovery method on a flash memory device according to claim 1, characterized in that, The target summing weights include summing weights corresponding to the time series reference values and the structural reference values, respectively. Accordingly, determining the recovery reference value of each logical block in the basic logical block write record information based on the target summation weight includes: The reference relationships between logical blocks in the basic logical block write record information are determined according to the file system type; For each logic block in the basic logic block write record information, determine the writing order position of the logic block in the basic logic block write record information, and determine the number of times the logic block is referenced and the reference level depth according to the reference relationship; The timing reference value corresponding to the logic block is determined based on the write order position, and the structural reference value corresponding to the logic block is determined based on the number of references and the reference level depth. Based on the weighted summation of the timing reference value and the structural reference value, respectively, a weighted summation is performed on the timing reference value and the structural reference value to obtain the recovery reference value of the logic block.
4. The file system recovery method on a flash memory device according to claim 1, characterized in that, The step of validating the candidate logic block based on the record information written to the basic logic block includes: Obtain the historical update count of each logic block in the basic logic block write record information; The relatively stable reference value corresponding to the candidate logic block is determined based on the historical update count; Candidate logic blocks whose relatively stable reference values exceed a preset stable reference value threshold are identified as candidate logic blocks that pass the validity check.
5. The method for recovering a file system on a flash memory device according to any one of claims 1-4, characterized in that, The recovery of the file system construction data based on the target logical block write record information includes: The write order position corresponding to the key logic block is determined based on the write record information of the target logic block, and the key logic blocks are sorted according to the write order position to obtain the key logic block recovery sequence. The corresponding key logic blocks are restored sequentially according to the key logic block restoration sequence, and after the corresponding key logic blocks are restored, the logic blocks that have a reference relationship with the corresponding key logic blocks are restored. The target logic block is written into the record information and the unrecovered logic blocks are recovered sequentially according to the writing order.
6. The method for recovering a file system on a flash memory device according to any one of claims 1-4, characterized in that, The process of identifying whether file system build data has been written to idle time includes: The real-time write-free duration of the file system construction data is obtained, and if the real-time write-free duration reaches a preset duration threshold, the write-free state of the file system construction data is determined to be idle. or, Obtain the real-time size of the file system, and if the real-time size reaches a preset size, determine that the file system construction data writing is idle.
7. A file system recovery device on a flash memory device, characterized in that, The apparatus is deployed on a flash memory device; the apparatus includes: The system type determination module is used to parse the initial logical blocks in the file system construction data in response to the write instruction of the file system construction data, obtain file system characteristic information, and determine the file system type based on the file system characteristic information. The write sequence recording module is used to copy the file system construction data to a preset backup area and generate basic logical block write record information corresponding to the file system construction data. The key marking module is specifically used for: determining the target sum weight based on the file system type, and determining the recovery reference value of each logical block in the basic logical block write record information based on the target sum weight; identifying logical blocks whose recovery reference values exceed a preset recovery reference value threshold as candidate logical blocks; performing validity verification on the candidate logical blocks based on the basic logical block write record information, and identifying the candidate logical blocks that pass the validity verification as key logical blocks; marking the key logical blocks to obtain the target logical block write record information; The file system recovery module is used to identify whether the file system is complete when the file system construction data is idle, and to recover the file system construction data based on the target logical block write record information when the file system is identified as incomplete, so as to recover the file system.
8. The file system recovery apparatus on a flash memory device according to claim 7, characterized in that, The target summation weights include the summation weights corresponding to the directory recovery reference value, file recovery reference value, and metadata recovery reference value, respectively. Accordingly, the key marker writing module is specifically used for: For each logical block in the basic logical block write record information, the current logical block is masked and file system recovery is simulated based on the remaining logical blocks in the basic logical block write record information to obtain the directory recovery reference value, file recovery reference value, and metadata recovery reference value corresponding to the current logical block; wherein, the remaining logical blocks are all other logical blocks in the basic logical block write record information except for the masked current logical block; Based on the summation weights corresponding to the directory recovery reference value, the file recovery reference value, and the metadata recovery reference value, a weighted summation is performed on the directory recovery reference value, the file recovery reference value, and the metadata recovery reference value to obtain the recovery reference value of the current logical block.
9. An electronic device, characterized in that, It includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the file system recovery method on a flash memory device as described in any one of claims 1-7.
10. A readable storage medium, characterized in that, The readable storage medium stores a program or instructions that, when executed by a processor, implement the file system recovery method on a flash memory device as described in any one of claims 1-7.
Citation Information
Patent Citations
A method and system for protecting against blackmail software attacks base on a solid state storage device
CN109388945A
Data management in flash memory
US20050132129A1