Method and device for changing size of partition cluster, equipment and medium

By parsing MFT records and planning new storage layouts, the problem of lossless cluster size adjustment was solved, achieving efficient and safe cluster size adjustment and improving storage performance.

CN121541832AActive Publication Date: 2026-02-17成都傲梅科技有限公司
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202511721563.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-21
Publication Date
2026-02-17
Estimated Expiration
2045-11-21

AI Technical Summary

Technical Problem

Existing technologies cannot resize partition clusters without formatting or incomplete backups, preventing users from optimizing storage performance.

Method used

By obtaining basic information about disk partitions, parsing MFT record content, planning the storage layout under the new cluster size, moving files and folders, generating target bitmaps and MFTs, and ensuring that the file system adapts to the new cluster granularity.

Benefits of technology

It enables lossless cluster resizing, avoiding the risk of data loss and time costs, and improving the practicality and reliability of storage performance optimization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121541832A_ABST
    Figure CN121541832A_ABST
Patent Text Reader

Abstract

The invention discloses a method and device for changing the size of a partition cluster, equipment and a medium, and the method comprises the steps that basic information of partitions of a computer disk is obtained, whether the step S12 continues to be executed or not is judged according to the basic information, and the basic information comprises the current cluster size, the remaining space and the total space; s12, the recorded content in the current MFT is analyzed; s13, determining the storage layout of files and folders under the target new cluster size; s14, correcting a page serial number field in an index page of the folder according to the size of the target new cluster; s15, overwriting the original bitmap content with the target bitmap content; s16, generating a target MFT consistent with the storage layout; and S17, generating a target MFT backup consistent with the storage layout. The invention belongs to the field of computer disk partitioning. According to the method, the cluster size can be adjusted in a lossless manner.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer disk partitioning, and more particularly to a method, apparatus, device, and medium for changing the size of partition clusters. Background Technology

[0002] When installing an operating system or formatting a hard drive, users typically use the default 4KB cluster size, which generally strikes a good balance between space utilization and performance. However, as usage progresses, users often categorize and store different types of files on specific partitions, often unaware of the impact of cluster size on performance and space efficiency. Small clusters are suitable for small files, reducing wasted space; large clusters are suitable for large files, helping to improve read / write performance and reduce fragmentation.

[0003] Once a partition has been filled with a large amount of data, traditional methods cannot resize clusters without formatting or performing a complete backup. Formatting is costly and risky, while simple copying does not change the underlying cluster structure. Therefore, users are often forced to accept suboptimal storage performance because they cannot optimize cluster configurations. Therefore, there is an urgent need for a non-destructive cluster resizing method that requires no formatting and no manual data migration. Summary of the Invention

[0004] This invention solves the technical problem of the inability to adjust cluster size without loss in the prior art by providing a method, apparatus, device and medium for changing the size of partitioned clusters, and achieves the technical effect of adjusting cluster size without loss.

[0005] In a first aspect, the present invention provides a method for changing the size of a partitioned cluster, comprising: S11, obtain basic information about the computer disk partitions, and determine whether to continue with step S12 based on the basic information, where the basic information includes the current cluster size, remaining space, and total space; S12, obtain the original bitmap content and parse the record content in the current MFT, where the record content includes the 0x80 attribute information corresponding to the file and the 0xA0 attribute information corresponding to the folder, and the 0xA0 attribute information is in a fragmented state. The MFT is the directory ledger. S13, based on the target new cluster size and the original bitmap content, determine the storage layout of files and folders under the target new cluster size, wherein the storage layout includes the required storage space and the starting position, and the folders are all in a merged state after step S13; S14, move the folders and files to the corresponding starting positions according to the storage layout, and correct the page number field in the index page of the folder according to the target new cluster size; S15, Based on the final position and occupancy of folders and files under the target new cluster size, generate target bitmap content corresponding to the target new cluster size, and overwrite the original bitmap content with the target bitmap content; S16, Generate the target MFT that matches the storage layout; S17, generate a target MFT backup that matches the storage layout.

[0006] Furthermore, based on the target new cluster size and the original bitmap content, the storage layout of files and folders under the target new cluster size is determined, including: Merge the folders, and within the target new cluster size, determine the temporary bitmap content corresponding to the merged folders and files; Based on the content of the temporary bitmap, determine the occupancy of each file or folder; Based on the original bitmap content and the temporary bitmap content, determine and verify the starting position of each file or folder.

