Method, device, medium and equipment for checking and repairing disk space consistency

By using preset formatting parameters and lazy loading in the FAT file system to handle isolated clusters, the problem of insufficient memory during disk space consistency checks and repairs in memory-constrained devices is solved, achieving fixed memory overhead and avoiding system anomalies.

CN121934765APending Publication Date: 2026-04-2870MAI CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
70MAI CO LTD
Filing Date
2025-12-22
Publication Date
2026-04-28

AI Technical Summary

Technical Problem

In the prior art, when disk space consistency checking and repair software tools used for FAT file systems are on memory-constrained devices or storage devices, the memory overhead is related to the disk space capacity, which can lead to insufficient memory, affect the normal function of the device, or even cause system abnormalities.

Method used

The FAT file system is formatted using preset formatting parameters. It starts from the initial cluster index of the FAT table, determines the cluster index based on the preset window size, performs consistency checks, and writes back the FAT table content when necessary. It also uses lazy loading to handle isolated clusters, reducing memory overhead.

Benefits of technology

It reduces memory overhead, enabling memory-constrained devices or storage units to avoid system anomalies during disk space consistency checks and repairs, thereby improving system memory utilization efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121934765A_ABST
    Figure CN121934765A_ABST
Patent Text Reader

Abstract

The invention provides a disk space consistency checking and repairing method and device, a medium and equipment, a disk space is formatted by adopting an FAT file system, the method comprises the steps that cluster indexes corresponding to different windows are determined from an initial cluster index of an FAT table based on the size of a preset window, the size of the preset window is N times of the cluster size, N is a natural number, and the initial cluster index of the FAT table is equal to the initial cluster index of the FAT table; the cluster size is determined according to disk space capacity; sequentially moving the windows, obtaining FAT table contents corresponding to the current window according to the cluster index corresponding to the current window, performing consistency check, and if the FAT table contents are inconsistent, marking the state of the current window as dirty; when the current window is moved to the new window, whether the FAT content corresponding to the current window is written back or not is determined according to the state of the current window. According to the method, the memory overhead can be greatly reduced, and system abnormity possibly caused by large memory overhead when equipment or a storage device with a limited memory performs consistency check and repair on internal or external disk space of the equipment or the storage device is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer file system technology, and in particular to a technology for disk space consistency checking and repair. Background Technology

[0002] FAT (File Allocation Table) is a file system used to manage file data stored on devices. It manages disk cluster allocation through the FAT table and stores file directory entries in the root directory through the FDT (File Directory Table), recording information such as filename, attributes, and the first cluster index (or cluster number). The FDT table works in conjunction with the FAT table to locate file positions. The FAT file system has low overhead, efficiently manages simple file structures, ensures the organization of file data storage, and is characterized by its simplicity, ease of implementation, and good compatibility. The FAT file system has been widely used in computers and various electronic devices since the 1980s, and is particularly suitable for hard drives, USB flash drives, SD cards, etc., with smaller disk capacities. Embedded devices in Linux environments, such as IPCs (IP Cameras), typically have limited disk space and generally use disks with the FAT file system to store file data.

[0003] Hot-swapping of disks storing file data, abnormal power outages, or other reasons can all compromise the integrity of the FAT file system, necessitating consistency checks and repairs. Current software tools used for consistency checks and repairs of disk space formatted with the FAT file system do not consider the memory overhead of running the software. They typically allocate memory space based on the actual number of clusters on the disk; the larger the disk capacity, the greater the memory overhead required. For example, in the FAT32 file system, the FAT table records the status of each cluster on the disk (e.g., free / unallocated, allocated, or bad clusters) and manages the storage location of file data through a chain structure. The information for each cluster in the FAT table occupies 4 bytes. For a 512GB disk, if the disk space allocated to a cluster is 8KB, then the total number of clusters is 8M. If the FSCK software tool commonly used for consistency checking and repair in the Linux environment is used, 32MB of memory needs to be allocated for processing the FAT table. The FAT32 file system usually includes a primary FAT table and a backup FAT table, so 64MB of memory needs to be allocated. If isolated clusters need to be processed, an additional 32MB of memory needs to be allocated as the memory overhead for processing isolated clusters. It is evident that the memory overhead required by commonly used consistency checking and repair software tools is related to the disk space capacity. For memory-constrained devices or storage devices such as IPCs, if the disk space capacity is large, it may lead to insufficient memory when using these tools for consistency checks and repairs, affecting other normal functions of the device and even causing system malfunctions. However, with the development of storage technology, the cost of configuring large-capacity disk space is decreasing, resulting in more and more memory-constrained devices or storage devices being configured with increasingly larger disk spaces.

[0004] Therefore, how to reduce the memory overhead during disk space consistency checks and repairs for memory-constrained devices or storage devices is a technical problem that urgently needs to be solved. Summary of the Invention

[0005] In order to at least partially solve the above-mentioned technical problems, the purpose of this application is to provide a method, apparatus, medium and device for disk space consistency checking and repair.

[0006] According to one aspect of this application, a method for disk space consistency checking and repair is provided, wherein the disk space is formatted using a FAT file system with preset formatting parameters, the method comprising: Starting from the initial cluster index of the FAT table, the cluster index corresponding to different windows is determined based on a preset window size, wherein the preset window size is N times the cluster size, where N is a natural number, and the cluster size is determined according to the disk space capacity. The window is moved sequentially. Based on the cluster index corresponding to the current window, the contents of the FAT table corresponding to the current window are obtained and a consistency check is performed. If the contents of the FAT table are inconsistent, the current window is marked as dirty. When moving from the current window to a new window, determine whether to write back the contents of the FAT table corresponding to the current window based on the state of the current window.

[0007] Optionally, the determination of the preset formatting parameters includes: A first parameter is determined based on the disk space capacity. Based on the first parameter and a preset rule, a formatting parameter corresponding to the first parameter is determined in a preset array.

[0008] Optionally, the consistency check, wherein if the FAT table contents are inconsistent, marks the current window's state as dirty, includes: The obtained FAT table content is compared with the corresponding backup FAT table content for consistency. If the FAT table content is not completely the same as the backup FAT table content, the current window status is marked as dirty.

