A file management method, device and processing equipment

By using deleted marks and overwritten write operations in network traffic forensic scenarios, the problem of disk performance degradation caused by rollback operations is solved, and efficient file management and performance improvement are achieved.

CN117991993BActive Publication Date: 2024-09-17北京安博通金安科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410234251.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-01
Publication Date
2024-09-17
Estimated Expiration
2044-03-01

AI Technical Summary

Technical Problem

In network traffic forensic scenarios, rollback operations lead to disk fragmentation and disk IO usage, which reduces packet storage performance. Existing solutions are costly or inconvenient for retrieval.

Method used

By configuring deleted marks and overwriting write operations on the disk, disk fragmentation and IO usage are avoided, file rollback is achieved without actually deleting files, and deleted marks and index directories are used for file management.

Benefits of technology

It effectively solves the problem of disk performance degradation caused by rollback operations, reduces disk fragmentation and IO usage, improves package storage performance, and simplifies file retrieval.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117991993B
    Figure CN117991993B
Patent Text Reader

Abstract

The present application provides a file management method, device and processing equipment. For the rollback operation in file management, based on the deleted mark and overwrite write operation, it can effectively avoid the disk fragmentation and disk IO occupation associated with the original file deletion method, and can effectively solve the problem of disk performance degradation caused by the rollback operation in the original network traffic forensics scenario, and has good practicality. The method includes: detecting whether the target file on the disk meets the file rollback condition; when the file rollback condition is met, if the target file is not deleted, configuring a deleted mark for the target file, wherein the deleted mark is used to mark the target file in a state where the file has been deleted; when triggering the target file to generate a new file, locating the target file, removing the deleted mark configured for the target file, and performing an overwrite write operation on the target file.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of file management, and in particular to a file management method, device and processing equipment. Background Art

[0002] In the face of the need for network traffic forensics (also referred to as backtracking or retrospective forensics), it is necessary to store network traffic (messages) for subsequent tracing and evidence collection. However, as network traffic is increasing, the storage space of devices is limited, so the stored traffic packet files must be rolled back.

[0003] Since the package files are large, they usually exceed the storage performance of a single core. Therefore, for large-volume package files, multiple cores must be used to store packages in parallel. When using multiple cores to store packages, due to the existence of the rollback mechanism, after a period of storage and rollback cycles, the disk will be severely fragmented, and disk fragmentation will greatly affect the disk write speed, resulting in a decrease in the overall package storage performance of the device; at the same time, disk fragmentation also has a great impact on the performance of reading files. For example, for the ext4 file format, after the file is fragmented, the file may consist of hundreds or even thousands of blocks, and these blocks are distributed in different locations on the disk. If you want to read a file, you need to move the head frequently, and head movement is a very time-consuming operation in file operations; in addition to fragmentation, when the network traffic is large and there are many messages to be saved, the input and output interface (IO) of the disk needs to be occupied during the rollback deletion process, which leads to a decrease in the device's package storage performance. Combined with the impact of fragmentation, the deletion process will be slower, and the impact on disk IO will be greater.

[0004] In order to reduce the impact of fragmentation on file reading and writing performance, the following practices are commonly used: 1) Use solid-state hard drives. However, the cost of solid-state hard drives is too high. In the network traffic backtracking scenario, a large number of traffic packet files need to be stored, and the required storage space usually reaches the T level. The high cost of T-level solid-state hard drives is a factor that must be considered; 2) Allocate an independent hard drive for each packet storage core. Each hard drive independently stores and rolls back packets. Although this can avoid fragmentation to a certain extent, if the amount of traffic packet files to be stored in each core is inconsistent, it will lead to disk waste. In addition, the use of independent hard drives will also increase the retrieval time of traffic packet files; 3) Only one file is generated, that is, there is only one traffic packet file on the entire disk, and there is no fragmentation at all. However, this method is not convenient for retrieval and positioning when retrieving specific content of the traffic packet file, especially when retrieving by time range, it cannot be filtered by the granularity of the file. Retrieving by time range is a common operation of network traffic forensics equipment. Therefore, only one traffic packet file is generated, which is not applicable.

[0005] In other words, in the network traffic forensics scenario, the existing management solution for traffic packet files is accompanied by many inconveniences when avoiding fragmentation and has the problem of low practicality. Summary of the invention

[0006] The present application provides a file management method, apparatus and processing equipment. For the rollback operation in file management, based on the deleted mark and overwrite write operation, it can effectively avoid the disk fragmentation and disk IO occupation associated with the original file deletion method, and can effectively solve the problem of disk performance degradation caused by the rollback operation in the original network traffic forensics scenario, and has good practicality.

[0007] In a first aspect, the present application provides a file management method, the method comprising:

[0008] Check whether the target file on the disk meets the file rollback condition;