[0007] Furthermore, the folders and files are moved to their corresponding starting positions according to the storage layout, and the page number field in the folder's index page is corrected based on the target new cluster size, including: Move each file or folder to its corresponding starting position; Locate the page number field of the folder; Determine the correspondence between page numbers and the target new cluster size; Based on the corresponding relationship, correct the page number field in the folder's index page.

[0008] Further, generating a target MFT consistent with the storage layout includes: Traverse the records in the current MFT and reconstruct the attributes of the {0x10-0x100} attribute information in sequence; Update the main record header of the current MFT and delete redundant record content to obtain the target MFT that matches the storage layout.

[0009] Furthermore, after step S17, the following steps are also included: Update the cluster size in the boot sector, the starting cluster position of the target MFT, and the starting cluster position of the target MFT backup.

[0010] Further, based on the basic information, determine whether to continue with step S12, including: If the current cluster size is 256KB or the ratio between the remaining space and the total space is less than or equal to the preset ratio, then the process ends directly; otherwise, proceed to step S12.

[0011] Furthermore, between steps S11 and S12, the following steps are also included: If the current cluster size is 4KB, check if there are compressed files or compressed folders in the partition; If it exists, decompress the compressed file or compressed folder.

[0012] In a second aspect, the present invention provides an apparatus for changing the size of a partitioned cluster, comprising: The basic information acquisition module is used to execute S11, including: acquiring basic information of the computer disk partitions, and determining whether to continue executing step S12 based on the basic information, wherein the basic information includes the current cluster size, remaining space and total space; The parsing module is used to execute S12, including: obtaining the original bitmap content and parsing the record content in the current MFT, wherein the record content includes the 0x80 attribute information corresponding to the file and the 0xA0 attribute information corresponding to the folder, and the 0xA0 attribute information is in a fragmented state, and the MFT is a directory ledger; The storage layout module is used to execute S13, including: determining the storage layout of files and folders under the target new cluster size based on the target new cluster size and the original bitmap content, wherein the storage layout includes the required storage space and the starting position, and the folders are all in a merged state after step S13; The move module is used to perform S14, including: moving folders and files to the corresponding starting positions according to the storage layout, and correcting the page number field in the index page of the folder according to the target new cluster size; The overwrite module is used to execute S15, including: generating target bitmap content corresponding to the target new cluster size based on the final position and occupancy of folders and files under the target new cluster size, and overwriting the original bitmap content with the target bitmap content; The MFT generation module is used to perform S16, including: generating a target MFT that is consistent with the storage layout; The backup module is used to perform S17, including: generating a target MFT backup consistent with the storage layout.

[0013] Thirdly, the present invention provides an electronic device, comprising: processor; Memory used to store processor-executable instructions; The processor is configured to execute a method for changing the size of a partition cluster, as provided in the first aspect.

[0014] Fourthly, the present invention provides a non-transitory computer-readable storage medium, wherein when instructions in the non-transitory computer-readable storage medium are executed by a processor of an electronic device, the electronic device is able to perform a method for changing the size of a partition cluster as provided in the first aspect.

[0015] One or more technical solutions provided in this invention have at least the following technical effects or advantages: This invention avoids high-risk scenarios by pre-judging conditions, ensuring operational feasibility; it deeply analyzes the MFT structure of the NTFS file system to accurately extract the physical distribution information of files and fragmented folders; it collaboratively plans a new storage layout based on the original bitmap and the target cluster size, safely migrating and merging files and folders while ensuring sufficient and completely free space; specifically targeting the NTFS index page structure, it dynamically corrects key fields such as page numbers according to the new cluster size to ensure the correctness of directory logic; finally, it synchronously updates the bitmap, the master MFT, and its backup, making the entire file system fully adapted to the new cluster granularity from data to metadata. This invention avoids the data loss risk and time cost of traditional formatting, and is also compatible with system features such as Windows transparent compression, achieving efficient, safe, automated, and lossless cluster size adjustment with consistent underlying layers, significantly improving the practicality and reliability of storage performance optimization. Attached Figure Description

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