[0009] Optionally, the step of determining whether to write back the FAT table content corresponding to the current window based on the current window's state includes: If the current window's status is marked as dirty, then the contents of the FAT table corresponding to the current window will be replaced with the contents of the corresponding backup FAT table.

[0010] Optionally, the method for disk space consistency checking and repair further includes: Starting from the initial cluster, the system iterates through the FDT and FAT tables to determine whether the current cluster is an isolated cluster. If the current cluster is an isolated cluster, a structure is allocated for the current isolated cluster using lazy loading. A preset number of structures are predefined, and each structure is used to store the cluster index, cluster status, and reference count of an isolated cluster. The initial value of the reference count is 0. After the traversal is completed, all isolated clusters are identified.

[0011] Optionally, determining whether the current cluster is an isolated cluster based on the FDT table and the FAT table includes: Based on the FDT table, determine the starting cluster index of each file, and based on the starting cluster index and the corresponding entry value in the FAT table, determine the cluster chain referenced by each file; Determine whether the current cluster is included in a cluster chain referenced by a certain file. If not, the current cluster is an isolated cluster.

[0012] Optionally, the method for disk space consistency checking and repair further includes: Traverse each isolated cluster, determine the cluster status of the next cluster pointed to by the FAT table entry value corresponding to the cluster index of the current isolated cluster. If there is a home cluster, an idle cluster, or a bad cluster, mark the cluster status of the current isolated cluster as an ended cluster; otherwise, increment the reference count of the current isolated cluster by 1. Traverse each isolated cluster and determine whether the current isolated cluster is the first isolated cluster in the isolated cluster chain. If so, further determine the cluster state of the current isolated cluster. If it is unowned, mark the cluster state of the current isolated cluster as orphaned. Otherwise, mark the cluster state of the previous cluster pointed to by the FAT table entry value corresponding to the cluster index of the current isolated cluster as the end cluster, and decrement the reference count of the current isolated cluster by 1. For each isolated cluster, if the current isolated cluster is unowned, decrement the reference count of the current isolated cluster by 1.

[0013] Optionally, the method for disk space consistency checking and repair further includes: For an isolated cluster chain corresponding to an isolated cluster with a reference count of 0, a temporary file subdirectory pointing to the first isolated cluster of the isolated cluster chain is created in the FDT table, so that each isolated cluster corresponding to the isolated cluster chain is released by deleting the temporary file subdirectory in the FDT table.

[0014] Optionally, the method for disk space consistency checking and repair further includes: Delete the allocated structure with a reference count of 0 to free up memory.

[0015] Optionally, if the number of identified isolated clusters exceeds the preset number, the method for disk space consistency checking and repair further includes: Incrementally define structures to allocate structures to newly identified isolated clusters exceeding the preset number through lazy loading.

[0016] According to another aspect of this application, an apparatus for disk space consistency checking and repair is provided, wherein the disk space is formatted using a FAT file system with preset formatting parameters, and the apparatus includes: The first module is used to determine the cluster index corresponding to different windows based on a preset window size, starting from the initial cluster index of the FAT table. The preset window size is N times the cluster size, where N is a natural number. The cluster size is determined according to the disk space capacity. The second module is used to move windows sequentially. Based on the cluster index corresponding to the current window, it obtains the FAT table content corresponding to the current window and performs a consistency check. If the FAT table content is inconsistent, the current window's state is marked as dirty. The third module is used to determine whether to write back the FAT table content corresponding to the current window when moving from the current window to a new window, based on the state of the current window.

[0017] Optionally, the apparatus for disk space consistency checking and repair further includes: The fourth module is used to traverse from the initial cluster. Based on the FDT table and FAT table, it determines whether the current cluster is an isolated cluster. If the current cluster is an isolated cluster, it allocates a structure for the current isolated cluster through lazy loading. In this structure, a preset number of structures are defined. Each structure is used to store the cluster index, cluster status and reference count of an isolated cluster. The initial value of the reference count is 0. After the traversal is completed, all isolated clusters are determined.

[0018] Optionally, the apparatus for disk space consistency checking and repair further includes: The fifth module is used to traverse each isolated cluster and determine the cluster status of the next cluster pointed to by the FAT table entry value corresponding to the cluster index of the current isolated cluster. If there is a home cluster, an idle cluster, or a bad cluster, the cluster status of the current isolated cluster is marked as an ended cluster; otherwise, the reference count of the current isolated cluster is incremented by 1. The sixth module is used to traverse each isolated cluster, determine whether the current isolated cluster is the first isolated cluster in the isolated cluster chain, and if so, further determine the cluster status of the current isolated cluster. If it is unowned, mark the cluster status of the current isolated cluster as orphaned; otherwise, mark the cluster status of the previous cluster pointed to by the FAT table entry value corresponding to the cluster index of the current isolated cluster as the end cluster, and decrement the reference count of the current isolated cluster by 1. The seventh module is used to traverse each isolated cluster. If the current isolated cluster is unowned, the reference count of the current isolated cluster is decremented by 1.

[0019] Optionally, the apparatus for disk space consistency checking and repair further includes: The eighth module is used to create a temporary file subdirectory in the FDT table pointing to the first isolated cluster of the isolated cluster chain corresponding to an isolated cluster with a reference count of 0, so as to release each isolated cluster corresponding to the isolated cluster chain by deleting the temporary file subdirectory in the FDT table.

[0020] Optionally, the apparatus for disk space consistency checking and repair further includes: The ninth module is used to delete allocated structures with a reference count of 0 in order to free up memory.

[0021] Optionally, if the number of identified isolated clusters exceeds the preset number, the fourth module is further configured to: Incrementally define structures to allocate structures to newly identified isolated clusters exceeding the preset number through lazy loading.

[0022] According to another aspect of this application, a computer-readable medium is provided, wherein computer-readable instructions are stored thereon, which are executed by a processor to implement part or all of any of the above methods.

[0023] According to another aspect of this application, an apparatus for disk space consistency checking and repair is provided, wherein the apparatus includes: one or more processors; and a memory storing computer-readable instructions that, when executed, cause the processors to perform some or all of the operations of any of the above methods.