[0009] When the file rollback condition is met, if the target file is not deleted, a deleted mark is configured for the target file, wherein the deleted mark is used to mark the target file as being in a deleted state;

[0010] When a trigger is triggered to generate a new file using a target file, the target file is located, a deleted mark configured for the target file is removed, and an overwriting operation is performed on the target file.

[0011] In combination with the first aspect of the present application, in a first possible implementation manner of the first aspect of the present application, when a file rollback condition is met, the method further includes:

[0012] Move the target file to a deleted file directory, and update a target index of the target file in an index directory, wherein the index directory includes indexes of multiple files configured with deleted marks;

[0013] Locate the target file, remove the deleted mark configured in the target file, and perform an overwrite operation on the target file, including:

[0014] The target traffic package file is located through the target index recorded in the index directory, removed from the deleted file directory, the deleted mark configured for the target file is removed, the target index of the target file in the index directory is removed, and an overwrite operation is performed on the target file.

[0015] In combination with the first possible implementation of the first aspect of the present application, in a second possible implementation of the first aspect of the present application, the file sizes of different files on the disk are pre-configured to be the same fixed file size.

[0016] In combination with the second possible implementation of the first aspect of the present application, in a third possible implementation of the first aspect of the present application, before detecting whether the target file on the disk meets the file rollback condition, the method further includes:

[0017] In the initial stage, the disk is formatted and different files are generated according to the fixed file size. Different files are stored in the deleted file directory. Different files are configured with deleted marks. Corresponding indexes are assigned to different files in the index directory for subsequent work.

[0018] When storing different files and generating new files, a first-in-first-out queue mechanism is used.

[0019] In combination with the third possible implementation of the first aspect of the present application, in a fourth possible implementation of the first aspect of the present application, detecting whether the target file on the disk meets the file rollback condition includes:

[0020] Check if there are any files in the deleted files directory;

[0021] If so, it is determined that the target file meets the file rollback condition.

[0022] In combination with the first aspect of the present application, in a fifth possible implementation manner of the first aspect of the present application, when the target file is not deleted, configuring a deleted mark for the target file includes:

[0023] If the target file is not deleted, a deleted mark is configured for the target file, and the contribution of the file size of the target file to the used storage space size of the disk is removed from the description information of the used storage space size of the disk.

[0024] In combination with the first aspect of the present application, in the sixth possible implementation manner of the first aspect of the present application, the method is specifically applied to the traffic packet file management work in the network traffic forensics scenario.

[0025] In a second aspect, the present application provides a file management device, the device comprising:

[0026] A condition detection unit, used to detect whether a target file on the disk meets a file rollback condition;

[0027] A deletion configuration unit, used for configuring a deleted mark for a target file when a file rollback condition is met and the target file is not deleted, wherein the deleted mark is used to mark the target file as being in a state where the file has been deleted;

[0028] The write operation unit is used to locate the target file, remove the deleted mark configured for the target file, and perform an overwrite write operation on the target file when a new file is generated using the target file.

[0029] In combination with the second aspect of the present application, in a first possible implementation manner of the second aspect of the present application, the configuration unit is deleted and further used to:

[0030] Move the target file to a deleted file directory, and update a target index of the target file in an index directory, wherein the index directory includes indexes of multiple files configured with deleted marks;

[0031] Write operation unit, specifically used for:

[0032] The target traffic package file is located through the target index recorded in the index directory, removed from the deleted file directory, the deleted mark configured for the target file is removed, the target index of the target file in the index directory is removed, and an overwrite operation is performed on the target file.

[0033] In combination with the first possible implementation of the second aspect of the present application, in a second possible implementation of the second aspect of the present application, the file sizes of different files on the disk are pre-configured to be the same fixed file size.

[0034] In combination with the second possible implementation of the second aspect of the present application, in a third possible implementation of the second aspect of the present application, the apparatus further includes an initial configuration unit, configured to:

[0035] In the initial stage, the disk is formatted and different files are generated according to the fixed file size. Different files are stored in the deleted file directory. Different files are configured with deleted marks. Corresponding indexes are assigned to different files in the index directory for subsequent work.

[0036] When storing different files and generating new files, a first-in-first-out queue mechanism is used.

[0037] In combination with the third possible implementation of the second aspect of the present application, in a fourth possible implementation of the second aspect of the present application, the condition detection unit is specifically used to:

[0038] Check if there are any files in the deleted files directory;

[0039] If so, it is determined that the target file meets the file rollback condition.

[0040] In combination with the second aspect of the present application, in a fifth possible implementation manner of the second aspect of the present application, the configuration unit is deleted, specifically used for:

[0041] If the target file is not deleted, a deleted mark is configured for the target file, and the contribution of the file size of the target file to the used storage space size of the disk is removed from the description information of the used storage space size of the disk.