[0017] Figure 1 This is a flowchart illustrating a method for changing the size of a partition cluster provided by the present invention. Detailed Implementation

[0018] This invention provides a method for changing the size of partitioned clusters, thus solving the technical problem in the prior art that it is impossible to adjust the cluster size without loss.

[0019] The technical solution of this invention is to solve the above-mentioned technical problems, and the overall idea is as follows: A method for changing the cluster size of a partition includes: S11, obtaining basic information about the computer disk partitions, and determining whether to continue with step S12 based on the basic information, wherein the basic information includes the current cluster size, remaining space, and total space; S12, obtaining the original bitmap content, and parsing the record content in the current MFT, wherein the record content includes 0x80 attribute information corresponding to files and 0xA0 attribute information corresponding to folders, and the 0xA0 attribute information indicates a fragmented state, and the MFT is a directory ledger; S13, based on the target new cluster size and the original bitmap content, determining the files and folders under the target new cluster size. The storage layout of the folders includes the required storage space and starting position, where the folders are all in a merged state after step S13; S14, the folders and files are moved to the corresponding starting positions according to the storage layout, and the page number field in the index page of the folder is corrected according to the target new cluster size; S15, according to the final position and occupancy of the folders and files under the target new cluster size, a target bitmap content corresponding to the target new cluster size is generated, and the original bitmap content is overwritten with the target bitmap content; S16, a target MFT consistent with the storage layout is generated; S17, a target MFT backup consistent with the storage layout is generated.

[0020] To better understand the above technical solutions, the following will provide a detailed explanation of the technical solutions in conjunction with the accompanying drawings and specific implementation methods.

[0021] First, it should be clarified that the term "and / or" in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.

[0022] A disk is a physical storage device. Partitions logically divide a disk into multiple independent areas. Each partition can be formatted separately and has its own file system. A cluster (also called an allocation unit) is the smallest unit of storage space that a file system manages on a partition. It consists of one or more contiguous sectors. Files are stored and allocated in units of clusters.

[0023] This invention provides, for example Figure 1 The method shown includes steps S11-S17 for changing the size of a partition cluster: S11: Obtain basic information about the computer disk partitions and determine whether to continue with step S12 based on the basic information. The basic information includes the current cluster size, remaining space, and total space.

[0024] Determine whether to continue with step S12 based on the basic information, including: if the current cluster size is 256KB or the ratio between the remaining space and the total space is less than or equal to a preset ratio, then end directly; otherwise, proceed with step S12.

[0025] The preset ratio can be determined according to the actual situation. In this invention, the preset ratio is set to 20%.

[0026] The purpose of step S11 is to avoid performing subsequent operations on unsuitable partitions: if the cluster size has already reached a large 256KB, no further adjustment is needed; however, when the remaining space percentage is too low, there may not be enough space for data rearrangement or temporary storage, and forced operation may easily lead to failure or data risk.

[0027] Between steps S11 and S12, the method further includes: if the current cluster size is 4KB, checking whether there is a compressed file or compressed folder in the partition; if there is, decompressing the compressed file or compressed folder.

[0028] Because the NTFS transparent compression feature built into Windows changes the actual way files are stored on the disk: compressed files may be stored in data blocks smaller than the cluster size, or even across multiple non-contiguous compression units, and their physical layout is different from that of ordinary uncompressed files.

[0029] When the cluster size is 4KB (i.e. the default minimum allocation unit), if subsequent operations rely on precise reading, migration, or rewriting of files at the standard cluster granularity, the presence of compressed files may lead to data parsing errors, migration failures, or corruption.

[0030] Therefore, only in scenarios where the cluster size is 4KB, it is necessary to actively detect and decompress all compressed files or folders, restoring them to a standard, cluster-aligned uncompressed state, to ensure that subsequent lossless cluster size modification operations can be performed safely, completely, and reliably.

[0031] S12, obtain the original bitmap content and parse the record content in the current MFT. The record content includes the 0x80 attribute information corresponding to the file and the 0xA0 attribute information corresponding to the folder. The 0xA0 attribute information is in a fragmented state. The MFT is the directory ledger.