[0024] Compared with existing technologies, this application provides a method, apparatus, medium, and device for disk space consistency checking and repair. The disk space is formatted using a FAT file system with preset formatting parameters. The method includes: starting from the initial cluster index of the FAT table, determining the cluster index corresponding to different windows based on a preset window size, where the preset window size is N times the cluster size, and N is a natural number, where the cluster size is determined according to the disk space capacity; sequentially moving windows, obtaining the FAT table content corresponding to the current window based on the cluster index of the current window, and performing a consistency check; if the FAT table content is inconsistent, marking the current window's state as dirty; when moving from the current window to a new window, determining whether to write back the FAT table content corresponding to the current window based on the current window's state. The technical solution of this application requires relatively fixed memory overhead, which can greatly reduce memory consumption and avoid system anomalies that may occur due to high memory overhead when performing consistency checks and repairs on memory-constrained devices or storage devices for their built-in or external disk spaces. Attached Figure Description

[0025] Other features, objects, and advantages of this application will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings: Figure 1 A schematic diagram is shown of a method for disk space consistency checking and repair according to one aspect of this application; Figure 2 A schematic diagram of an apparatus for disk space consistency checking and repair according to another aspect of this application is shown. The same or similar reference numerals in the accompanying drawings represent the same or similar parts. Detailed Implementation

[0026] The present application will now be described in further detail with reference to the accompanying drawings.

[0027] In a typical configuration of various embodiments of this application, the method execution entity, each trusted party of the system, and / or each module of the device may include one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0028] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0029] Computer-readable media include both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include non-transitory computer-readable media, such as modulated data signals and carrier waves.

[0030] The memory overhead required by commonly used consistency checking and repair software tools is related to the disk space capacity. For memory-constrained devices or storage devices such as IPCs, if the disk space capacity is large, it may lead to insufficient memory when using common consistency checking and repair software tools for consistency checks and repairs, which may affect other normal functions of the device or even cause system abnormalities. However, with the development of storage technology, the cost of configuring large-capacity disk space is getting lower and lower, which has led to more and more memory-constrained devices or storage devices being configured with larger and larger disk spaces.

[0031] The technical solution for disk space consistency checking and repair provided in this application requires memory overhead that is independent of the disk space capacity and is relatively fixed. This can greatly reduce memory overhead and avoid system anomalies that may occur when memory-limited devices or storage devices perform disk space consistency checks and repairs.

[0032] To further illustrate the technical means adopted and the effects achieved in this application, the technical solution of this application will be clearly and completely described below in conjunction with the accompanying drawings and embodiments and / or optional embodiments.

[0033] Figure 1 The diagram illustrates a method for disk space consistency checking and repair according to one aspect of this application, wherein the disk space is formatted using a FAT file system with preset formatting parameters. One embodiment of the method includes: S101 starts from the initial cluster index of the FAT table, and determines the cluster index corresponding to different windows based on the preset window size. The preset window size is N times the cluster size, where N is a natural number. The cluster size is determined according to the disk space capacity. S102 moves the window sequentially, obtains the FAT table content corresponding to the current window according to the cluster index corresponding to the current window, and performs a consistency check. If the FAT table content is inconsistent, the current window's state is marked as dirty. S103 When moving from the current window to a new window, determine whether to write back the contents of the FAT table corresponding to the current window based on the state of the current window.

[0034] This application provides a method for disk space consistency checking and repair, implemented through a corresponding application installed in device 100. Device 100 includes a computer device or storage device pre-installed with relevant hardware and software environments and configured with built-in or external disks. By running the corresponding application installed in device 100, consistency checks and repairs are performed on the disk space of its built-in or external disks. The disk space is formatted using a FAT file system with preset formatting parameters. The computer device includes, but is not limited to, personal computers, laptops, industrial computers, and embedded computers. Preferably, device 100 is a computer device or storage device with limited memory; excessive memory consumption may cause system malfunctions in device 100.

[0035] The computer equipment or storage device described herein is merely an example. Other existing or future equipment and / or resource platforms that are applicable to this application should also be included within the scope of protection of this application, and are hereby incorporated by reference.

[0036] In this embodiment, an application for disk space consistency checking and repair is run in device 100. The FAT table is obtained from the corresponding area of ​​the disk space. In step S101, starting from the initial cluster index of the FAT table, the cluster index corresponding to different windows is determined based on a preset window size. The preset window size is N times the cluster size, where N is a natural number. The cluster size is determined according to the disk space capacity.

[0037] Starting with the initial cluster index of the FAT table, the cluster index in the FAT table is windowed according to a preset window size. This determines the cluster index corresponding to each different window. The preset window size is N times the cluster size, where N is a natural number. N can be determined based on the available system memory of device 100 and the efficiency requirements for disk space consistency checks and repairs. For example, if the cluster size is 16KB and the available system memory of device 100 is 64MB, then N can be 8, resulting in a preset window size of 128KB. Relatively speaking, the disk space consistency check and repair time is longer, thus trading time for space and reducing efficiency requirements. If the available system memory of device 100 is 128MB, then N can be 16, resulting in a preset window size of 256KB. Relatively speaking, the disk space consistency check and repair time is shorter, thus trading time for space and improving efficiency.

[0038] Continuing in this embodiment, in step S102, the window is moved sequentially, and the FAT table content corresponding to the current window is obtained according to the cluster index corresponding to the current window, and a consistency check is performed. If the FAT table content is inconsistent, the current window's state is marked as dirty.

[0039] The process can start from the initial cluster index of the FAT table, move the window sequentially, obtain the FAT table entry value corresponding to each cluster index included in the current window, and perform a consistency check on the FAT table entry value corresponding to each cluster index in the current window. If there are inconsistent FAT table entry values ​​corresponding to cluster indexes, the current window is marked with a status, such as "dirty".

[0040] Continuing in this embodiment, in step S103, when moving from the current window to a new window, it is determined whether to write back the FAT table content corresponding to the current window based on the state of the current window.

[0041] After completing the consistency check of the FAT table content corresponding to the current window, before moving to the next new window for further checks, it can be determined whether to write back the FAT table content corresponding to the current window based on the current window's state, and then move to the next new window for further checks.

[0042] Optionally, the determination of the preset formatting parameters includes: A first parameter is determined based on the disk space capacity. Based on the first parameter and a preset rule, a formatting parameter corresponding to the first parameter is determined in a preset array.