[0042] In combination with the second aspect of the present application, in a sixth possible implementation of the second aspect of the present application, the device is specifically applied to traffic packet file management in a network traffic forensics scenario.

[0043] In a third aspect, the present application provides a processing device, including a processor and a memory, wherein a computer program is stored in the memory, and when the processor calls the computer program in the memory, the method provided in the first aspect of the present application or any possible implementation method of the first aspect of the present application is executed.

[0044] In a fourth aspect, the present application provides a computer-readable storage medium, which stores multiple instructions, and the instructions are suitable for a processor to load to execute the method provided by the first aspect of the present application or any possible implementation of the first aspect of the present application.

[0045] From the above content, it can be concluded that the present application has the following beneficial effects:

[0046] With respect to the rollback operation in file management, the present application detects whether the target file on the disk meets the file rollback conditions. When the file rollback conditions are met, a deleted mark is configured for the target file without deleting the target file, wherein the deleted mark is used to mark the target file as being in a deleted state. Subsequently, when triggering the target file to generate a new file, the target file is located, the deleted mark configured for the target file is removed, and an overwrite write operation is performed on the target file. In this process, the present application, on the one hand, achieves the original file rollback goal of deleting the target file through the deleted mark at a shallow level, and subsequently, the new file creation goal and update goal can be achieved in the background by performing an overwrite write operation on the retained target file. In this way, when the target file is rolled back, based on the deleted mark and the overwrite write operation, there is no need to perform an actual file deletion operation, which can effectively avoid the disk fragmentation and disk IO occupation associated with the original method of deleting files, and can effectively solve the problem of disk performance degradation caused by the rollback operation in the original network traffic forensics scenario, and has better practicality. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0048] Figure 1 A flowchart of the application document management method is shown below;

[0049] Figure 2A logical schematic diagram for the management and processing of the application documents;

[0050] Figure 3 Another logical diagram for the file management and processing of this application;

[0051] Figure 4 A structural diagram of the file management device of this application;

[0052] Figure 5 A schematic diagram of the structure of the processing equipment of this application. DETAILED DESCRIPTION

[0053] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.

[0054] The terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments described here can be implemented in an order other than that illustrated or described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or modules is not necessarily limited to those steps or modules clearly listed, but may include other steps or modules that are not clearly listed or inherent to these processes, methods, products or devices. The naming or numbering of steps in this application does not mean that the steps in the method flow must be executed in the time / logical sequence indicated by the naming or numbering. The process steps that have been named or numbered can change the execution order according to the technical purpose to be achieved, as long as the same or similar technical effects can be achieved.

[0055] The division of modules in this application is a logical division. There may be other division methods when it is implemented in actual applications. For example, multiple modules can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection between modules can be electrical or other similar forms, which are not limited in this application. In addition, the modules or submodules described as separate components may or may not be physically separated, may or may not be physical modules, or may be distributed in multiple circuit modules, and some or all of the modules may be selected according to actual needs to achieve the purpose of the present application.

[0056] Before introducing the file management method provided by this application, the background content involved in this application is first introduced.

[0057] The file management method, device and computer-readable storage medium provided in the present application can be applied to processing equipment. For the rollback operation in file management, based on the deleted mark and overwrite write operation, it can effectively avoid the disk fragmentation and disk IO occupation associated with the original file deletion method, and can effectively solve the problem of disk performance degradation caused by rollback operation in the original network traffic forensics scenario, and has better practicality.

[0058] The file management method mentioned in this application can be executed by a file management device, or a server, physical host or user equipment (UE) and other different types of processing devices integrated with the file management device. The file management device can be implemented in hardware or software, and the UE can be a terminal device such as a smart phone, tablet computer, laptop computer, desktop computer or personal digital assistant (PDA), and the processing device can be set in a device cluster.

[0059] It should be understood that the present application scheme is mainly aimed at the problem of disk performance degradation caused by rollback operations in the original network traffic forensics scenario. Correspondingly, the processing device that executes the present application scheme can be a network traffic forensics device (or it can also be called a network traffic backtracking device, a network traffic backtracking forensics device, etc.) that undertakes or is responsible for providing network traffic forensics (also referred to as backtracking or backtracking forensics) services in the network architecture, or other devices that provide file management services for network traffic forensics devices in the network architecture.

[0060] In this case, the present application solution can be specifically applied to the traffic packet file management work in the network traffic forensics scenario.

[0061] At the same time, considering that the file rollback operation to be improved specifically in this application is not only applicable to the original network traffic forensics scenario, but can also be applied to other application scenarios involving file rollback operations. Therefore, the processing device that executes the scheme of this application can also be any device in other application scenarios. Correspondingly, the scheme of this application can also be specifically applied to any file management work involving file rollback operations.