[0032] First, read the original bitmap content of the partition to determine which clusters are occupied and which are still free; Parse each record in the current MFT, extract the 0x80 attribute corresponding to the file (including the actual storage location of the file data, the starting cluster of the segment, the length and the total size) and the 0xA0 attribute corresponding to the folder (index root and index allocation information, which is usually in a fragmented state), so as to obtain the physical distribution coordinates of all files and folders on the disk.

[0033] It should be noted that: The attributes of 0xA0 are mainly related to folders. If fragmentation exists, it is necessary to first determine, through the original bitmap content, a free disk area to cache and merge the data (i.e., the data in the fragmented folder).

[0034] S13. Based on the target new cluster size and the original bitmap content, determine the storage layout of files and folders under the target new cluster size. The storage layout includes the required storage space and the starting position. After step S13, all folders are in a merged state.

[0035] This includes: merging folders and, within the target new cluster size, determining the temporary bitmap content corresponding to the merged folders and files; determining the occupancy of each file or folder based on the temporary bitmap content; and determining and verifying the starting position of each file or folder based on the original bitmap content and the temporary bitmap content.

[0036] Bitmap content refers to the complete snapshot of the usage status of each cluster in the entire partition before the operation begins, recorded by the system file $Bitmap in the NTFS partition. Each bit corresponds to a cluster, with 1 indicating that it is occupied and 0 indicating that it is free. Bitmap content accurately reflects the actual allocation of disk space at present and is the basis for subsequent planning of new cluster layout, finding available space, and ensuring safe data migration.

[0037] The core task of step S13 is to re-plan the storage layout of all files and folders in the entire partition under the target new cluster size, based on the target new cluster size and the original bitmap: Calculate the required storage space (i.e., new length) for both folders and files under the target new cluster size. This calculation needs to take into account cluster alignment rules, such as: A 9KB file occupies 3 clusters (12KB) in a 4KB cluster, while it requires 2 clusters (16KB) in an 8KB cluster; at the same time, critical files such as $Bitmap also adjust their own space usage proportionally to the target new cluster size.

[0038] Subsequently, a temporary bitmap is generated to reflect the status of all currently allocated and free areas, and based on this, the new storage requirements of each file or folder are verified one by one: If adding the new length to the current starting position will not overlap with the area occupied by subsequent files, then the original position is retained and only the new length is recorded; If there is a risk of overwriting, a completely free and contiguous disk area is found based on the temporary bitmap as the new starting location.

[0039] The selected space consists of completely unused clusters. If the remaining free space in the partition is insufficient to accommodate any file or folder that needs to be moved or expanded, then the space is deemed insufficient, and the subsequent operation is terminated.

[0040] S14, move the folders and files to the corresponding starting positions according to the storage layout, and correct the page number field in the index page of the folder according to the target new cluster size.

[0041] Specifically, this includes: moving each file or folder to its corresponding starting position; locating the page number field of the folder; determining the correspondence between the page number and the target new cluster size; and correcting the page number field in the folder's index page based on the correspondence.

[0042] Since NTFS folder indexes are organized in 4KB logical page units, and the actual physical cluster size (target new cluster size) has changed, the field identifying the page number in the index header of each page needs to be recalculated and corrected according to the target cluster size. This field is an 8-byte value located at an offset of 16 bytes per page. Its value needs to be scaled proportionally to the target new cluster size and the 4KB base (e.g., the original page order 0, 1, 2... under an 8KB cluster becomes 0, 8, 16...). In addition, for index records containing sub-items, their structure also needs to be parsed: If the index entry length is greater than or equal to 24 bytes and the flag is valid, there is a page order reference that also needs to be corrected at the offset at the end of the entry. If the segmented index is less than 24 bytes, the filename length needs to be read from offset 80 bytes, and another 8-byte page order value needs to be modified at offset 82 + filename length.

[0043] S15. Based on the final position and occupancy of folders and files under the target new cluster size, generate target bitmap content corresponding to the target new cluster size, and overwrite the original bitmap content with the target bitmap content.

[0044] Based on the final storage location and actual usage of all files and folders under the target new cluster size, a new target bitmap is generated that perfectly matches the granularity of the new cluster. Each bit in the new bitmap accurately reflects the usage status of each new cluster (1 for used, 0 for free). This target bitmap is then used to overwrite the original $Bitmap content in the partition, thus officially updating the file system's space allocation view to the state under the new cluster size.