[0043] In this optional embodiment, a first parameter can be determined based on the disk space capacity of device 100. Then, a formatting parameter corresponding to the first parameter can be determined from a preset array according to the first parameter and preset rules, thereby determining the cluster size. The determined cluster size can then be used to format the disk space using FAT. For example, if the first parameter is C and the disk space capacity is D bytes, the relationship between the first parameter and the disk space capacity can be expressed as follows:

[0044] Based on the first parameter and preset rules, a value can be determined from the preset array {4,8,16,32,64,128} (the maximum element value in this array is 128; values ​​exceeding 128 are practically meaningless for FAT file system disks and can be disregarded). This value is then used to determine the cluster size, which is then used to format the disk space using FAT. The preset rules can be to select the value closest to and not less than the first parameter from the preset array as the formatting parameter. For example, assuming the disk space capacity is 48GB, the first parameter C is 12 according to the above formula. Based on the preset rules, the value 16 in the array is determined as the corresponding formatting parameter, thus determining the cluster size to be 16KB. If the disk space capacity is 512GB, the first parameter C is 128 according to the above formula. Based on the preset rules, the value 128 in the array is determined as the corresponding formatting parameter, thus determining the cluster size to be 128KB.

[0045] Optionally, in step S102, the consistency check is performed. If the contents of the FAT table are inconsistent, the current window's state is marked as dirty, including: The obtained FAT table content is compared with the corresponding backup FAT table content for consistency. If the FAT table content is not completely the same as the backup FAT table content, the current window status is marked as dirty.

[0046] In step S102, after obtaining the FAT table content corresponding to the current window based on the cluster index corresponding to the current window, in this optional embodiment, the obtained FAT table content is compared with the content corresponding to the corresponding cluster index in the backup FAT table. If the FAT table content corresponding to the current window is not completely the same as the content corresponding to the corresponding cluster index in the backup FAT table, the current window's state is marked as dirty.

[0047] Optionally, in step S103, determining whether to write back the FAT table content corresponding to the current window based on the current window's state includes: If the current window's status is marked as dirty, then the contents of the FAT table corresponding to the current window will be replaced with the contents of the corresponding backup FAT table.

[0048] In step S103, after completing the consistency check of the FAT table content corresponding to each cluster index of the current window, in this optional embodiment, the state of the current window is checked. If the state of the current window is marked as dirty, a write-back operation is performed on the FAT table content corresponding to the current window before sequentially moving to the new window. That is, the FAT table content corresponding to the current window is replaced with the content corresponding to the corresponding cluster index in the backup FAT table. If the state of the current window is not marked as dirty, there is no need to process the FAT table content corresponding to the current window; the process directly moves to the new window and performs a consistency check on the FAT table content corresponding to the new window.

[0049] In the FAT file system, the cluster status can be determined by the value of the entry corresponding to each cluster in the FAT table. For example, in the FAT32 file system, the following FAT entry values ​​correspond to different cluster statuses: 0x00000000: indicates that the cluster is not in use (free cluster); 0x0FFFFFFF: indicates that the cluster is the last cluster of the file (end cluster); 0x0FFFFFF7: indicates that the cluster is bad and unusable; other values: indicate that the cluster has been used, and under normal circumstances, its value is usually the cluster index of the next storage location of the file.

[0050] In the FAT file system, an orphaned cluster (also called an orphaned block) typically refers to a cluster that is used (i.e., the corresponding FAT entry value is not a specific value, but another value), but does not belong to any file cluster list. Orphaned clusters may be caused by file deletion, formatting, or disk corruption. The method for disk space consistency checking and repair in this application can also handle orphaned clusters of disk space.

[0051] Optionally, the method for disk space consistency checking and repair further includes: S104 starts traversing from the initial cluster. Based on the FDT table and FAT table, it determines whether the current cluster is an isolated cluster. If the current cluster is an isolated cluster, it allocates a structure for the current isolated cluster through lazy loading. A preset number of structures are predefined. Each structure is used to store the cluster index, cluster status and reference count of an isolated cluster. The initial value of the reference count is 0. After the traversal is completed, all isolated clusters are determined.

[0052] In the available system memory of device 100, a preset number of structures can be predefined. Each structure stores information such as the cluster index, cluster status, and reference count of an isolated cluster, with the initial value of the reference count being 0. In this optional embodiment, in step S104, traversal can begin from the initial clusters in the disk space. For the current cluster, it can be determined whether the current cluster is an isolated cluster based on the FDT table and FAT table. If the current cluster is determined to be an isolated cluster, a structure can be loaded using lazy loading to store information such as the cluster index, cluster status, and reference count of the isolated cluster. After traversal is completed, all isolated clusters in the disk space of device 100 can be identified, and each isolated cluster corresponds to a structure used to store information such as the cluster index, cluster status, and reference count of the isolated cluster.

[0053] The starting cluster index of a file can be determined by the FDT table, and then the file cluster linked list of the corresponding file can be determined by the FAT table.

[0054] Optionally, in step S104, determining whether the current cluster is an isolated cluster based on the FDT table and the FAT table includes: Based on the FDT table, determine the starting cluster index of each file, and based on the starting cluster index and the corresponding entry value in the FAT table, determine the cluster chain referenced by each file; Determine whether the current cluster is included in a cluster chain referenced by a certain file. If not, the current cluster is an isolated cluster.

[0055] In this optional embodiment, the starting cluster index of each file stored on the disk space can be obtained based on the contents of the FDT table. Then, based on the starting index of each file, the corresponding entry value in the FAT table can be found to determine the cluster chain (i.e., the file cluster chain list) referenced by each file. When traversing to the current cluster, if the FAT entry value corresponding to the current cluster is not a specific value but another value, it can be determined whether the current cluster is included in the cluster chain referenced by a certain file based on the FAT entry value corresponding to the current cluster. If the current cluster is not included in any cluster chain referenced by any file, the current cluster is considered to be an isolated cluster.