[0062] For the convenience of explanation, in the subsequent specific scheme description process of this application, the traffic packet file in the conference network traffic forensics scenario is used as an example for exemplary explanation.

[0063] Next, we will introduce the file management method provided by this application.

[0064] First, see Figure 1 , Figure 1 A flowchart of the file management method of the present application is shown. The file management method provided by the present application may specifically include the following steps S101 to S103:

[0065] Step S101, detecting whether the target file on the disk meets the file rollback condition;

[0066] It can be understood that the present application can initiate corresponding file rollback operations at the file granularity, which means that the present application scheme can actually involve multiple files on a disk that can involve file rollback operations in file management work. In this case, the present application takes a single file (for the convenience of explanation, the current targeted file is recorded as the target file) as the target to determine whether it is necessary to trigger the corresponding file rollback operation.

[0067] Correspondingly, the present application needs to pre-configure the file rollback conditions so that the device can determine whether the file rollback operation is met. If the file rollback conditions are not met, it is easy to understand that there is no need to initiate a file rollback operation on the current target file. On the contrary, if the file rollback conditions are met, it is necessary to initiate a file rollback operation on the current target file, which can specifically trigger the subsequent step S102 for processing.

[0068] Among them, it is easy to understand that the file rollback conditions can be configured as specific conditions such as whether a fixed time point is reached, whether the waiting time reaches the time interval, whether the file size reaches a threshold, whether the disk used space reaches a threshold, etc. This is relatively flexible. In the embodiment here, the focus is on how to subsequently promote the specific file rollback operation. Therefore, the file rollback conditions will not be explained in more detail here.

[0069] Step S102, when the file rollback condition is met, in the case where the target file is not deleted, a deleted mark is configured for the target file, wherein the deleted mark is used to mark the target file as being in a state where the file has been deleted;

[0070] It should be understood that in the original network traffic forensics scenario, when the rollback operation of the traffic packet file is triggered, the current traffic packet file will be deleted and a new traffic packet file will be created. This will easily lead to two major problems: fragmentation and occupying disk IO.

[0071] In this regard, the present application considers using a "false" deletion of files plus an overwrite write method to avoid these two major problems.

[0072] For the former, the present application can be implemented based on the deleted mark. The deleted mark makes the relevant file management process of the device think that the file configured with the deleted mark has been deleted by marking, so that the original file rollback target of the current target file can be achieved in a shallow aspect, while the current target file is actually retained, which corresponds to the processing of step S102;

[0073] For the latter, in the case where the target file that should have been deleted but was not actually deleted is retained, the file content of the original target file can be abandoned, and the original target file can be treated as a newly created file through an overwrite write operation, and the new content can be written into the original target file, which corresponds to the processing of the subsequent step S103.

[0074] This eliminates the need to delete files and writes new files based on the original files, greatly reducing or even eliminating the problem of disk fragmentation. In the network traffic forensics scenario, the original traffic packet file storage system has severe disk fragmentation after running for a long time, resulting in a great negative impact on the storage performance. After adopting the present application solution, the storage performance is still relatively stable after running for two weeks.

[0075] In addition, the impact on disk IO can also be avoided. In the network traffic forensics scenario, when the original traffic packet file storage system deletes a file, the deletion operation requires a considerable amount of disk IO, which causes the deletion of the file to affect the peak write speed of the storage system. After adopting the solution of the present application, the occupancy of the disk IO has been significantly improved, and the peak write speed has been in a relatively stable state, which can also promote better disk performance.

[0076] Step S103, when the target file is triggered to generate a new file, the target file is located, the deleted mark configured for the target file is removed, and an overwriting operation is performed on the target file.

[0077] It should be understood that step S102 and step S103 in the embodiment here are used to describe the solution of the present application with respect to the target file, or in other words, the solution of the present application is described from the perspective of the target file.

[0078] In the specific operation, it should be noted that step S103 is not directly related or connected to step S102. More specifically, when there are multiple files on the disk that may be involved in the file rollback operation, triggering a rollback operation on a certain file and configuring a corresponding deleted mark, and performing an overwrite operation on a certain file are two relatively independent links for the disk or the device where the disk is located. From the time dimension, when processing, you can first configure a deleted mark for the first file, and then perform an overwrite operation on the second file. After one or more overwrite operations on other files, you need to perform an overwrite operation on the first file.

[0079] In this case, when a new overwrite write operation needs to be created on the disk, it is necessary to select the file, select and locate the file that has previously undergone a "false" file deletion operation and has been configured with a deleted mark, delete its deleted mark, and you can also rename the file name, open the file, and then move the file pointer to the starting position of the file to overwrite the file.

[0080] If the size of the newly written data exceeds the size of the file itself, the file can be closed, waiting to be triggered or directly triggering the next round of judgment processing on whether the file rollback conditions are met, or triggering the creation of a new file for overwriting.

