Method, system, device and medium for erasing remaining space of ext file system
By parsing and writing to zero erasing the partitions of the ext file system, the problem of not being able to completely delete disk data in the existing technology is solved, the security and efficiency of the hard disk are improved, and the unnecessary cost of erasing the entire disk is avoided.
Patent Information
- Application Number
- CN202411288850.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-14
- Publication Date
- 2024-12-17
- Estimated Expiration
- 2044-09-14
AI Technical Summary
Existing operating system deletion tools cannot completely delete data in disks, resulting in sensitive information in the remaining space of the disk, posing a risk of leakage, and the entire disk erasing will increase unnecessary operation and time costs.
By parsing the partition of the ext file system, obtaining the remaining space of directory items and data blocks, and writing zero erasing to ensure the complete clearance of the data.
It effectively improves the security and efficiency of the hard disk when changing the usage scenarios, ensures data security, and avoids unnecessary operation and time costs.
Smart Images

Figure CN118796781B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data storage, and more particularly to a method, system, device and medium for erasing remaining space of an ext file system. Background Art
[0002] With the popularization of informatization, more and more computers store important and sensitive data. Therefore, sensitive data must be deleted before changing the usage scenario of the computer to avoid information leakage.
[0003] Usually, the operating system can delete files through a graphical interface or command, and can also erase the entire disk data by formatting. However, the deletion tool that comes with the operating system cannot completely delete the data, and the data still exists in the remaining space of the disk. Therefore, in order to prevent the data from being recovered by data recovery tools, there are also software on the market that can completely clear the disk by writing zeros to all sectors of the entire disk. Then reinstall the operating system or format it and continue to use it.
[0004] However, the deletion tools provided by existing operating systems cannot actually delete data from the disk. They only delete the index of the data, and the data content is still stored in the remaining space of the disk. In addition, during the data editing process, related software may also store and delete some temporary versions. Therefore, there may be one or more sensitive data in the remaining space of the disk. Even if there are no sensitive files on the current disk, we still cannot be sure whether there is sensitive information in the remaining space of the disk. These data may be recovered by data recovery tools, and there is still a risk of leakage.
[0005] Formatting or erasing the entire disk will delete all software and data on the disk, and even require reinstalling the operating system. If this method is used only to clear the data in the remaining space, it will increase a lot of unnecessary operations and time costs. Summary of the invention
[0006] In view of the above problems, the purpose of the present invention is to provide a method, system, device and medium for erasing the remaining space of an ext file system. By parsing the partitions of the ext file system on the disk, the remaining space of directory entries and data blocks in the disk is obtained and written to zero and erased, which effectively improves the security and efficiency of the hard disk when changing the usage scenario.
[0007] In order to achieve the above object, the present invention is implemented through the following technical solutions:
[0008] In a first aspect, the present invention discloses a method for erasing remaining space of an ext file system, comprising:
[0009] Parse the super block of the ext file system and obtain the global parameters of the partition based on the data structure of the super block;
[0010] Based on the global parameters, recursively clear the remaining space in all directory entries according to the inode number of the directory entry;
[0011] Based on the global parameters, the starting position of the block bitmap in each block group is determined, and all remaining spaces in the data block area are cleared by traversing the block bitmap.
[0012] Furthermore, the global parameters include but are not limited to:
[0013] The number of data blocks, the number of inodes, the block size, the partition superblock information, and the block group descriptor table.
[0014] Further, based on the global parameters, recursively clearing the remaining space in all directory entries according to the inode number of the directory entry includes the following steps:
[0015] S201: Set the inode number of the target inode to 2 as the target inode number;
[0016] S202: Obtain the starting block number of the inode table where the target inode number is located according to the block group descriptor information;
[0017] S203: Calculate the offset of the target inode in the inode table according to the target inode number;
[0018] S204: Obtain inode information of the target inode based on the starting block number of the inode table where the target inode number is located and the offset of the target inode in the inode table;
[0019] S205: obtaining a data block corresponding to the directory by parsing the inode information, and parsing the content of each directory entry according to the data structure sequence of the directory entry to obtain the length of each directory entry, the starting position of each directory entry, and the file type tag of each directory entry;
[0020] S206: Determine whether there is remaining space for the deleted file in each directory entry according to the length of each directory entry and the starting position of each directory entry; if so, execute step S207; if not, execute step S208:
[0021] S207: Write the storage space of the current directory entry to 0, and execute step S208;
[0022] S208: Determine whether the file type mark of the current directory entry is 00000010; if so, execute step S209; if not, directly end;
[0023] S209: Get the inode number of the current directory entry, update it to the target inode number, and execute step S202.
[0024] Further, the step S203 includes:
[0025] According to the target inode number, the offset P of the target inode in the inode table is calculated by the formula P = ((N -1)% n) × K;
[0026] Among them, N is the target inode number, n is the number of inodes for each block, and K is the number of bytes occupied by an inode.
[0027] Further, the step S206 includes:
[0028] If the current directory entry is the i-th directory entry, get the length L of the current directory entry i , the starting position of the current directory item D i and the starting position of the next directory entry D i+1 ;
[0029] Judgement D i+1 -D i >L i Is it true? If so, the directory entry has been deleted and there is remaining space in its storage space, which is regarded as the remaining space of the directory entry of the deleted file.
[0030] Further, the method of determining the starting position of the block bitmap in each block group based on the global parameter and clearing all remaining space in the data block area by traversing the block bitmap includes the following steps:
[0031] S301: Parse the block group descriptor table to obtain the starting position of the block bitmap in each block group;
[0032] S302: traverse all block bitmaps, analyze the block bitmaps bit by bit, obtain the usage status of each data block, and identify unused data blocks;
[0033] S303: for each unused data block, based on the block group number and the number of block bitmap bits of the data block, calculate the absolute block number of each unused data block;
[0034] S304: Determine the offset position of each unused data block in the partition according to the block size and the absolute block number, and write-zero erase to the corresponding data block.
[0035] Further, the step S303 includes:
[0036] The absolute block number JK is calculated by the formula JK = J0+KZ×D×8+Nu;
[0037] Among them, J0 is the starting block number of block group 0, KZ is the block group number of the current data block, D is the size of the data block, and Nu is the number of block bitmap bits of the current data block.
[0038] In a second aspect, the present invention further discloses a system for erasing remaining space of an ext file system, comprising:
[0039] The parsing module is used to parse the super block of the ext file system and obtain the global parameters of the partition according to the data structure of the super block;
[0040] A directory erasing module, used to recursively clear the remaining space in all directory entries according to the inode number of the directory entry based on the global parameters;
[0041] The data erasing module is used to determine the starting position of the block bitmap in each block group based on the global parameters, and clear all remaining spaces in the data block area by traversing the block bitmap.
[0042] In a third aspect, the present invention further discloses a device for erasing remaining space of an ext file system, comprising:
[0043] A memory, used to store the erasing program of the remaining space of the ext file system;
[0044] The processor is used to implement the steps of the method for erasing the remaining space of the ext file system as described in any one of the above items when executing the program for erasing the remaining space of the ext file system.
[0045] In a fourth aspect, the present invention further discloses a readable storage medium, on which is stored a program for erasing the remaining space of an ext file system. When the program for erasing the remaining space of an ext file system is executed by a processor, the steps of the method for erasing the remaining space of an ext file system as described in any of the above items are implemented.
[0046] Compared with the prior art, the beneficial effects of the present invention are as follows: The present invention discloses a method, system, device and medium for erasing the remaining space of an ext file system. By parsing the partition of the ext file system on the disk, the remaining space of the directory entries and data blocks in the disk is obtained and written to zero and erased. That is, the remaining space of known deleted files is cleared, and the problem that sensitive data may exist in unknown remaining space is solved. While ensuring the data security of the disk, the data such as the operating system, software, and regular files in the disk are retained. The security and efficiency of the hard disk are improved when changing the usage scenario.
[0047] It can be seen that compared with the prior art, the present invention has outstanding substantive features and significant progress, and the beneficial effects of its implementation are also obvious. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0049] Figure 1 It is a method flow chart of a specific implementation mode of the present invention.
[0050] Figure 2 It is a flow chart of step S2 of a specific implementation mode of the present invention.
[0051] Figure 3 It is a flow chart of step S3 of a specific implementation mode of the present invention.
[0052] Figure 4 It is a flow chart of a method for clearing remaining space of directory entries according to a specific implementation mode of the present invention.
[0053] Figure 5 It is a flow chart of a method for removing remaining space of a data block according to a specific implementation manner of the present invention.
[0054] Figure 6 It is a system structure diagram of a specific implementation mode of the present invention.
[0055] In the figure, 1. Parsing module; 2. Directory erasure module; 3. Data erasure module. DETAILED DESCRIPTION
[0056] In order to enable those skilled in the art to better understand the scheme of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0057] See also Figure 1 As shown, this embodiment provides a method for erasing the remaining space of an ext file system, comprising the following steps:
[0058] S1: Parse the super block of the ext file system and obtain the global parameters of the partition according to the data structure of the super block.
[0059] The global parameters include, but are not limited to, the number of data blocks, the number of inodes, the block size, the partition super block information, and the block group descriptor table.
[0060] S2: Based on the global parameters, recursively clear the remaining space in all directory entries according to the inode numbers of the directory entries.
[0061] S3: Based on the global parameters, determine the starting position of the block bitmap in each block group, and clear all remaining spaces in the data block area by traversing the block bitmap.
[0062] It should be noted that the ext file system divides the entire partition into various block groups, each of which consists of a super block, a block group descriptor table, a block bitmap, an inode bitmap, an inode table, a data block, etc. Each file has a unique inode number, and the inode stores the index of the data. The data block is the smallest allocation unit of the ext file system.
[0063] In the ext file system, the super block records the global basic information of the entire ext file system, such as the number of data blocks, the number of inodes, the block size, etc. Each block group in the file system corresponds to a block group descriptor, which together constitute the block group descriptor table. The block group descriptor records the location information of the data block bitmap, inode block bitmap, and inode table. The data block bitmap shows the usage of each data block in the block group, the inode block bitmap shows the usage of each inode in the block group, and the inode table stores the file's permission flags, modification time, creation time, data block index and other information.
[0064] Since the file name and file content of the ext file system are stored separately, the file name information is stored in the directory entry corresponding to its parent directory. After the file is deleted, only the directory entry is marked for deletion, and the file name is still saved in the original area.
[0065] The method obtains the remaining space of directory entries and data blocks in each partition of the disk by analyzing the ext file system and performs write-zero erasure, thereby completely erasing the remaining space of the ext file system.
[0066] In a specific embodiment, Figure 2 As shown, when executing the above step S2, the following steps may be specifically performed:
[0067] S201: Set the inode number of the target inode to 2 as the target inode number.
[0068] S202: Obtain the starting block number of the inode table where the target inode number is located according to the block group descriptor information.
[0069] S203: Calculate the offset of the target inode in the inode table according to the target inode number.
[0070] Specifically, according to the target inode number, the offset P of the target inode in the inode table is calculated by the formula P = ((N -1)% n) × K; where N is the target inode number, n is the number of inodes per block, and K is the number of bytes occupied by an inode.
[0071] S204: Obtain inode information of the target inode based on the starting block number of the inode table where the target inode number is located and the offset of the target inode in the inode table.
[0072] S205: Obtain the data block corresponding to the directory by parsing the inode information, and parse the content of each directory entry according to the data structure sequence of the directory entry to obtain the length of each directory entry, the starting position of each directory entry and the file type tag of each directory entry.
[0073] S206: Determine whether there is remaining directory entry space for deleted files in each directory entry according to the length of each directory entry and the starting position of each directory entry; if so, execute step S207; if not, execute step S208.
[0074] Specifically, if the current directory entry is the i-th directory entry, first obtain the length L of the current directory entry i , the starting position of the current directory item D i and the starting position of the next directory entry D i+1 .
[0075] Then, judge D i+1 -D i >L i Is it true? If so, the directory entry has been deleted and there is remaining space in its storage space, which is regarded as the remaining space of the directory entry of the deleted file.
[0076] S207: Write the storage space of the current directory entry to 0, and execute step S208.
[0077] S208: Determine whether the file type mark of the current directory entry is 00000010; if so, execute step S209; if not, end directly.
[0078] It should be noted that the file type tag of the directory entry has multiple status values. When the status value is 00000001, it indicates that the file type of the directory entry is a file; when the status value is 00000010, it indicates that the file type of the directory entry is a directory.
[0079] S209: Get the inode number of the current directory entry, update it to the target inode number, and execute step S202.
[0080] In a specific embodiment, Figure 3 As shown, when executing the above step S3, the following steps may be specifically performed:
[0081] S301: Parse the block group descriptor table to obtain the starting position of the block bitmap in each block group.
[0082] S302: traverse all block bitmaps, analyze the block bitmaps bit by bit, obtain the usage status of each data block, and identify unused data blocks.
[0083] S303: For each unused data block, based on the block group number and the number of block bitmap bits of the data block, calculate the absolute block number of each unused data block.
[0084] Specifically, the absolute block number JK is calculated by the formula JK = J0+KZ×D×8+Nu; wherein J0 is the starting block number of block group 0, KZ is the block group number of the current data block, D is the size of the data block, and Nu is the number of bits of the block bitmap of the current data block.
[0085] S304: Determine the offset position of each unused data block in the partition according to the block size and the absolute block number, and write-zero erase to the corresponding data block.
[0086] As an example, based on the above-mentioned method for erasing the remaining space of the ext file system, the present invention also discloses a method for erasing the remaining space of the ext file system, which is mainly divided into two steps:
[0087] 1. Recursively clear the remaining space in all directory entries.
[0088] 2. Clear all remaining space in the data block area.
[0089] In a specific embodiment, Figure 4 As shown, this method recursively clears the remaining space in all directory entries by executing a method for clearing the remaining space of directory entries. Specifically, it includes the following steps:
[0090] Step 0: parse the super block of the file system and obtain the global basic parameters of the partition according to the data structure of the super block of the ext file system.
[0091] Step 1: Combine the information of the super block to obtain the block group where the target inode (the first one is the inode corresponding to the root directory, inode number 2) is located, parse the block group descriptor corresponding to the block group, and obtain the starting block number of the inode table.
[0092] Step 2: Calculate the offset position of the inode in the inode table. The calculation method is as follows:
[0093] Offset = ((inode number - 1)% number of inodes per block group) × space occupied by one inode.
[0094] Step 3: Parse the inode information to obtain the data block corresponding to the directory, and parse the content of each directory entry in the order of the data structure of the directory entry.
[0095] Step 4: Determine whether there is any remaining space in the directory entry of the deleted file based on the length of the directory entry, the deletion mark and other information, and write zero to erase the area.
[0096] Step 5: Determine whether the current directory entry is a directory. If so, obtain its inode number and recursively perform step 1.
[0097] Step 6: Clear the remaining space of the directory items in sequence to complete the clearing of the remaining space of the directory items.
[0098] In a specific embodiment, Figure 5 As shown, this method clears all remaining space in the data block area by executing a method for clearing remaining space in the data block. Specifically, it includes the following steps:
[0099] Step 0: Parse the super block of the ext file system and obtain the global parameters of the partition according to the data structure of the super block.
[0100] Step 1: Parse the block group descriptor table and combine the global parameters to obtain the starting position of the block bitmap in each block group.
[0101] Step 2: traverse all block bitmaps, analyze the block bitmaps bit by bit, and obtain the usage status of each block.
[0102] Step 3: If the block status is unused, calculate the absolute block number of the block as follows:
[0103] Absolute block number = starting block number of block group 0 + block group number × block size × 8 + number of block bitmap bits.
[0104] Step 4: Calculate the offset and size of the block in the partition through the block size and absolute block number, and write zero to the block.
[0105] Step 5: Clear all unused blocks, that is, complete the clearing of the remaining space of all data blocks.
[0106] The present invention provides a method for erasing the remaining space of an ext file system. By parsing the partitions of the ext file system on a disk, the remaining space of directory entries and data blocks in the disk is obtained and written to zero and erased, thereby effectively improving the security and efficiency of the hard disk when changing the usage scenario.
[0107] See also Figure 6 As shown, the present invention also discloses a system for erasing the remaining space of an ext file system, comprising: a parsing module 1, a directory erasing module 2 and a data erasing module 3.
[0108] The parsing module 1 is used to parse the super block of the ext file system and obtain the global parameters of the partition according to the data structure of the super block.
[0109] The directory erasing module 2 is used to recursively clear the remaining space in all directory entries according to the inode numbers of the directory entries based on the global parameters.
[0110] The data erasing module 3 is used to determine the starting position of the block bitmap in each block group based on the global parameters, and clear all remaining spaces in the data block area by traversing the block bitmap.
[0111] The specific implementation of the system for erasing the remaining space of the ext file system in this embodiment is basically the same as the specific implementation of the method for erasing the remaining space of the ext file system described above, and will not be described in detail herein.
[0112] The present invention also discloses a device for erasing the remaining space of an ext file system, comprising a processor and a memory; wherein the processor implements the steps of the method for erasing the remaining space of an ext file system as described in any one of the above items when executing the erasing program of the remaining space of the ext file system stored in the memory.
[0113] Furthermore, the device for erasing the remaining space of the ext file system in this embodiment may also include:
[0114] The input interface is used to obtain the erase program of the remaining space of the ext file system imported from the outside, and save the erase program of the remaining space of the ext file system obtained to the memory, and can also be used to obtain various instructions and parameters transmitted by the external terminal device, and transmit them to the processor, so that the processor can use the above various instructions and parameters to carry out corresponding processing. In this embodiment, the input interface can specifically include but is not limited to a USB interface, a serial interface, a voice input interface, a fingerprint input interface, a hard disk reading interface, etc.
[0115] The output interface is used to output various data generated by the processor to the terminal device connected thereto, so that other terminal devices connected to the output interface can obtain various data generated by the processor. In this embodiment, the output interface may specifically include but is not limited to a USB interface, a serial interface, etc.
[0116] The communication unit is used to establish a remote communication connection between the ext file system remaining space erasing device and the external server, so that the ext file system remaining space erasing device can mount the image file to the external server. In this embodiment, the communication unit may specifically include but is not limited to a remote communication unit based on wireless communication technology or wired communication technology.
[0117] The keyboard is used to obtain various parameter data or instructions input by the user by tapping the keycaps in real time.
[0118] The display is used to display the relevant information of the erasing process of the remaining space of the ext file system in real time.
[0119] The mouse can be used to assist users in inputting data and simplify user operations.
[0120] The present invention also discloses a readable storage medium, wherein the readable storage medium includes a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable hard disk, a CD-ROM or any other form of storage medium known in the technical field. The readable storage medium stores an erasing program for the remaining space of an ext file system, and when the erasing program for the remaining space of an ext file system is executed by a processor, the steps of the method for erasing the remaining space of an ext file system as described in any one of the above items are implemented.
[0121] In summary, the present invention parses the partition of the ext file system on the disk, obtains the remaining space of the directory entries and data blocks in the disk and performs write-zero erasure, thereby effectively improving the security and efficiency of the hard disk when changing the usage scenario.
[0122] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the method disclosed in the embodiment, since it corresponds to the system disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0123] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0124] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, systems and methods can be implemented in other ways. For example, the system embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of systems or units, which can be electrical, mechanical or other forms.
[0125] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0126] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, or each module may exist physically separately, or two or more modules may be integrated into one unit.
[0127] Similarly, each processing unit in each embodiment of the present invention may be integrated into one functional module, or each processing unit may exist physically, or two or more processing units may be integrated into one functional module.
[0128] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, a software module executed by a processor, or a combination of the two. The software module may be placed in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0129] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0130] The above is a detailed introduction to the method, system, device and readable storage medium for erasing the remaining space of the ext file system provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method and core ideas of the present invention. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of the present invention, the present invention can also be improved and modified in a number of ways, and these improvements and modifications also fall within the scope of protection of the present invention.
Claims
1. A method for erasing the remaining space of an ext file system, characterized in that: include: Parse the super block of the ext file system and obtain the global parameters of the partition based on the data structure of the super block; Based on the global parameters, recursively clear the remaining space in all directory entries according to the inode number of the directory entry; Based on the global parameters, determine the starting position of the block bitmap in each block group, and clear all remaining space in the data block area by traversing the block bitmap; The global parameters include but are not limited to: The number of data blocks, the number of inodes, the block size, the partition superblock information and the block group descriptor table; The method of recursively clearing the remaining space in all directory entries based on the global parameters according to the inode number of the directory entry comprises the following steps: S201: Set the inode number of the target inode to 2 as the target inode number; S202: Obtain the starting block number of the inode table where the target inode number is located according to the block group descriptor information; S203: Calculate the offset of the target inode in the inode table according to the target inode number; S204: Obtain inode information of the target inode based on the starting block number of the inode table where the target inode number is located and the offset of the target inode in the inode table; S205: obtaining a data block corresponding to the directory by parsing the inode information, and parsing the content of each directory entry according to the data structure sequence of the directory entry to obtain the length of each directory entry, the starting position of each directory entry, and the file type tag of each directory entry; S206: Determine whether there is remaining space for the deleted file in each directory entry according to the length of each directory entry and the starting position of each directory entry; if so, execute step S207; if not, execute step S208: S207: Write the storage space of the current directory entry to 0, and execute step S208; S208: Determine whether the file type mark of the current directory entry is 00000010; if so, execute step S209; if not, directly end; S209: Get the inode number of the current directory entry, update it to the target inode number, and execute step S202.
2. The method for erasing the remaining space of the ext file system according to claim 1, characterized in that: The step S203 includes: According to the target inode number, the offset P of the target inode in the inode table is calculated by the formula P = ((N -1)% n) × K; Among them, N is the target inode number, n is the number of inodes for each block, and K is the number of bytes occupied by an inode.
3. The method for erasing the remaining space of the ext file system according to claim 2, characterized in that: The step S206 includes: If the current directory entry is the i-th directory entry, get the length L of the current directory entry i , the starting position of the current directory item D i and the starting position of the next directory entry D i+1 ; Judgement D i+1 -D i >L i Is it true? If so, the directory entry has been deleted and there is remaining space in its storage space, which is regarded as the remaining space of the directory entry of the deleted file.
4. The method for erasing the remaining space of the ext file system according to claim 1, characterized in that: The method of determining the starting position of the block bitmap in each block group based on the global parameters and clearing all remaining space in the data block area by traversing the block bitmap comprises the following steps: S301: Parse the block group descriptor table to obtain the starting position of the block bitmap in each block group; S302: traverse all block bitmaps, analyze the block bitmaps bit by bit, obtain the usage status of each data block, and identify unused data blocks; S303: for each unused data block, based on the block group number and the number of block bitmap bits of the data block, calculate the absolute block number of each unused data block; S304: Determine the offset position of each unused data block in the partition according to the block size and the absolute block number, and write-zero erase to the corresponding data block.
5. The method for erasing the remaining space of the ext file system according to claim 4, characterized in that: The step S303 includes: The absolute block number JK is calculated by the formula JK = J0+KZ×D×8+Nu; Among them, J0 is the starting block number of block group 0, KZ is the block group number of the current data block, D is the size of the data block, and Nu is the number of block bitmap bits of the current data block.
6. A system for erasing the remaining space of an ext file system, characterized in that: include: The parsing module is used to parse the super block of the ext file system and obtain the global parameters of the partition according to the data structure of the super block; A directory erasing module, used to recursively clear the remaining space in all directory entries according to the inode number of the directory entry based on the global parameters; A data erasing module, used for determining the starting position of the block bitmap in each block group based on the global parameters, and clearing all remaining spaces in the data block area by traversing the block bitmap; The global parameters include but are not limited to: The number of data blocks, the number of inodes, the block size, the partition superblock information and the block group descriptor table; The method of recursively clearing the remaining space in all directory entries based on the global parameters according to the inode number of the directory entry comprises the following steps: S201: Set the inode number of the target inode to 2 as the target inode number; S202: Obtain the starting block number of the inode table where the target inode number is located according to the block group descriptor information; S203: Calculate the offset of the target inode in the inode table according to the target inode number; S204: Obtain inode information of the target inode based on the starting block number of the inode table where the target inode number is located and the offset of the target inode in the inode table; S205: obtaining a data block corresponding to the directory by parsing the inode information, and parsing the content of each directory entry according to the data structure sequence of the directory entry to obtain the length of each directory entry, the starting position of each directory entry, and the file type tag of each directory entry; S206: Determine whether there is remaining space for the deleted file in each directory entry according to the length of each directory entry and the starting position of each directory entry; if so, execute step S207; if not, execute step S208: S207: Write the storage space of the current directory entry to 0, and execute step S208; S208: Determine whether the file type mark of the current directory entry is 00000010; if so, execute step S209; if not, directly end; S209: Get the inode number of the current directory entry, update it to the target inode number, and execute step S202.
7. A device for erasing remaining space of an ext file system, characterized in that: include: A memory, used to store the erasing program of the remaining space of the ext file system; A processor is used to implement the steps of the method for erasing the remaining space of the ext file system as described in any one of claims 1 to 5 when executing the program for erasing the remaining space of the ext file system.
8. A readable storage medium, characterized in that: The readable storage medium stores an erasing program for the remaining space of an ext file system, and when the erasing program for the remaining space of an ext file system is executed by a processor, the steps of the method for erasing the remaining space of an ext file system as claimed in any one of claims 1 to 5 are implemented.