[0056] Optionally, the method for disk space consistency checking and repair further includes: S105 iterates through each isolated cluster, determines the cluster status of the next cluster pointed to by the FAT table entry value corresponding to the cluster index of the current isolated cluster. If there is a home cluster, an idle cluster, or a bad cluster, the cluster status of the current isolated cluster is marked as an ended cluster; otherwise, the reference count of the current isolated cluster is incremented by 1. S106 Iterates through each isolated cluster, determines whether the current isolated cluster is the first isolated cluster in the isolated cluster chain, and if so, further determines the cluster state of the current isolated cluster. If it is unowned, the cluster state of the current isolated cluster is marked as orphaned; otherwise, the cluster state of the previous cluster pointed to by the FAT table entry value corresponding to the cluster index of the current isolated cluster is marked as the end cluster, and the reference count of the current isolated cluster is decremented by 1. S107 Iterates through each isolated cluster. If the current isolated cluster is unowned, the reference count of the current isolated cluster is decremented by 1.

[0057] In the FAT file system, an orphaned cluster may belong to a cluster chain. For example, suppose that based on the FDT table and the FAT table, cluster chain 1 pointing to a certain file is determined: cluster A->cluster B->cluster C->cluster D->cluster E->cluster L, and there exists an orphaned cluster chain 2 that does not point to any file: cluster F->cluster G->cluster L.

[0058] In this optional embodiment, in step S105, each isolated cluster can be traversed. For the current isolated cluster, the cluster status of the next cluster pointed to by the FAT table entry value corresponding to the current isolated cluster is determined. If there is a home cluster (i.e., the cluster index of the next cluster is in the file cluster list of a certain file), an idle cluster, or a bad cluster, the cluster status of the current isolated cluster is marked as an ended cluster (for example, if it is a FAT32 file system, the table entry value in the FAT table corresponding to the current isolated cluster is modified to 0x0FFFFFFF and stored in the structure corresponding to the current isolated cluster). Otherwise, the reference count of the current isolated cluster is incremented by 1.

[0059] Continuing in this optional embodiment, in step S106, each isolated cluster processed in step S105 is traversed again. For the current isolated cluster, it is determined whether the current isolated cluster is the first isolated cluster in the isolated cluster chain. If so, the cluster state of the current isolated cluster is further determined. If it is an unowned cluster (not in the file cluster chain of any file stored in the disk space), the cluster state stored in the structure corresponding to the current isolated cluster is marked as orphaned. Otherwise, the cluster state of the previous cluster pointed to by the FAT table entry value corresponding to the cluster index of the current isolated cluster is marked as the end cluster, and the reference count of the current isolated cluster is decremented by 1. Through this operation, the current isolated cluster is disconnected from the isolated cluster chain.

[0060] In this optional embodiment, in step S107, each isolated cluster processed in step S106 is traversed again. For the current isolated cluster, if the cluster status of the current isolated cluster is unowned, the reference count of the current isolated cluster is decremented by 1.

[0061] Through the above operations, the truly isolated clusters can be disconnected from the isolated cluster chain and their reference counts can be marked and recorded for further processing.

[0062] Continuing with the above example, in step S105, the isolated cluster chain 2 is traversed. When isolated cluster F is reached, if the next cluster G pointed to by the FAT entry value of isolated cluster F is not a home cluster, an idle cluster, or a bad cluster, the reference count of isolated cluster F is incremented by 1. When isolated cluster G is reached, if the next cluster L pointed to by the FAT entry value of isolated cluster G is a home cluster (the end cluster of a file pointed to by cluster chain 1), then the cluster status of isolated cluster G can be marked as an end cluster. In step S106, the traversal is repeated again. Isolated cluster F is the first isolated cluster in isolated cluster chain 2 and is an unhome cluster, so the cluster status of cluster F can be marked as orphaned. In step S107, the traversal is repeated again. For isolated cluster F, its cluster status is orphaned, belonging to an unhome cluster, so the reference count of isolated cluster F is decremented by 1. Through the above processing, an isolated cluster chain is obtained: cluster F -> cluster G, where the cluster state of cluster F is marked as orphaned and its reference count is 0 (incremented by 1 first and then decremented by 1 as mentioned above), and the cluster state of cluster G is the terminated cluster and its reference count is 0 (it has not changed).

[0063] Optionally, the method for disk space consistency checking and repair further includes: S108 For the isolated cluster chain corresponding to the isolated cluster with a reference count of 0, a temporary file subdirectory pointing to the first isolated cluster of the isolated cluster chain is created in the FDT table, so as to release each isolated cluster corresponding to the isolated cluster chain by deleting the temporary file subdirectory in the FDT table.

[0064] An isolated cluster with a reference count of 0 will not affect other clusters when processed. In this optional embodiment, in step S108, a temporary file subdirectory pointing to the first isolated cluster in the FDT table can be created for the isolated cluster chain corresponding to the isolated cluster with a reference count of 0. This allows the disk space of each isolated cluster in the corresponding isolated cluster chain to be released by deleting the corresponding temporary file subdirectory in the FDT table, thereby improving the utilization efficiency of disk space.

[0065] Optionally, the method for disk space consistency checking and repair further includes: S109 deletes the allocated structure with a reference count of 0 to free up memory.

[0066] In this optional embodiment, in step S109, allocated structures with a reference count of 0 may also be deleted to release occupied memory and improve the utilization efficiency of available system memory of device 100.

[0067] Optionally, if the number of identified isolated clusters exceeds the preset number, the method for disk space consistency checking and repair further includes: S110 incrementally defines a structure to allocate structures to newly determined isolated clusters exceeding the preset number through lazy loading.

[0068] In this optional embodiment, in step S110, if the number of identified isolated clusters exceeds the predefined number of structures, an incremental structure definition method can be used to define an additional number of structures in batches. When all predefined structures have been allocated, structures can be allocated to newly identified isolated clusters exceeding the aforementioned preset number to record information such as the cluster index, cluster status, and reference count of the corresponding isolated clusters. Step S110 can also be implemented through step S104, that is, step S104 may further include: incrementally defining structures to allocate structures to newly identified isolated clusters exceeding the preset number through lazy loading.

[0069] By handling isolated clusters through predefined and incrementally defined structure memory overhead and lazy loading allocation, large one-time memory overhead is avoided, improving the available system memory utilization efficiency of device 100. Especially for memory-constrained device 100, this also reduces the possibility of system anomalies caused by excessive memory overhead.