[0081] In the process of creating a new file and performing subsequent overwrite operations, file-related information may also be updated. The most basic one is the file name mentioned above. In addition, it may also involve file generation time, file closing time, file size (usually unchanged, corresponding to the physical unit of disk occupied by the file) and actual write size (after the file is created as a new file, it changes with the overwrite operation) and other aspects.

[0082] from Figure 1It can be seen from the illustrated embodiment that, for the rollback operation in file management, the present application detects whether the target file on the disk meets the file rollback condition. When the file rollback condition is met, a deleted mark is configured for the target file without deleting the target file, wherein the deleted mark is used to mark the target file as being in a state where the file has been deleted. Subsequently, when triggering the target file to generate a new file, the target file is located, the deleted mark configured for the target file is removed, and an overwrite write operation is performed on the target file. In this process, the present application, on the one hand, achieves the original file rollback goal of deleting the target file through the deleted mark at a shallow level, and subsequently, the new file creation goal and update goal can be achieved in the background by performing an overwrite write operation on the retained target file. In this way, when the target file is rolled back, based on the deleted mark and the overwrite write operation, there is no need to perform an actual file deletion operation, which can effectively avoid the disk fragmentation and disk IO occupation associated with the original method of deleting files, and can effectively solve the problem of disk performance degradation caused by the rollback operation in the original network traffic forensics scenario, and has better practicality.

[0083] Continue to the above Figure 1 Each step of the illustrated embodiment and possible implementation methods thereof in practical applications are described in detail.

[0084] Regarding the file management processing of this application, in order to further facilitate file management, or to further improve the file management effect, this application can also introduce a directory management mechanism.

[0085] Specifically, as an exemplary implementation, corresponding to step S102 in the previous embodiment, when the file rollback condition is met, the method of the present application may further include:

[0086] The target file is moved to a deleted file directory, and a target index of the target file is updated in an index directory, wherein the index directory includes indexes of a plurality of files configured with deleted marks.

[0087] For example, the present application can configure a deleted directory, which is specifically used to store traffic packet storage files that have been "falsely" deleted and have not been put into actual packet storage use. Subsequently, the specific traffic packet storage files can be taken out from the deleted directory and put into actual packet storage use. When the movement of the traffic packet storage file does not actually occur on the disk, the relative position of the traffic packet storage file can be updated by changing the file inode (index) (not the actual position of the physical unit on the disk, after all, the actual deletion or movement of the file is not involved). Since the actual position of the file on the disk has not changed, the operational overhead of moving the file and updating the index is very low, and can even be ignored.

[0088] In this case, corresponding to step S103 in the previous embodiment, the target file is located, the deleted mark configured on the target file is removed, and an overwriting operation is performed on the target file, which may specifically include:

[0089] The target traffic package file is located through the target index recorded in the index directory, removed from the deleted file directory, the deleted mark configured for the target file is removed, the target index of the target file in the index directory is removed, and an overwrite operation is performed on the target file.

[0090] Taking the traffic packet storage file as an example, it can be understood that after being moved out of the deleted file directory, the file can be stored in the directory where the packet storage system normally performs packet storage operations, and this directory can be recorded as the destination directory.

[0091] In the embodiment here, by introducing the above two directory mechanisms, multiple files (such as traffic storage package files) can be stored, which is more conducive to achieving refined and efficient file management effects.

[0092] In addition, it can be understood that, for the present application scheme, on the one hand, it can be directly implanted into the original application scenario. In this way, for the original files involved in the file rollback operation, after the implantation of the present application scheme, there is no need to delete the files, and the corresponding file rollback operations and corresponding file management can be directly carried out for these files, which plays the role of smooth implantation into the original application scenario, facilitates the advancement of the scheme or preliminary application attempts (mainly for observation before the formal use of the scheme), and in this case, it usually means that the file size of these files is fixed, and this feature exists; on the other hand, when applying the present application, the file size of the files involved in the file rollback operation can also be pre-adjusted. The file size of each file can be the same or different, and can be adjusted according to the actual situation. In this way, the file size can be fixed in advance according to the plan, which makes it easier for the present application scheme to achieve better file management effects.

[0093] It can be added that, in some cases, if disk space permits, a new file involved in the file rollback operation can be directly created. At this time, the file size can be aligned with the previously existing file or adjusted according to the actual situation.

[0094] As another exemplary embodiment, in the present application, the file sizes of different files on the disk can be pre-configured to be the same fixed file size.

[0095] For example, the fixed file size mentioned here may specifically be 64 GB.

[0096] Corresponding to the concept of pre-configuring a fixed file size here, the present application may also involve an initialization operation on the disk in the early stage.

[0097] Specifically, as another exemplary embodiment, before the previous step S101 detects whether the target file on the disk meets the file rollback condition, the method of the present application may further include:

[0098] In the initial stage, the disk is formatted and different files are generated according to the fixed file size. Different files are stored in the deleted file directory. Different files are configured with deleted marks. Corresponding indexes are assigned to different files in the index directory for subsequent work.

[0099] When storing different files and generating new files, a first-in-first-out queue mechanism is used.

[0100] It can be understood that formatting the disk space included in the file management scope can ensure that there will be no fragmentation problems in the initial stage. In this case, a file of a fixed file size is generated and moved to the deleted file directory, or a file of a fixed file size is directly generated in the deleted file directory, a deleted mark is configured, and a corresponding index is allocated in the index directory (which will be updated as the work progresses). This lays a good foundation for the subsequent actual file management work.

[0101] For example, in specific operations, to further ensure that the disk is free of fragmentation, the disk can be formatted when it is used for the first time or when it is just about to be used for traffic packet storage, and then 64GB fixed-size files are written to the disk sequentially until the corresponding disk threshold is reached. All generated files are stored in the deleted directory and added to the deleted file queue, and a first-in-first-out queue mechanism is used in subsequent work processes.

[0102] Among them, the First Input First Output (FIFO) queue mechanism means that during the working process, the objects to be processed are sorted according to the order in which they enter the queue. Each time processing is performed, the object at the first position (queue head) in the current queue is processed, and a new object is added to the end of the queue.

[0103] Taking the traffic package file as an example, when the program starts, the disk directory is scanned, and all traffic package files are stored in the traffic package file FIFO queue in the order of file generation, and it is determined whether the file rollback condition is met. If it is met, the earliest stored traffic package file is removed from the traffic package file FIFO queue, and the earliest stored traffic package file is moved to the deleted directory, and the deleted file queue is updated. The deleted file queue composed of deleted files in the deleted directory also uses the FIFO queue for removal processing (as a generated, new traffic package file).

[0104] In this way, a first-in-first-out queue mechanism is introduced through the two links of performing traffic packet processing on the generated traffic packet files and retrieving the traffic packet files from the deleted file directory (treating them as generated, new traffic packet files), forming a good cycle, so that the disk can complete the management of traffic packet files simply and efficiently.

[0105] At the same time, the file rollback conditions involved in step S101 may be specifically related to the deleted file directory in the above embodiment. It can be understood that the deleted file directory stores new deleted files to be generated. In theory, all files involved (such as different files generated according to a fixed file size after the formatting operation in the above embodiment) are linked to the used space of the disk. If there are no deleted files in the deleted file directory, this means that the used space of the disk has reached the threshold, and a rollback operation needs to be triggered to "roll back" the files previously taken out and put into use from the deleted file directory, so as to generate new deleted files that can be taken out in the deleted file directory for use in overwrite write operations.

[0106] In this regard, as another exemplary embodiment, the above step S101 detects whether the target file on the disk meets the file rollback condition, which may specifically include:

[0107] Check if there are any files in the deleted files directory;

[0108] If so, it is determined that the target file meets the file rollback condition.

[0109] Taking the traffic packet storage file as an example, when a new traffic packet storage file needs to be created during the traffic packet storage service processing, there are:

[0110] Determine whether the used disk space has reached the threshold. If not, create a new traffic packet storage file, write the file information into the traffic packet storage file FIFO queue, and update the used disk space size.

[0111] If there are traffic package files in the deleted directory and the used disk space has reached the threshold, check whether there are any traffic package files stored in the deleted directory. If there are, directly take out the traffic package file with the earliest generation time from the deleted directory, move the file to the destination directory, open the traffic package, and move the file pointer to the starting position of the file. Start the overwrite operation from the starting position. When the written data exceeds the size of the file itself, close the file and re-trigger the creation of a new traffic package file (the new traffic package file can also be directly created or come from the deleted directory). The file moved out of the deleted directory is also added to the traffic package file FIFO queue and treated as a completely new traffic package file.

[0112] If there is no traffic packet file in the deleted directory and the used disk space has reached the threshold, a rollback is required to remove the oldest traffic packet file from the traffic packet file FIFO queue, move the oldest traffic packet file to the deleted directory, and update the deleted file queue.

[0113] For the above content, you can also combine Figure 2 A logical schematic diagram of the file management process of the present application is shown for a more vivid understanding.

[0114] Furthermore, for the "false" file deletion method adopted by the present application during the file rollback process, the present application can also consider the visualization of the result presentation.

[0115] Specifically, as another exemplary embodiment, in step S102 of the present application, when the target file is not deleted, the process of configuring a deleted mark for the target file may further include:

[0116] If the target file is not deleted, a deleted mark is configured for the target file, and the contribution of the file size of the target file to the used storage space size of the disk is removed from the description information of the used storage space size of the disk.