[0045] S16, generate the target MFT that matches the storage layout.

[0046] Specifically, this includes: traversing the record content in the current MFT and reconstructing the attributes of the {0x10-0x100} attribute information in sequence; updating the main record header of the current MFT and deleting redundant record content to obtain a target MFT consistent with the storage layout.

[0047] All attribute information for files and folders needs to be regenerated, from 0x10 to 0x100, to prevent inconsistencies in attribute information after file fragment merging. Additionally, due to merging, some MFT records are no longer needed and should be set to obsolete. Based on the general attribute data structure, see Tables 1 (General Attribute Data Structure), 2 (General Attribute Structure Branch Type Resident Table), and 3 (General Attribute Structure Branch Type Non-Resident Table) for details: Table 1

[0048] Table 2

[0049] Table 3

[0050] The following explanations cover rules 1-9: 1. Unless otherwise specified, attributes such as 0x10 only need to be modified by the attribute count value Instance, which is incremented from 0 according to the order of the attributes in the record.

[0051] 2. The value of datarun can be obtained from RunListOffset. The hexadecimal format is generally 32000100000c, which means that in this data structure, the length of the starting position of the file coordinate is 3, the length of the file length is 2, that is, the length is 0x100 clusters, and the starting position is cluster 0xc0000. When modifying, the file coordinate value is also regenerated in this way. The following steps all mention modifying datarun in this way.

[0052] 3. The folder has been fragmented and merged, so LowestVcn is set to 0 and HighestVcn is set to the new length value - 1.

[0053] 4. AllocatedLength should be set to the new length multiplied by the new cluster value. FileSize and ValidDataLength remain unchanged. TotalAllocated generally does not exist. If it exists in the original record, it should also be modified accordingly, with the value equal to AllocatedLength.

[0054] 5. The 0x50 property is a security description. Data will exist only if FormCode is a non-resident property. Datarun needs to be modified according to the new coordinates, and H4 operations need to be performed at the same time.

[0055] 6. The 0x80 attribute needs to be modified according to steps 2 and 4. It should be noted that in addition to the compression function mentioned above, Windows also has a transparent encryption function. Due to the characteristics of its encryption and decryption algorithm, the file can still be read normally even after the cluster size changes, so there is no need to decrypt the file data. In the MFT record, there is still a 0x80 attribute with the name specified by NameOffset and named Zone.Identifier, so it can be skipped and no modification is made.

[0056] 7. If the FormCode property of the 0x90 property is not permanent, skip it directly. If it is permanent, the index information of the documentation is stored in the MFT record, so this part of the data needs to be modified in the way described in 2.

[0057] 8. Modify attributes 0xA0 and 0x100 as in steps 2 and 4; 9. After modifying the attributes, modify the header of the original record to a fixed size of 0x38 bytes. Because the file may have too many fragments, some fragment attributes may exist independently in records with different numbering. However, if the file fragments are merged, rendering the records useless, the status of idle records can be set to unused. Starting from the beginning of the record, jump to offset 0x16 and modify the value of the two bytes here to 0. Jump to offset 0x18 and modify the value of the four bytes here to the sum of the length of all attributes plus the length of the record header. Jump to offset 0x28 and modify the value of the two bytes here to the number of attributes in the current record plus 1.

[0058] S17, generate a target MFT backup that matches the storage layout.

[0059] Copy the information of the first 8 record blocks in the target MFT in step S16 to generate a backup of the target MFT.

[0060] This also includes: updating the cluster size in the boot sector, the starting cluster position of the target MFT, and the starting cluster position of the target MFT backup.

[0061] You can modify the contents of the partition start bit boot. Starting from the partition header, jump to offset 0xd and modify the value of 1 byte to the new cluster size. The value is cluster size / sector size. For example, if the cluster size is 4KB, 4096 / 512=8, so rewrite it to 8 here. The default sector size is 512.