[0070] The method for disk space consistency checking and repair provided by the above embodiments and / or optional embodiments can determine preset formatting parameters for formatting based on the disk space capacity, thereby determining the cluster size and performing formatting using the determined cluster size. When performing disk space consistency checking and repair, it is not necessary to allocate a large amount of memory at once. Instead, the memory allocation can be determined based on the available system memory size of device 100 and the processing efficiency requirements for consistency checking and repair, which can greatly reduce memory overhead and improve the utilization efficiency of the available system memory of device 100.

[0071] Figure 2 The diagram illustrates an apparatus for disk space consistency checking and repair according to another aspect of this application, wherein the disk space is formatted using a FAT file system with preset formatting parameters. One embodiment of the apparatus includes: The first module 2010 is used to determine the cluster index corresponding to different windows based on a preset window size, starting from the initial cluster index of the FAT table. The preset window size is N times the cluster size, where N is a natural number. The cluster size is determined according to the disk space capacity. The second module 2020 is used to move windows sequentially. Based on the cluster index corresponding to the current window, it obtains the FAT table content corresponding to the current window and performs a consistency check. If the FAT table content is inconsistent, the current window's state is marked as dirty. The third module 2030 is used to determine whether to write back the FAT table content corresponding to the current window based on the state of the current window when moving from the current window to a new window.

[0072] In this embodiment, the device may include modular software and / or a combination of modular software and hardware, deployed in a device with a built-in or external disk, the hardware and software environment of which is the same as that of the aforementioned device 100.

[0073] In this embodiment, the first module 2010 of the device can start from the initial cluster index of the FAT table in the disk space, and perform windowing processing on the cluster indexes in the FAT table according to a preset window size. This determines the cluster index corresponding to each different window. The preset window size is N times the cluster size, where N is a natural number. N can be determined based on the available system memory of the device 100 and the efficiency requirements for consistency checks and repairs of the disk space. Continuing in this embodiment, the second module 2020 of the device can sequentially move the window, obtain the FAT table entry value corresponding to each cluster index included in the current window, and perform a consistency check on the FAT table entry value corresponding to each cluster index in the current window. If there are inconsistent FAT table entry values ​​corresponding to cluster indexes, the current window is marked with a status flag, such as "dirty". Continuing in this embodiment, after completing the consistency check of the FAT table content corresponding to the current window through the third module 2030 of the device, before sequentially moving to the next new window for checking, it can determine whether to write back the FAT table content corresponding to the current window based on the state of the current window, and then sequentially move to the next new window for checking.

[0074] Optionally, the apparatus for disk space consistency checking and repair further includes: The fourth module, 2040, is used to traverse from the initial cluster. Based on the FDT and FAT tables, it determines whether the current cluster is an isolated cluster. If the current cluster is an isolated cluster, a structure is allocated for the current isolated cluster using lazy loading. A preset number of structures are predefined. Each structure is used to store the cluster index, cluster status, and reference count of an isolated cluster. The initial value of the reference count is 0. After the traversal is completed, all isolated clusters are determined.

[0075] In this application, a preset number of structures can be predefined in the available system memory of device 100. Each structure stores information such as the cluster index, cluster status, and reference count of an isolated cluster, with the initial value of the reference count being 0. In this optional embodiment, the fourth module 2040 of the device can traverse starting from the initial clusters in the disk space. For the current cluster, it can be determined whether the current cluster is an isolated cluster based on the FDT table and FAT table. If the current cluster is determined to be an isolated cluster, a structure can be loaded using a lazy loading method to store information such as the cluster index, cluster status, and reference count of the isolated cluster. After the traversal is completed, all isolated clusters in the disk space of device 100 can be identified, and each isolated cluster corresponds to a structure used to store information such as the cluster index, cluster status, and reference count of the isolated cluster.

[0076] Optionally, the apparatus for disk space consistency checking and repair further includes: The fifth module 2050 is used to traverse each isolated cluster and determine the cluster status of the next cluster pointed to by the FAT table entry value corresponding to the cluster index of the current isolated cluster. If there is a home cluster, an idle cluster, or a bad cluster, the cluster status of the current isolated cluster is marked as an ended cluster; otherwise, the reference count of the current isolated cluster is incremented by 1. Module 6, 2060, is used to traverse each isolated cluster, determine whether the current isolated cluster is the first isolated cluster in the isolated cluster chain, and if so, further determine the cluster status of the current isolated cluster. If it is unowned, mark the cluster status of the current isolated cluster as orphaned; otherwise, mark the cluster status of the previous cluster pointed to by the FAT table entry value corresponding to the cluster index of the current isolated cluster as the end cluster, and decrement the reference count of the current isolated cluster by 1. Module 7, 2070, is used to traverse each isolated cluster. If the current isolated cluster is unowned, the reference count of the current isolated cluster is decremented by 1.

[0077] In this optional embodiment, the fifth module 2050 of the device can traverse each isolated cluster. For the current isolated cluster, the cluster status of the next cluster pointed to by the FAT table entry value corresponding to the current isolated cluster is further determined. If there is a home cluster (i.e., the cluster index of the next cluster is in the file cluster list of a certain file), an idle cluster, or a bad cluster, the cluster status of the current isolated cluster is marked as an ended cluster (for example, if it is a FAT32 file system, the table entry value in the FAT table corresponding to the current isolated cluster is modified to 0x0FFFFFFF and stored in the structure corresponding to the current isolated cluster). Otherwise, the reference count of the current isolated cluster is incremented by 1. Continuing in this optional embodiment, through the sixth module 2060 of the device, each isolated cluster processed by the fifth module 2050 can be traversed again. For the current isolated cluster, it is determined whether the current isolated cluster is the first isolated cluster in the isolated cluster chain. If so, the cluster status of the current isolated cluster is further determined. If it is an unowned cluster, the cluster status of the current isolated cluster is marked as orphaned (for example, if it is a FAT32 file system, the table entry value in the FAT table corresponding to the current isolated cluster is modified to a preset value and stored in the structure corresponding to the current isolated cluster). Otherwise, the cluster status of the previous cluster pointed to by the FAT table entry value corresponding to the cluster index of the current isolated cluster is marked as the end cluster, and the reference count of the current isolated cluster is decremented by 1. After passing through the sixth module 2060, the current isolated cluster can be disconnected from the isolated cluster chain. Continuing in this optional embodiment, through the seventh module 2070 of the device, each isolated cluster processed by the sixth module 2060 is traversed again. For the current isolated cluster, if the cluster status of the current isolated cluster is unowned, the reference count of the current isolated cluster is decremented by 1.