[0117] It can be understood that, generally speaking, after deleting the target file, the contribution of the target file will be removed from the description information of the used storage space size of the disk. However, the present application adopts a "false" deletion method based on a deleted mark. The target file is not actually deleted, but is just "hidden". In fact, it still occupies the storage space of the disk. In this way, in order to align with the real file deletion result, the contribution of the file size of the target file to the used storage space size of the disk can be removed from the description information of the used storage space size of the disk, and the amount of the file size of the target file can be added to the available storage space size of the disk (the used space of the disk has not actually changed, but has changed logically).

[0118] Among them, the description information of the size of the used storage space of the disk can be presented in any disk management interface. Taking the user operation involved in the PC as an example, the disk properties window can be opened by right-clicking the mouse. The window usually describes the available space and the used space. At this time, the used space can be updated, which does not affect the subsequent file usage of the storage space occupied by the target files of the "false" deletion.

[0119] In this regard, we can also combine Figure 3 Another logical schematic diagram of the file management process of the present application is shown for a more vivid understanding.

[0120] The above is an introduction to the file management method provided by the present application. In order to better implement the file management method provided by the present application, the present application also provides a file management device from the perspective of functional modules.

[0121] See also Figure 4 , Figure 4 This is a schematic diagram of the structure of the file management device of the present application. In the present application, the file management device 400 may specifically include the following structure:

[0122] The condition detection unit 401 is used to detect whether the target file on the disk meets the file rollback condition;

[0123] A deletion configuration unit 402 is used to configure a deleted mark for the target file when the file rollback condition is met and the target file is not deleted, wherein the deleted mark is used to mark the target file as being in a state where the file has been deleted;

[0124] The write operation unit 403 is used to locate the target file, remove the deleted mark configured for the target file, and perform an overwrite write operation on the target file when triggering to generate a new file using the target file.

[0125] In an exemplary embodiment, the deletion configuration unit 402 is further configured to:

[0126] Move the target file to a deleted file directory, and update a target index of the target file in an index directory, wherein the index directory includes indexes of multiple files configured with deleted marks;

[0127] The write operation unit 403 is specifically used for:

[0128] The target traffic package file is located through the target index recorded in the index directory, removed from the deleted file directory, the deleted mark configured for the target file is removed, the target index of the target file in the index directory is removed, and an overwrite operation is performed on the target file.

[0129] In yet another exemplary embodiment, the file sizes of different files on the disk are pre-configured to be the same fixed file size.

[0130] In yet another exemplary embodiment, the apparatus further includes an initial configuration unit 404, configured to:

[0131] In the initial stage, the disk is formatted and different files are generated according to the fixed file size. Different files are stored in the deleted file directory. Different files are configured with deleted marks. Corresponding indexes are assigned to different files in the index directory for subsequent work.

[0132] When storing different files and generating new files, a first-in-first-out queue mechanism is used.

[0133] In another exemplary embodiment, the condition detection unit 401 is specifically configured to:

[0134] Check if there are any files in the deleted files directory;

[0135] If so, it is determined that the target file meets the file rollback condition.

[0136] In yet another exemplary embodiment, the deletion configuration unit 402 is specifically configured to:

[0137] If the target file is not deleted, a deleted mark is configured for the target file, and the contribution of the file size of the target file to the used storage space size of the disk is removed from the description information of the used storage space size of the disk.

[0138] In another exemplary embodiment, the device is specifically applied to traffic packet file management in a network traffic forensics scenario.

[0139] This application also provides a processing device from the perspective of hardware structure, see Figure 5 , Figure 5501, a memory 502, and an input / output device 503. The processor 501 is used to execute the computer program stored in the memory 502 to implement the following Figure 1 The steps of the file management method in the corresponding embodiment; or, the processor 501 is used to execute the computer program stored in the memory 502 to implement the following Figure 4 Corresponding to the functions of each unit in the embodiment, the memory 502 is used to store the processor 501 executing the above Figure 1 The computer program required by the file management method in the corresponding embodiment.

[0140] Exemplarily, the computer program may be divided into one or more modules / units, one or more modules / units are stored in the memory 502, and executed by the processor 501 to complete the present application. One or more modules / units may be a series of computer program instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer program in the computer device.

[0141] The processing device may include, but is not limited to, a processor 501, a memory 502, and an input / output device 503. Those skilled in the art will appreciate that the illustration is merely an example of a processing device and does not constitute a limitation on the processing device, and may include more or fewer components than shown in the illustration, or a combination of certain components, or different components. For example, the processing device may also include a network access device, a bus, etc., and the processor 501, the memory 502, the input / output device 503, etc. are connected via a bus.

[0142] The processor 501 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the processing device, and uses various interfaces and lines to connect various parts of the entire device.