[0062] Jump to offset 0x28 and modify the 8-byte value to the starting cluster position of the migrated $MFT file. Jump to offset 0x30 and modify the 8-byte value here to the starting cluster position of the migrated $MFTMirr file. In summary, this invention avoids high-risk scenarios by pre-judging conditions, ensuring operational feasibility; it deeply analyzes the MFT structure of the NTFS file system to accurately extract the physical distribution information of files and fragmented folders; it collaboratively plans a new storage layout based on the original bitmap and the target cluster size, safely migrating and merging files and folders while ensuring sufficient and completely free space; specifically for the NTFS index page structure, it dynamically corrects key fields such as page sequence numbers according to the new cluster size to ensure the correctness of directory logic; finally, it synchronously updates the bitmap, the master MFT, and its backup, enabling the entire file system to fully adapt to the new cluster granularity from data to metadata. This invention avoids the data loss risk and time cost of traditional formatting, and is also compatible with system features such as Windows transparent compression, achieving efficient, safe, automated, and lossless cluster size adjustment with consistent underlying layers, significantly improving the practicality and reliability of storage performance optimization.

[0063] Based on the same inventive concept, the present invention also provides an apparatus for changing the size of a partitioned cluster, comprising: The basic information acquisition module is used to execute S11, including: acquiring basic information of the computer disk partitions, and determining whether to continue executing step S12 based on the basic information, wherein the basic information includes the current cluster size, remaining space and total space; The parsing module is used to execute S12, including: obtaining the original bitmap content and parsing the record content in the current MFT, wherein the record content includes the 0x80 attribute information corresponding to the file and the 0xA0 attribute information corresponding to the folder, and the 0xA0 attribute information is in a fragmented state, and the MFT is a directory ledger; The storage layout module is used to execute S13, including: determining the storage layout of files and folders under the target new cluster size based on the target new cluster size and the original bitmap content, wherein the storage layout includes the required storage space and the starting position, and the folders are all in a merged state after step S13; The move module is used to perform S14, including: moving folders and files to the corresponding starting positions according to the storage layout, and correcting the page number field in the index page of the folder according to the target new cluster size; The overwrite module is used to execute S15, including: generating target bitmap content corresponding to the target new cluster size based on the final position and occupancy of folders and files under the target new cluster size, and overwriting the original bitmap content with the target bitmap content; The MFT generation module is used to perform S16, including: generating a target MFT that is consistent with the storage layout; The backup module is used to perform S17, including: generating a target MFT backup consistent with the storage layout.

[0064] Based on the same inventive concept, the present invention also provides an electronic device, comprising: processor; Memory used to store processor-executable instructions; The processor is configured to execute a method for changing the size of a partition cluster as described above.

[0065] Based on the same inventive concept, the present invention also provides a non-transitory computer-readable storage medium that, when the instructions in the storage medium are executed by the processor of an electronic device, enables the electronic device to perform a method for changing the size of a partition cluster as described above.

[0066] Since the electronic device described in this embodiment is an electronic device used to implement the information processing method in the embodiments of the present invention, those skilled in the art can understand the specific implementation methods and various variations of the electronic device in this embodiment based on the information processing method described in the embodiments of the present invention. Therefore, how the electronic device implements the method in the embodiments of the present invention will not be described in detail here. Any electronic device used by those skilled in the art to implement the information processing method in the embodiments of the present invention falls within the scope of protection of the present invention.

[0067] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0068] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0069] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0070] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0071] Although preferred embodiments of the invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the invention.

[0072] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.

Claims

1. A method for changing the size of a partition cluster, characterized in that, include: S11, obtain basic information about the computer disk partitions, and determine whether to continue with step S12 based on the basic information, wherein the basic information includes the current cluster size, remaining space, and total space; S12, obtain the original bitmap content and parse the record content in the current MFT, where the record content includes the 0x80 attribute information corresponding to the file and the 0xA0 attribute information corresponding to the folder, and the 0xA0 attribute information is in a fragmented state. The MFT is the directory ledger. S13, based on the target new cluster size and the original bitmap content, determine the storage layout of files and folders under the target new cluster size, wherein the storage layout includes the required storage space and the starting position, and the folders are all in a merged state after step S13; S14, move the folders and files to the corresponding starting positions according to the storage layout, and correct the page number field in the index page of the folder according to the target new cluster size; S15, Based on the final position and occupancy of folders and files under the target new cluster size, generate target bitmap content corresponding to the target new cluster size, and overwrite the original bitmap content with the target bitmap content; S16, Generate the target MFT that matches the storage layout; S17, generate a target MFT backup that matches the storage layout.