[0078] Optionally, the apparatus for disk space consistency checking and repair further includes: Module 8 2080 is used to create a temporary file subdirectory in the FDT table pointing to the first isolated cluster of the isolated cluster chain corresponding to an isolated cluster with a reference count of 0, so as to release each isolated cluster corresponding to the isolated cluster chain by deleting the temporary file subdirectory in the FDT table.

[0079] The device can process isolated clusters with a reference count of 0 without affecting other clusters. In this optional embodiment, through the ninth module 2080 of the device, a temporary file subdirectory pointing to the first isolated cluster in the FDT table is created for the isolated cluster chain corresponding to the isolated cluster with a reference count of 0. This allows the disk space of each isolated cluster in the corresponding isolated cluster chain to be released by deleting the corresponding temporary file subdirectory in the FDT table, thereby improving the utilization efficiency of disk space.

[0080] Optionally, the apparatus for disk space consistency checking and repair further includes: Module 9, 2090, is used to delete allocated structures with a reference count of 0 in order to free up memory.

[0081] In this optional embodiment, the ninth module 2090 of the device can delete allocated structures with a reference count of 0 to free up occupied memory and improve the utilization efficiency of available system memory of the device 100.

[0082] Optionally, if the number of determined isolated clusters exceeds the preset number, the fourth module 2040 is further configured to: Incrementally define structures to allocate structures to newly identified isolated clusters exceeding the preset number through lazy loading.

[0083] If the number of identified isolated clusters exceeds the number of predefined structures, in this optional embodiment, the fourth module 2040 of the device can also be used to define an additional number of structures in batches using an incremental structure definition method. When the predefined structures have been allocated, structures can be allocated to newly identified isolated clusters that exceed the aforementioned preset number, so as to record information such as the cluster index, cluster status, and reference count of the corresponding isolated clusters.

[0084] In the above device embodiments, the method steps corresponding to the functions that can be achieved by each component module of the device are the same as those in the aforementioned related method embodiments and / or optional embodiments, and will not be repeated here.

[0085] According to another aspect of this application, a computer-readable medium is also provided, the computer-readable medium storing computer-readable instructions that can be executed by a processor to implement some or all of the foregoing method embodiments and / or optional embodiments.

[0086] It should be noted that the method embodiments and / or optional embodiments in this application do not strictly limit the order of execution of each step, as long as the method embodiments and / or optional embodiments can solve the defects existing in the prior art, achieve the inventive purpose of this application, and obtain beneficial effects. The method embodiments and / or optional embodiments in this application can be implemented in software and / or combinations of software and hardware. The software program involved in this application can be executed by a processor to implement the steps or functions of the above embodiments. Similarly, the software program of this application (including related data structures) can be stored in a computer-readable recording medium.

[0087] Furthermore, part or all of this application can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can invoke or provide the methods and / or technical solutions according to this application through the operation of the computer. The program instructions invoking the methods of this application may be stored in a fixed or removable recording medium, and / or transmitted via data streams in broadcast or other signal carrying media, and / or stored in the working memory of a computer device operating according to the program instructions.

[0088] According to another aspect of this application, an apparatus for disk space consistency checking and repair is also provided. The apparatus includes: a memory for storing computer program instructions and a processor for executing the program instructions, wherein when the computer program instructions are executed by the processor, the apparatus is triggered to run part or all of the methods and / or technical solutions of the foregoing embodiments.

[0089] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the invention can be implemented in other specific forms without departing from its spirit or essential characteristics. Therefore, the embodiments should be considered in all respects as exemplary and non-limiting, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be embraced within the present invention. No reference numerals in the claims should be construed as limiting the scope of the claims.

[0090] In this application, when terms such as "upper," "lower," "left," "right," "front," "rear," "top," "bottom," "inner," "outer," "middle," "vertical," "horizontal," "lateral," and "longitudinal" are used, the indicated orientation and / or positional relationship is based on the orientation and / or positional relationship shown in the accompanying drawings. These terms are primarily for the purpose of better describing this application and its embodiments, and are not intended to limit the indicated device, element, or component to having a specific orientation, or to be constructed and operated in a specific orientation. Furthermore, some of the above terms, in addition to indicating orientation or positional relationship, can also be used to indicate other meanings; for example, the term "upper" can also be used in some cases to indicate a certain dependency or connection relationship. Those skilled in the art can understand the specific meaning of these terms in this application according to the specific circumstances. Furthermore, the terms "installation," "setup," "equipped with," "connection," and "linked" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral structure; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection via an intermediate medium; and they can refer to an internal connection between two devices, components, or constituent parts. Those skilled in the art can understand the specific meaning of the above terms in this application based on the specific circumstances.

[0091] Furthermore, the terms "first," "second," etc., are primarily used to distinguish different devices, units, modules, elements, circuits, or components (which may be the same or different in specific type and construction), and are not intended to indicate or imply the relative importance, order, and / or quantity of the indicated devices, units, modules, elements, circuits, or components. Unless otherwise stated, "a plurality of" means two or more.

[0092] Furthermore, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices recited in the device claims may also be implemented by a single unit or device through software and / or hardware.

Claims

1. A method for disk space consistency checking and repair, characterized in that, The disk space is formatted using preset formatting parameters to create a FAT file system, and the method includes: Starting from the initial cluster index of the FAT table, the cluster index corresponding to different windows is determined based on a preset window size, wherein the preset window size is N times the cluster size, where N is a natural number, and the cluster size is determined according to the disk space capacity. The window is moved sequentially. Based on the cluster index corresponding to the current window, the contents of the FAT table corresponding to the current window are obtained and a consistency check is performed. If the contents of the FAT table are inconsistent, the current window is marked as dirty. When moving from the current window to a new window, determine whether to write back the contents of the FAT table corresponding to the current window based on the state of the current window.

2. The method according to claim 1, characterized in that, The determination of the preset formatting parameters includes: A first parameter is determined based on the disk space capacity. Based on the first parameter and a preset rule, a formatting parameter corresponding to the first parameter is determined in a preset array.