[0143] The memory 502 can be used to store computer programs and / or modules. The processor 501 implements various functions of the computer device by running or executing the computer programs and / or modules stored in the memory 502 and calling the data stored in the memory 502. The memory 502 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function, etc.; the data storage area can store data created according to the use of the processing device, etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.

[0144] When the processor 501 is used to execute the computer program stored in the memory 502, the following functions can be implemented:

[0145] Check whether the target file on the disk meets the file rollback condition;

[0146] When the file rollback condition is met, if the target file is not deleted, a deleted mark is configured for the target file, wherein the deleted mark is used to mark the target file as being in a deleted state;

[0147] When a trigger is triggered to generate a new file using a target file, the target file is located, a deleted mark configured for the target file is removed, and an overwriting operation is performed on the target file.

[0148] Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working process of the file management device, processing device and its corresponding units described above can refer to the following. Figure 1 The description of the file management method in the corresponding embodiment will not be repeated here.

[0149] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.

[0150] To this end, the present application provides a computer-readable storage medium, in which a plurality of instructions are stored, and the instructions can be loaded by a processor to execute the present application as follows: Figure 1 For the steps of the file management method in the corresponding embodiment, the specific operations can be referred to as follows Figure 1 The description of the file management method in the corresponding embodiment will not be repeated here.

[0151] The computer-readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0152] Due to the instructions stored in the computer-readable storage medium, the present application can be executed. Figure 1 Corresponding to the steps of the file management method in the embodiment, therefore, the present application can be implemented as follows Figure 1 The beneficial effects that can be achieved by the file management method in the corresponding embodiment are detailed in the previous description and will not be repeated here.

[0153] The file management method, device, processing equipment and computer-readable storage medium provided by the present application are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for technical personnel in this field, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A file management method, characterized in that: The method is specifically applied to the management of traffic storage files in a network traffic forensics scenario, and the method includes: Check whether the target file on the disk meets the file rollback condition; When the file rollback condition is met, in the case that the target file is not deleted, a deleted mark is configured for the target file, wherein the deleted mark is used to mark that the target file is in a state where the file has been deleted; When triggering to generate a new file with the target file, locating the target file, removing the deleted mark configured for the target file, and performing an overwriting operation on the target file; When the file rollback condition is met, the method further includes: Move the target file to a deleted file directory, and update a target index of the target file in an index directory, wherein the index directory includes indexes of a plurality of files configured with the deleted mark; The locating the target file, removing the deleted mark configured on the target file, and performing an overwriting operation on the target file includes: The target traffic packet file is located through the target index recorded in the index directory, removed from the deleted file directory, the deleted mark configured for the target file is removed, the target index of the target file in the index directory is removed, and the overwrite write operation is performed on the target file.

2. The method according to claim 1, characterized in that The file sizes of different files on the disk are pre-configured to be the same fixed file size.

3. The method according to claim 2, characterized in that Before detecting whether the target file on the disk meets the file rollback condition, the method further includes: In the initial stage, the disk is formatted, the different files are generated according to the fixed file size, the different files are stored in the deleted file directory, the different files are all configured with the deleted mark, and corresponding indexes are allocated to the different files in the index directory for subsequent work; When storing the different files and generating new files, a first-in-first-out queue mechanism is adopted.

4. The method according to claim 3, characterized in that: The step of detecting whether the target file on the disk meets the file rollback condition includes: Check whether there are no files in the deleted file directory; If so, it is determined that the target file meets the file rollback condition.

5. The method according to claim 1, characterized in that: The step of configuring a deleted mark for the target file without deleting the target file includes: If the target file is not deleted, a deleted mark is configured for the target file, and the contribution of the file size of the target file to the used storage space size of the disk is removed from the description information of the used storage space size of the disk.

6. A file management device, characterized in that: The device is specifically applied to the management of traffic storage files in the network traffic forensics scenario, and the device includes: A condition detection unit, used to detect whether a target file on the disk meets a file rollback condition; a deletion configuration unit, configured to configure a deleted mark for the target file when the file rollback condition is met and the target file is not deleted, wherein the deleted mark is used to mark the target file as being in a deleted state; A write operation unit, used for locating the target file, removing the deleted mark configured for the target file, and performing an overwriting write operation on the target file when triggering to generate a new file with the target file; The deletion configuration unit is further used to: Move the target file to a deleted file directory, and update a target index of the target file in an index directory, wherein the index directory includes indexes of a plurality of files configured with the deleted mark; The write operation unit is specifically used for: The target traffic packet file is located through the target index recorded in the index directory, removed from the deleted file directory, the deleted mark configured for the target file is removed, the target index of the target file in the index directory is removed, and the overwrite write operation is performed on the target file.

7. A processing device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a computer program, and the processor executes the method according to any one of claims 1 to 5 when calling the computer program in the memory.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the method according to any one of claims 1 to 5.