2. The method for changing the size of a partition cluster as described in claim 1, characterized in that, Based on the target new cluster size and the original bitmap content, determine the storage layout of files and folders within the target new cluster size, including: Merge the folders, and determine the temporary bitmap content of the merged folders and files within the target new cluster size; Based on the content of the temporary bitmap, determine the occupancy of each file or folder; Based on the original bitmap content and the temporary bitmap content, determine and verify the starting position of each file or folder.

3. The method for changing the size of a partition cluster as described in claim 1, characterized in that, Move the folders and files to their corresponding starting positions according to the storage layout, and correct the page number field in the folder's index page based on the target new cluster size, including: Move each file or folder to its corresponding starting position; Locate the page number field of the folder; Determine the correspondence between page numbers and the target new cluster size; Based on the corresponding relationship, correct the page number field in the folder's index page.

4. The method for changing the size of a partition cluster as described in claim 1, characterized in that, Generate a target MFT that matches the storage layout, including: Traverse the records in the current MFT and reconstruct the attributes of the {0x10-0x100} attribute information in sequence; Update the main record header of the current MFT and delete redundant record content to obtain the target MFT that matches the storage layout.

5. The method for changing the size of a partition cluster as described in claim 1, characterized in that, Following step S17, the following is also included: Update the cluster size in the boot sector, the starting cluster position of the target MFT, and the starting cluster position of the target MFT backup.

6. The method for changing the size of a partition cluster as described in claim 1, characterized in that, Determining whether to continue with step S12 based on the aforementioned basic information includes: If the current cluster size is 256KB or the ratio between the remaining space and the total space is less than or equal to the preset ratio, then the process ends directly; otherwise, proceed to step S12.

7. The method for changing the size of a partition cluster as described in claim 1, characterized in that, Between steps S11 and S12, the following is also included: If the current cluster size is 4KB, check if there are compressed files or compressed folders in the partition; If it exists, then decompress the compressed file or the compressed folder.

8. An apparatus for changing the size of a partitioned cluster, characterized in that, include: The basic information acquisition module is used to execute S11, including: acquiring basic information of the computer disk partition, and determining whether to continue executing step S12 based on the basic information, wherein the basic information includes the current cluster size, remaining space and total space; The parsing module is used to execute S12, including: obtaining the original bitmap content and parsing the record content in the current MFT, wherein the record content includes the 0x80 attribute information corresponding to the file and the 0xA0 attribute information corresponding to the folder, and the 0xA0 attribute information is in a fragmented state, and the MFT is a directory ledger; The storage layout module is used to execute S13, including: determining the storage layout of files and folders under the target new cluster size based on the target new cluster size and the original bitmap content, wherein the storage layout includes the required storage space and the starting position, and the folders are all in a merged state after step S13; The moving module is used to perform S14, including: moving the folder and files to the corresponding starting position according to the storage layout, and correcting the page number field in the index page of the folder according to the target new cluster size; The overwrite module is used to execute S15, including: generating target bitmap content corresponding to the target new cluster size based on the final position and occupancy of folders and files under the target new cluster size, and overwriting the original bitmap content with the target bitmap content; The MFT generation module is used to perform S16, including: generating a target MFT that is consistent with the storage layout; The backup module is used to perform S17, including: generating a target MFT backup consistent with the storage layout.

9. An electronic device, characterized in that, include: processor; Memory used to store the processor's executable instructions; The processor is configured to execute a method for changing the size of a partition cluster as described in any one of claims 1 to 7.

10. A non-transitory computer-readable storage medium, characterized in that, When the instructions in the non-transitory computer-readable storage medium are executed by the processor of the electronic device, the electronic device is able to perform a method for changing the size of a partition cluster as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Transfer method and device of Android equipment internal hard disk file system

    CN103198102A

  • Operating system hot backup method and device and file system reconstruction method

    CN103729262A

  • File backup method and device for new technology file system, equipment and medium

    CN120631656A

  • Method of cloning the file system of a window web operating system by using a bitmap file

    US6418449B1

  • Manipulation of computer volume segments

    US6453383B1