3. The method according to claim 1, characterized in that, The consistency check is performed. If the FAT table content is inconsistent, the current window's state is marked as dirty, including: The obtained FAT table content is compared with the corresponding backup FAT table content for consistency. If the FAT table content is not completely the same as the backup FAT table content, the current window status is marked as dirty.

4. The method according to claim 1, characterized in that, The step of determining whether to write back the FAT table content corresponding to the current window based on the current window's state includes: If the current window's status is marked as dirty, then the contents of the FAT table corresponding to the current window will be replaced with the contents of the corresponding backup FAT table.

5. The method according to claim 1, characterized in that, The method further includes: Starting from the initial cluster, the system iterates through the FDT and FAT tables to determine whether the current cluster is an isolated cluster. If the current cluster is an isolated cluster, a structure is allocated for the current isolated cluster using lazy loading. A preset number of structures are predefined, and each structure is used to store the cluster index, cluster status, and reference count of an isolated cluster. The initial value of the reference count is 0. After the traversal is completed, all isolated clusters are identified.

6. The method according to claim 5, characterized in that, The step of determining whether the current cluster is an isolated cluster based on the FDT table and FAT table includes: Based on the FDT table, determine the starting cluster index of each file, and based on the starting cluster index and the corresponding entry value in the FAT table, determine the cluster chain referenced by each file; Determine whether the current cluster is included in a cluster chain referenced by a certain file. If not, the current cluster is an isolated cluster.

7. The method according to claim 5, characterized in that, The method further includes: Traverse each isolated cluster, determine the cluster status of the next cluster pointed to by the FAT table entry value corresponding to the cluster index of the current isolated cluster. If there is a home cluster, an idle cluster, or a bad cluster, mark the cluster status of the current isolated cluster as an ended cluster; otherwise, increment the reference count of the current isolated cluster by 1. Traverse each isolated cluster and determine whether the current isolated cluster is the first isolated cluster in the isolated cluster chain. If so, further determine the cluster state of the current isolated cluster. If it is unowned, mark the cluster state of the current isolated cluster as orphaned. Otherwise, mark the cluster state of the previous cluster pointed to by the FAT table entry value corresponding to the cluster index of the current isolated cluster as the end cluster, and decrement the reference count of the current isolated cluster by 1. For each isolated cluster, if the current isolated cluster is unowned, decrement the reference count of the current isolated cluster by 1.

8. The method according to claim 7, characterized in that, The method further includes: For an isolated cluster chain corresponding to an isolated cluster with a reference count of 0, a temporary file subdirectory pointing to the first isolated cluster of the isolated cluster chain is created in the FDT table, so that each isolated cluster corresponding to the isolated cluster chain is released by deleting the temporary file subdirectory in the FDT table.

9. The method according to claim 7, characterized in that, The method further includes: Delete the allocated structure with a reference count of 0 to free up memory.

10. The method according to claim 7, characterized in that, If the number of identified isolated clusters exceeds the preset number, the method further includes: Incrementally define structures to allocate structures to newly identified isolated clusters exceeding the preset number through lazy loading.

11. An apparatus for disk space consistency checking and repair, characterized in that, The disk space is formatted using a preset formatting parameter to create a FAT file system, and the device includes: The first module is used to determine the cluster index corresponding to different windows based on a preset window size, starting from the initial cluster index of the FAT table. The preset window size is N times the cluster size, where N is a natural number. The cluster size is determined according to the disk space capacity. The second module is used to move windows sequentially. Based on the cluster index corresponding to the current window, it obtains the contents of the FAT table corresponding to the current window and performs a consistency check. If the contents of the FAT table are inconsistent, the current window is marked as dirty. The third module is used to determine whether to write back the FAT table content corresponding to the current window when moving from the current window to a new window, based on the state of the current window.

12. The apparatus according to claim 11, characterized in that, The device further includes: The fourth module is used to traverse from the initial cluster. Based on the FDT table and FAT table, it determines whether the current cluster is an isolated cluster. If the current cluster is an isolated cluster, it allocates a structure for the current isolated cluster through lazy loading. In this structure, a preset number of structures are defined. Each structure is used to store the cluster index, cluster status and reference count of an isolated cluster. The initial value of the reference count is 0. After the traversal is completed, all isolated clusters are determined.

13. The apparatus according to claim 12, characterized in that, The device further includes: The fifth module is used to traverse each isolated cluster and determine the cluster status of the next cluster pointed to by the FAT table entry value corresponding to the cluster index of the current isolated cluster. If there is a home cluster, an idle cluster, or a bad cluster, the cluster status of the current isolated cluster is marked as an ended cluster; otherwise, the reference count of the current isolated cluster is incremented by 1. The sixth module is used to traverse each isolated cluster, determine whether the current isolated cluster is the first isolated cluster in the isolated cluster chain, and if so, further determine the cluster status of the current isolated cluster. If it is unowned, mark the cluster status of the current isolated cluster as orphaned; otherwise, mark the cluster status of the previous cluster pointed to by the FAT table entry value corresponding to the cluster index of the current isolated cluster as the end cluster, and decrement the reference count of the current isolated cluster by 1. The seventh module is used to traverse each isolated cluster. If the current isolated cluster is unowned, the reference count of the current isolated cluster is decremented by 1.

14. The apparatus according to claim 13, characterized in that, The device further includes: The eighth module is used to create a temporary file subdirectory in the FDT table pointing to the first isolated cluster of the isolated cluster chain corresponding to an isolated cluster with a reference count of 0, so as to release each isolated cluster corresponding to the isolated cluster chain by deleting the temporary file subdirectory in the FDT table.

15. The apparatus according to claim 13, characterized in that, The device further includes: The ninth module is used to delete allocated structures with a reference count of 0 in order to free up memory.

16. The apparatus according to claim 13, characterized in that, If the number of identified isolated clusters exceeds the preset number, the fourth module is further configured to: Incrementally define structures to allocate structures to newly identified isolated clusters exceeding the preset number through lazy loading.

17. A computer-readable medium, characterized in that, It stores computer-readable instructions that are executed by a processor to implement part or all of the method as claimed in any one of claims 1 to 10.

18. A device for disk space consistency checking and repair, characterized in that, The device includes: One or more processors; and A memory storing computer-readable instructions, which, when executed, cause the processor to perform some or all of the operations of the method as described in any one of claims 1 to 10.