WO2021129151A1 - File backup method and apparatus, and terminal device - Google Patents

File backup method and apparatus, and terminal device Download PDF

Info

Publication number
WO2021129151A1
WO2021129151A1 PCT/CN2020/125521 CN2020125521W WO2021129151A1 WO 2021129151 A1 WO2021129151 A1 WO 2021129151A1 CN 2020125521 W CN2020125521 W CN 2020125521W WO 2021129151 A1 WO2021129151 A1 WO 2021129151A1
Authority
WO
WIPO (PCT)
Prior art keywords
file
target
metadata
file system
file data
Prior art date
Application number
PCT/CN2020/125521
Other languages
French (fr)
Chinese (zh)
Inventor
倪龙宇
漆尚清
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2021129151A1 publication Critical patent/WO2021129151A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1458Management of the backup or restore process
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/13File access structures, e.g. distributed indices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files

Definitions

  • This application belongs to the technical field of data backup, and in particular relates to file backup methods, devices and terminal equipment.
  • the embodiments of the present application provide a file backup method, device, and terminal device, which can solve the problem of low file backup efficiency.
  • an embodiment of the present application provides a file backup method, including:
  • the file type of the file to be backed up is obtained first, and then the type identifier contained in the metadata in the metadata area of the first file system is matched, and the target file data corresponding to the file type is filtered out from the metadata area of the first file system.
  • the target file data block corresponding to the target metadata is filtered from the file data area of the first file system according to the target metadata, thereby completing the target metadata and target file data corresponding to the file to be backed up Block filtering.
  • the embodiment of the present application can realize batch sequential reading of file data blocks. Can save a lot of file data block reading time, file backup efficiency is greatly improved.
  • the operation of restoring the target metadata and the target file data block specifically includes:
  • the first storage space may be the internal storage space of the terminal device, or the storage space of other storage devices.
  • the target metadata and target file data block are stored by setting a dump space, and the file backup is performed after the data clearing is completed, which ensures the normal progress of the file backup of the first file system.
  • the target The operations for recovering metadata and target file data blocks specifically include:
  • the target file data block in a storage space is copied to the file data area of the second file system.
  • the target metadata and target file data block are stored by setting a dump space, and the file backup is performed after the file system installation is completed, which ensures the normal progress of the file backup of the first file system.
  • the embodiments of the present application include:
  • the first storage Address conversion is performed to obtain a third storage address
  • the second storage address is converted to obtain a fourth storage address.
  • the target metadata is copied to the metadata area of the second file system according to the third storage address
  • the target file data block is copied to the file data area of the second file system according to the fourth storage address.
  • the target metadata and the target file data block are formatted. Perform address conversion on the first storage address to obtain a fifth storage address, and perform conversion on the second storage address to obtain a sixth storage address. Copy the target metadata after format conversion to the metadata area of the second file system according to the fifth storage address, and copy the target file data block after format conversion to the file data of the second file system according to the sixth storage address Area.
  • the embodiment of the application After obtaining the target metadata, the target file data block, the first storage address, and the second storage address, the embodiment of the application will store data according to the system type and capacity of the first file system and the second file system, and the data of the second file system. Identify the scene according to the situation, and design the corresponding recovery plan according to the characteristics of different scenes. It can be seen that the embodiment of the present application can realize the compatible processing of three scenarios, ensure the fast and safe backup of target metadata and target file data in any one scenario, and can ensure that the second file system is able to ensure the recovery of the target metadata and target file data. Normal storage and use of target metadata and target file data.
  • the first file system may be an F2FS file system.
  • the screening process of target metadata and target file data blocks includes:
  • both sit_entry data and nat_entry data can locate the corresponding position of the file data block in the file data area, at this time, any one of the target sit_entry data and the target nat_entry data can be used to locate and filter the target file data block.
  • an embodiment of the present application provides a file backup device, including:
  • the metadata obtaining module is used to obtain the file type of the file to be backed up, and filter out the file type from the metadata area of the first file system according to the type identifier contained in the metadata area of the first file system.
  • a data block acquisition module configured to filter out target file data blocks corresponding to the target metadata from the file data area of the first file system
  • the data recovery module is used for recovering the target metadata to the metadata area of the second file system, and recovering the target file data block to the file data area of the second file system.
  • an embodiment of the present application provides a file backup method, which is applied to a first terminal device with a first file system installed, and the file backup method includes:
  • the embodiment of the present application can realize batch sequential reading of file data blocks. It can save a lot of file data block reading time, file backup efficiency is greatly improved, and at the same time, cross-device file backup can be realized.
  • an embodiment of the present application provides a file backup system, including: a first terminal device and a second terminal device, the first terminal device is installed with a first file System, a second file system is installed in the second terminal device;
  • the first terminal device is configured to obtain the file type of the file to be backed up, and from the metadata area of the first file system according to the type identifier included in the metadata in the metadata area of the first file system, Filter out the target metadata corresponding to the file type;
  • the first terminal device is further configured to filter out target file data blocks corresponding to the target metadata from the file data area of the first file system;
  • the first terminal device is further configured to send the target metadata and the target file data block to the second terminal device;
  • the second terminal device is configured to restore the target metadata to the metadata area of the second file system, and restore the target file data block to the file data area of the second file system.
  • an embodiment of the present application provides a file backup method, which is applied to a first terminal device with a first file system installed, and the file backup method includes:
  • the target file data block is sent to a second terminal device installed with a second file system, the target metadata is restored to the metadata area of the second file system through the second terminal device, and the target file data The block is restored to the file data area of the second file system.
  • the embodiment of the present application can realize batch sequential reading of file data blocks. Can save a lot of file data block reading time, file backup efficiency is greatly improved.
  • the storage device dumps the target metadata and target file data blocks.
  • the embodiment of the present application can also perform file backup between terminal devices well.
  • an embodiment of the present application provides a file backup system, including: a first terminal device, a second terminal device, and a storage device.
  • the first terminal device is installed with A first file system
  • a second file system is installed in the second terminal device;
  • the first terminal device is configured to obtain the file type of the file to be backed up, and from the metadata area of the first file system according to the type identifier included in the metadata in the metadata area of the first file system, Filter out the target metadata corresponding to the file type;
  • the first terminal device is further configured to filter out target file data blocks corresponding to the target metadata from the file data area of the first file system;
  • the first terminal device is further configured to send the target metadata and the target file data block to the storage device;
  • the storage device is configured to store the target metadata and the target file data block, and send the target metadata and the target file data block to the second terminal device;
  • the second terminal device is configured to restore the target metadata to the metadata area of the second file system, and restore the target file data block to the file data area of the second file system.
  • an embodiment of the present application provides a file backup method, which is applied to a first terminal device with a first file system installed, and includes:
  • the embodiment of the present application can realize batch sequential reading of file data blocks. Can save a lot of file data block reading time, file backup efficiency is greatly improved.
  • the storage device dumps the target metadata and target file data blocks.
  • the embodiment of the present application can also perform file backup between terminal devices well.
  • the embodiments of the present application can also be adapted to the situation of some second terminal devices with weak data processing capabilities, so as to realize fast and safe file backup.
  • an embodiment of the present application provides a file backup system, including: a first terminal device, a second terminal device, and a storage device.
  • the first terminal device is installed with A first file system
  • a second file system is installed in the second terminal device;
  • the first terminal device is configured to obtain the file type of the file to be backed up, and from the metadata area of the first file system according to the type identifier included in the metadata in the metadata area of the first file system, Filter out the target metadata corresponding to the file type;
  • the first terminal device is further configured to filter out target file data blocks corresponding to the target metadata from the file data area of the first file system;
  • the first terminal device is further configured to send the target metadata and the target file data block to the storage device;
  • the storage device is configured to store the target metadata and the target file data block, restore the target metadata to the metadata area of the second file system, and restore the target file data block To the file data area of the second file system.
  • an embodiment of the present application provides a terminal device.
  • the terminal device includes a memory and a processor.
  • the memory stores a computer program that can run on the processor, and the processor executes the The computer program implements the steps of the file backup method described in any one of the above-mentioned first aspects.
  • an embodiment of the present application provides a computer-readable storage medium, including: a computer program stored thereon, wherein the computer program is executed by a processor to implement any one of the above-mentioned aspects of the first aspect. Steps of file backup method.
  • an embodiment of the present application provides a computer program product that, when the computer program product runs on a terminal device, causes the terminal device to execute the steps of the file backup method described in any one of the above-mentioned first aspects.
  • FIG. 1 is a schematic flowchart of a file backup method provided in Embodiment 1 of the present application;
  • FIG. 2A is a schematic diagram of an application scenario provided by Embodiment 2 of the present application.
  • FIG. 2B is a schematic diagram of another application scenario provided by Embodiment 2 of the present application.
  • Embodiment 4 of the present application is a schematic flowchart of a file backup method provided by Embodiment 4 of the present application.
  • FIG. 4A is a schematic diagram of an application scenario provided by Embodiment 5 of the present application.
  • FIG. 4B is a schematic diagram of another application scenario provided by Embodiment 5 of the present application.
  • Embodiment 6 of the present application is a schematic flowchart of another file backup method provided by Embodiment 6 of the present application.
  • FIG. 6 is a schematic diagram of system interaction of the file backup system provided in the seventh embodiment of the present application.
  • FIG. 7 is a schematic flowchart of another file backup method provided in Embodiment 8 of the present application.
  • FIG. 8 is a schematic diagram of system interaction of another file backup system provided in the ninth embodiment of the present application.
  • FIG. 9 is a schematic flowchart of another file backup method provided in the tenth embodiment of the present application.
  • FIG. 10 is a schematic diagram of system interaction of another file backup system provided in the eleventh embodiment of the present application.
  • FIG. 11 is a schematic structural diagram of a file backup device provided in Embodiment 12 of the present application.
  • FIG. 12 is a schematic structural diagram of a terminal device provided by Embodiment 13 of the present application.
  • the term “if” can be construed as “when” or “once” or “in response to determination” or “in response to detecting “.
  • the phrase “if determined” or “if detected [described condition or event]” can be interpreted as meaning “once determined” or “in response to determination” or “once detected [described condition or event]” depending on the context ]” or “in response to detection of [condition or event described]”.
  • first”, “second”, “third”, etc. are only used to distinguish the description, and cannot be understood as indicating or implying relative importance. It should also be understood that although the terms “first”, “second”, etc. are used in the text in some embodiments of the present application to describe various elements, these elements should not be limited by these terms. These terms are only used to distinguish one element from another.
  • the first file system may be named the second file system, and similarly, the second file system may be named the first file system without departing from the scope of the various described embodiments.
  • the first file system and the second file system are both file systems, but they are not the same file system.
  • the file system is the software organization responsible for managing and storing file information in the operating system. It organizes and allocates the space of file storage devices, is responsible for file storage, and protects and retrieves stored files.
  • the file system consists of three parts. Composition: software related to file management, managed files, and data structure required for file management.
  • the file system has a metadata area and a file data area.
  • the file data area is an area responsible for storing files, and the file is stored in the form of file data blocks in the file data area.
  • the metadata area is an area that supports the file system architecture and is used to store metadata such as file index, validity, and robustness protection, as well as attribute data of the file system itself.
  • the files in the same folder may be scattered and stored in various places, and even the same file may be split and stored in various places, resulting in During the backup process, there will be a large number of random addressing and reading and storing data operations, which in turn causes the entire backup process to be extremely time-consuming and inefficient.
  • this embodiment of the application will pre-identify the file type of each file in the metadata.
  • the metadata of the file to be backed up is selected according to the file type of the file to be backed up, and the metadata is selected according to the metadata.
  • the data is used to determine each file data block corresponding to the file to be backed up, and finally the selected metadata and file data block are backed up to the target file system, thereby completing the backup of the file to be backed up.
  • the embodiment of the present application can realize batch sequential reading of file data blocks. It can save a lot of file data block reading time, and the efficiency of file backup is greatly improved.
  • the method for determining the file type is not limited here, and can be set by the technician according to the actual situation. For example, in some embodiments, the technician can provide selectable file type options in advance and store them in the terminal device.
  • the terminal device When the user performs file storage or file type modification, the terminal device displays the selectable file type options for the user to select and set. In other embodiments, the technical staff can also set the corresponding file type in advance. File type. At this time, the terminal device only needs to classify and identify the file according to the set file type data.
  • the first file system and the second file system where the first file system refers to the original file system that requires file retention, hereinafter referred to as the original system, and the second file system refers to the file system where the file target is stored, hereinafter referred to as the target system
  • the file backup in the embodiments of this application refers to backing up the target metadata and target file data blocks corresponding to the file to be backed up from the original system to the target system.
  • the original The system and the target system can be the same system or two different systems. When they are the same system, the target system is the original system after data clearing.
  • the type identification is used to identify the data of the file type.
  • a field will be selected or added in the metadata corresponding to the file in advance to record the type identification of the file, and will be added every time a file and
  • the type identification in the file metadata is set or updated according to the file type of the actual file.
  • the embodiment of this application does not limit the file type classification rules and the data content of the corresponding type identification, which can be set by the technicians according to actual needs.
  • the file requirements can be set in different levels. The importance level of the backup.
  • the file type corresponding to each file is a specific level, such as the first level, the second level, and the third level
  • the type identifier is a specific level identifier, such as: first
  • the type corresponding to the second level is identified as A
  • the corresponding type of the second level is identified as B
  • the corresponding type of the third level is identified as C.
  • it can also be based on the actual file backup under different application scenarios. Need to classify files and set corresponding type identifications, for example, corresponding to scene a, scene b, and scene c, and divide the files that need to be backed up under the three scenes into type 1, type 2, and type 3.
  • the corresponding type identifier at this time is a specific classification identifier, for example, it can be set as: the type identifier corresponding to the first type is number 1, the type identifier corresponding to the second type is number 2, and the type identifier corresponding to the third type is The number 3.
  • the execution subject of the file backup method is a terminal device with certain data processing functions and data storage functions.
  • the certain data processing functions mean that the data filtering and copying in the embodiments of this application can be performed. operating.
  • the embodiments of this application do not limit the specific device types of terminal devices, including but not limited to mobile phones, tablet computers, wearable devices, in-vehicle devices, augmented reality (AR)/virtual reality (VR) Devices, laptops, ultra-mobile personal computers (UMPC), netbooks, personal digital assistants (personal digital assistants, PDAs) and other terminal devices.
  • Fig. 1 shows the implementation flow chart of the file backup method provided in the first embodiment of the present application, and the details are as follows:
  • S101 Obtain the file type of the file to be backed up, and filter out target metadata corresponding to the file type from the metadata area of the first file system according to the type identifier contained in the metadata in the metadata area of the first file system.
  • this embodiment of the application will pre-set the classification rules for file types and the type identification corresponding to each file type, and will perform the type in the metadata according to the actual type of the file every time the file is stored and the file type is modified.
  • Set or update the identification therefore, when performing file backup, only need to obtain the file type of the file to be backed up, and identify and match the metadata in the metadata area of the first file system according to the type identification corresponding to the file type.
  • the method of obtaining the file type of the file to be backed up is not limited here. Depending on the actual scenario requirements, the method of obtaining may also have certain differences.
  • the display of selectable file types can be displayed in the terminal device, and the user Perform the selection operation in the terminal device by yourself, and then determine the specific file type of the file to be backed up according to the user's operation.
  • the technician can also select some default file types for backup in advance, and then directly read the default file type. .
  • the number of files that need to be backed up under different application scenarios may be different, so that the number of file types to be backed up may also be different. That is, the file types to be backed up in the embodiment of this application may include only One file type may also contain multiple file types at the same time.
  • the embodiment of this application does not limit the number of specific file types to be backed up, and can be selected or set by a technician according to actual application scenarios. Take an example to explain S101.
  • the file types are divided into the first type, the second type, the third type and the fourth type, and the type identification corresponding to the first type is set as the number 1, and the second type corresponds to the type
  • the identification is number 2
  • the type identification corresponding to the third type is number 3
  • the type identification corresponding to the fourth type is number 4.
  • the embodiment of the application will match the type identification of each metadata in the metadata area of the first file system, and filter out all the metadata whose type identification is 2 or 4, so as to get all the metadata in the metadata area of the first file system. Contains target metadata whose type ID is 2 or 4.
  • S102 Filter out target file data blocks corresponding to the target metadata from the file data area of the first file system.
  • the minimum storage unit of metadata includes, but is not limited to, the metadata section according to the different storage methods of the metadata in different file systems. And metadata block, the specific needs to be determined according to the actual file system. Therefore, a minimum storage unit of metadata may correspond to multiple file data blocks at the same time.
  • a single file may simultaneously correspond to multiple minimum metadata storage units and simultaneously correspond to multiple file data blocks.
  • the data in the minimum metadata storage unit corresponding to all files to be backed up are collectively referred to as target metadata
  • the file data blocks corresponding to all files to be backed up are collectively referred to as target file data blocks.
  • the target file data block to be backed up can be quickly located according to the address index stored in the target metadata (the actual file data block positioning operation may also involve To the address index between file data blocks, that is, according to the storage address or location relationship of other file data blocks stored in a certain file data block, to index and find the corresponding other file data blocks, so the specific target file data block is searched The process needs to be determined according to the actual target metadata situation and the found target file data block situation, which will not be described in detail here).
  • sequential reading may include:
  • the address index obtained at this time depends on the order itself. At this time, the sequential reading speed is very fast and the efficiency is extremely high.
  • the address index read out at this time may be sequence dependent, or there may be a certain interval, and there may even be an order disorder.
  • the speed of sequential reading is very fast and efficient.
  • address indexes with a certain interval since the address indexes belong to known data, the operation of sorting the address indexes and then sequentially reading them can be performed, so that sequential reading becomes a sequential search of existing address indexes.
  • the reading speed is undoubtedly faster and more efficient.
  • the order of the index addresses can be restored to normal by first sorting the address indexes, and then read operations sequentially, so that sequential reading becomes a sequential search of existing address indexes.
  • the reading speed is also faster and the efficiency is higher.
  • the embodiments of the present application can greatly reduce the time consumption of file data block addressing operations, save a large amount of file data block reading time, and further improve The efficiency of file backup.
  • S103 Restore the target metadata to the metadata area of the second file system, and restore the target file data block to the file data area of the second file system.
  • the embodiment of the present application does not limit the specific target metadata and target file data block recovery method, which can be selected or set by a technician according to actual needs, or may refer to the relevant description of the third embodiment of the present application.
  • this embodiment of the application will pre-identify the file type of each file in the metadata.
  • the metadata of the file to be backed up is selected according to the file type of the file to be backed up, and the metadata is selected according to the metadata.
  • the data is used to determine each file data block corresponding to the file to be backed up, and finally the selected metadata and file data block are backed up to the target file system, thereby completing the backup of the file to be backed up.
  • the embodiment of the present application can realize batch sequential reading of file data blocks. It can save a lot of file data block reading time, and the efficiency of file backup is greatly improved.
  • S103 includes at least two possible situations:
  • the original system and the target system are the same system. At this time, restoring the target metadata and target file data blocks to the target system actually refers to restoring the target metadata and target file data blocks to the original system after the data removal operation is completed.
  • restoring the target metadata and target file data blocks to the target system means storing the target metadata and target file data blocks to the target system.
  • the operation of restoring target metadata and target file data blocks specifically includes:
  • the specific situation of the first storage space may have certain differences.
  • the first storage space may be the internal storage space of the terminal device as the execution subject.
  • some smart phones will be pre-designed.
  • a part of the memory is set aside for temporary storage of data.
  • these reserved memory spaces can be used as the first storage space in the embodiment of the present application.
  • the first storage space can also be other storage than the terminal device.
  • the storage space in the software for example, a storage device such as a USB flash drive and a memory card can be connected to the terminal device.
  • the first storage space refers to the storage space in these storage devices, or the terminal device can be connected with a storage function.
  • the third-party device is connected to the third-party device, and the third-party device transfers the target metadata and target file data.
  • the first storage space refers to the storage space in the third-party device.
  • the target metadata in the first storage space is copied to the metadata area of the second file system, and the target file data block in the first storage space is copied to the second file system The file data area.
  • the embodiment of the present application will wait for the data clearing operation of the original system, and will not copy the target metadata and target file data to the original system until the data clearing operation is completed.
  • Metadata area and file data area are examples of metadata and file data area.
  • the way of data clearing depends on the actual situation, which is not limited here, including but not limited to data formatting, deleting all data, and reinstalling the file system.
  • the operation of restoring the target metadata and the target file data block at this time specifically includes:
  • file backup refers to backing up the files to be backed up from one terminal device to another terminal device.
  • the terminal device is assumed to be mobile phone A and the terminal device installed with the target system is mobile phone B.
  • the target metadata and target file data can be directly combined in theory. Blocks are stored to the target system without dumping, and because the target system and the original system are not in the same terminal device, no matter whether the original system data is cleared or not, it will not affect the recovery of target metadata and target file data blocks. That is, the operation of S103 data recovery does not need to consider whether the original system data removal is completed. That is, in some embodiments, after the target metadata and target file data blocks that need to be backed up are filtered out, they can be directly controlled by the terminal device as the execution subject. Restore the filtered target metadata and target file data blocks to another terminal device.
  • the target metadata and target file data blocks are restored.
  • the specific operations include:
  • the specific principle is the same as that of the embodiment corresponding to case 1, and will not be repeated here, but the difference of the embodiment corresponding to case 1 is that the embodiment of this application does not need to consider whether the original system data clearing is completed.
  • the first storage space refers to the storage space in the storage device. After the data and target file data blocks are transferred to the storage device, they can be controlled by the terminal device as the execution subject to restore the target metadata and target file data blocks in the storage device to another terminal device.
  • files are often encrypted and stored at the data block level.
  • the entire file must be backed up first.
  • the data area is decrypted to find the logical relationship between the file data blocks and the directory path in the decrypted data, thereby forming the corresponding information of the corresponding file or folder, and searching for all the file data blocks of the file to be backed up.
  • all file data blocks are decrypted and the file will be exposed in an unencrypted state, which makes the file security of the entire file backup process extremely low.
  • the capacity of the file system may be different, and the current storage situation of the target system may not be the same as the storage situation when the original system extracts target metadata and target file data blocks.
  • the file system of the same type is performing file recovery, it is necessary to formulate a suitable recovery plan based on the actual capacity of the two file systems and the current storage situation to ensure that the data written to the target system can be normal by the target system Storage and use. Therefore, on the basis of the above-mentioned embodiment 1 or 2 of this application, this embodiment of the application will classify file backup scenarios according to the system type, capacity and data storage situation of the original system and the target system, and each The characteristics and requirements of the scene provide a relatively safe target metadata and target file data block recovery plan.
  • the optional scene classification and corresponding recovery plan are detailed as follows:
  • Scenario 1 The system type and capacity of the original system and the target system are the same, and no data is stored in the target system.
  • unstored data means that the file system has not written data.
  • the system type and capacity of the original system and the target system are the same, it means that the original system and the target system have the same data storage method and maximum storage capacity.
  • no data is written in the target system, it means that the target system has no data.
  • Data storage can be performed anywhere in the data area and file data area.
  • the target metadata and target file data block can be directly put into the target system without any address mapping at this time to realize the target metadata And the target file data block has no address offset recovery.
  • the embodiment of the present application further includes:
  • the embodiment of the present application does not limit the execution timing of obtaining the first storage address and the second storage address too much. It only needs to ensure that it is before S103.
  • the target metadata can be filtered out in S101 while the corresponding first storage address is obtained.
  • obtain the corresponding second storage address while screening the target file data block in S102, or obtain the first storage address and the second storage address after S102 and before S103.
  • the embodiment of this application is combined with the above-mentioned embodiment 2 of this application, if the first storage space needs to be used for data transfer, the first storage address, the second storage address, the target metadata and the target file need to be transferred.
  • the data is stored in the first storage space together.
  • the specific steps for restoring target metadata and target file data blocks to the target system include:
  • the embodiment of this application will directly copy the target metadata to the metadata area of the target system according to the corresponding first storage address, and at the same time according to the corresponding The second storage address copies each target file data block one by one into the target system file data area.
  • the location of each target metadata and target file data block in the target system is exactly the same as the location in the original system, so There is no need to modify some data index information contained in the metadata and file data blocks, and it can also ensure that the target metadata and target file data blocks can be stored and used normally by the target system.
  • the target metadata and the storage address of the target file data block in the original system will be directly copied to the corresponding location of the target system, so as to achieve the target metadata and target file data in the target system.
  • the embodiment of the application does not need to modify the storage address for the backup of the file data block, there is no address mapping and the address index information update between the file data block, so that even the file data block is updated.
  • the data blocks are encrypted, and there is no need to decrypt the encrypted file data blocks in the entire file backup process of the embodiment of the present application, which avoids the risk of exposure to the file data blocks and the entire file, and greatly enhances the security of the file backup.
  • Scenario 2 The original system and the target system are of the same system type, but the capacities of the two are different, or the target system stores data, or the capacities of the two are different and the target system stores data.
  • stored data means that the file system has written data.
  • the system types of the original system and the target system are the same, which means that the two methods of data storage are the same, and there is no need to perform data format conversion.
  • the capacities of the two are different, it means that the address index and directory path between metadata and file data blocks are critical, etc. A certain offset will occur due to changes in capacity, which will make this information unavailable for direct use in the target system.
  • data is stored in the target system, it indicates that the target system corresponds to the first storage address and the second storage address. There may be data storage, and it is impossible to directly copy the data at the corresponding location.
  • the embodiment of the present application further includes:
  • the specific steps for restoring target metadata and target file data blocks to the target system include:
  • the first storage Address conversion is performed to obtain a third storage address
  • the second storage address is converted to obtain a fourth storage address
  • the embodiment of the present application converts the first storage address to obtain the third storage address corresponding to the target metadata in the metadata area of the target system, and the target file The data block corresponds to the fourth storage address in the file data area of the target system.
  • the embodiments of this application do not limit the specific address conversion methods used, and can be selected or set by the technicians according to actual needs, including but not limited to, such as using hash mapping, hash table mapping, or memory mapping to perform address mapping conversion .
  • the target metadata is copied to the metadata area of the second file system according to the third storage address, and the target file data block is copied to the file data area of the second file system according to the fourth storage address.
  • the embodiment of the present application will copy the target metadata one by one to the metadata area of the target system according to the corresponding third storage address, and at the same time according to the corresponding fourth storage address.
  • the storage address copies each target file data block one by one to the target system file data area.
  • the target metadata and target file data blocks will generally cause a certain storage address offset , And then realize the address offset recovery of the target metadata and the target file data block.
  • the address conversion is performed according to the storage address of the target metadata and the target file data block in the original system to obtain the corresponding storage address in the target system, and the conversion is performed according to the converted storage address
  • the copy of the target metadata and the target file data block enables the embodiment of this application to achieve effective recovery of data, ensuring that the target metadata and target file data block can be normally stored and used by the target system.
  • the embodiment of this application is based on Data recovery at the file data block level. Therefore, even if the file data block is encrypted in the file system, the embodiment of the present application will only decrypt the file data block when it is necessary to use the information in the file data block.
  • file data blocks On the basis of recovery plan B, considering the actual application, there may be a certain association between file data blocks. For the case where there are associated file data blocks, some associated file data will generally be stored in the file data block The storage address of the block. For example, when a single file is stored as multiple file data blocks, the metadata in actual applications generally only records the storage address of the file data block corresponding to the file, and it will be in these file data blocks at the same time. Set an address index field to record the storage address of one or more file data blocks associated.
  • the search process for the file data block corresponding to the file is to first locate some file data blocks through metadata, and then according to the located
  • the storage address of the address index field in the output data block is used to further locate the remaining file data blocks, and then realize the screening and positioning of all file data blocks of the file.
  • the target metadata and target file data blocks can be used normally by the target system, it is necessary to ensure the accuracy and reliability of the data recorded in the address index field of each target file data block.
  • the target file data block is copied to the file data area of the second file system according to the fourth storage address
  • the operations include:
  • the address index field is used to store the storage address of one or more target file data blocks.
  • this embodiment of the application will query the corresponding fourth storage address according to the second storage address of the related file data block originally recorded therein, and replace the queried fourth storage address with the original first storage address.
  • the storage address is recorded in the address index field, so as to realize the accurate update of the data in the address index field, and then according to the fourth storage address of the target file data block, the target file data block is copied to ensure the target system
  • the data recorded in the address index field in each target file data block is accurate and reliable.
  • the operation of updating the address index field specifically includes :
  • the target file data block contains an address index field and the target file data block is encrypted, the target file data block is decrypted to obtain the decrypted address index field.
  • the decrypted address index field is updated according to the second storage address and the fourth storage address, and the updated target file data block is encrypted.
  • the embodiment of the application will decrypt it first to obtain the decrypted target file data block, and then according to the associated file data block recorded in the address index field
  • the second storage address queries the corresponding fourth storage address, updates the address index field, and finally re-encrypts the updated target file data block to realize the accuracy of the address index field of the encrypted target file data block
  • the update ensures the accuracy and reliability of the data recorded in the address index field in each target file data block.
  • the embodiment of this application uses a single target file data block as a unit for encryption and decryption, as well as the update operation of the address index field, the entire The files to be backed up are completely decrypted, thereby ensuring the security of the entire process.
  • Scenario 3 The system types of the original system and the target system are different.
  • the embodiment of the present application further includes:
  • the specific steps for restoring target metadata and target file data blocks to the target system include:
  • the target metadata and the target file data block are formatted. Perform address conversion on the first storage address to obtain a fifth storage address, and perform conversion on the second storage address to obtain a sixth storage address.
  • the specific format conversion method can be selected or set by the technician according to the actual storage requirements of the original system and the target system for metadata and file data blocks (when the system type of the file system is known, the file system's metadata
  • the type, storage method, format and volume, as well as the storage method and volume of the file data block are all known information), which is not limited here, and only needs to ensure that the converted target element is based on the correct storage address.
  • the data and target file data can be stored and used by the target system normally.
  • the embodiment of the application will copy the target metadata to the metadata area of the target system one by one according to the corresponding fifth storage address, and at the same time according to the corresponding sixth storage address.
  • the storage address copies each target file data block one by one to the target system file data area, thereby realizing effective recovery of the target metadata and the target file data block.
  • the target metadata and target file data blocks are formatted according to the data storage requirements of the original system and the target system, and the target metadata and target file data blocks are in the original system according to the target metadata and target file data blocks.
  • the converted storage address performs the copy of the target metadata and the target file data block, so that the embodiment of the present application can achieve effective data recovery and ensure the target Metadata and target file data blocks can be normally stored and used by the target system.
  • the embodiment of the application is based on data recovery at the file data block level, even if the file data block is encrypted in the file system, the embodiment of the application is still As long as it is necessary to use the information in a file data block, the file data block can be decrypted (in the case of unencrypted, only format conversion and address conversion are required), and there is no need to perform the entire file data area. Data decryption also eliminates the need to restore the full picture of the file to be backed up, avoiding the risk of exposure to a large number of file data blocks and the entire file, so that the security of the file backup in the embodiment of the present application is greatly improved.
  • the target file data block after the format conversion is converted according to the sixth storage address
  • the operation of copying to the file data area of the second file system specifically includes:
  • the address index field is used to store the storage address of one or more target file data blocks.
  • the principle of the embodiment of this application is the same as the principle of the embodiment in the above restoration scheme B, except that the fourth storage address is replaced with the sixth storage address.
  • the fourth storage address is replaced with the sixth storage address.
  • the entire file backup process in the embodiment of the present application takes less time, which can greatly shorten the unavailability of the terminal device caused by the file backup.
  • the user experience is optimized.
  • the operations of data format conversion and storage address conversion can be performed by the user under the condition that the file to be backed up will not affect the user’s normal use of the terminal device.
  • the terminal device is used normally, it is performed in the background. At this time, the unavailability of the terminal device caused by the entire file backup is extremely short for the user, thereby optimizing the user experience.
  • the file defragmentation operation can also be performed in the background when the user normally uses the terminal device to ensure a good user experience.
  • the restoration plan A, the restoration plan B, and the restoration plan C are independent restoration plans corresponding to scene 1, scene 2 and scene 3, respectively.
  • the restoration plan can be used in practical applications.
  • the restoration scheme B and the restoration scheme C are respectively combined with the above-mentioned embodiments 1 and 2 of this application to obtain the corresponding detailed file backup scheme, but the scenarios that may be encountered in each file backup in actual applications are unknown, so Merely combining a single recovery plan cannot cope with the actual situation well.
  • the restoration scheme A, the restoration scheme B, and the restoration scheme C are arranged and combined, thereby To the following 4 combinations:
  • Combination Plan 4 Recovery Plan A+ Recovery Plan B+ Recovery Plan C.
  • Embodiments 1 and 2 of this application can arbitrarily choose a combination scheme to combine with Embodiments 1 and 2 of this application to obtain the corresponding file backup refinement plan.
  • the scene is identified according to the system type and capacity of the original system and the target system, and the data storage situation of the target system, and the recovery plan corresponding to the actual scene is selected from the combination plan according to the specific scene.
  • the specific combination scheme selection method is not limited here, and can be selected by the technician according to actual application requirements. It should be understood that in the file backup refinement solution applied in combination with the first and second embodiments of this application for a single recovery solution, before S103, there must be a first storage of the target metadata and target file data blocks in the original system.
  • the operation of obtaining the address and the second storage address is to ensure the normal execution of the subsequent recovery scheme.
  • each recovery scheme in the combined scheme is a parallel detail to S103 In this case, before S103, only one operation of obtaining the first storage address and the second storage address is required.
  • the embodiment of the present application includes:
  • S301 Obtain the file type of the file to be backed up, and filter out the target metadata corresponding to the file type from the metadata area of the first file system according to the type identifier included in the metadata in the metadata area of the first file system. Acquire the first storage address of the target metadata in the first file system.
  • S302 Filter out target file data blocks corresponding to the target metadata from the file data area of the first file system. Acquire the second storage address of the target file data block in the first file system.
  • S304 If the system type of the first file system and the system type of the second file system are the same, and the capacities of the second file system and the first file system are different, and/or, data is stored in the second file system, Address conversion is performed on a storage address to obtain a third storage address, and the second storage address is converted to obtain a fourth storage address.
  • S305 Copy the target metadata to the metadata area of the second file system according to the third storage address, and copy the target file data block to the file data area of the second file system according to the fourth storage address.
  • S306 If the system type of the first file system is different from the system type of the second file system, perform format conversion on the target metadata and the target file data block. Perform address conversion on the first storage address to obtain a fifth storage address, and perform conversion on the second storage address to obtain a sixth storage address.
  • the embodiment of this application After obtaining the target metadata, the target file data block, the first storage address, and the second storage address, the embodiment of this application will identify the scene according to the system type and capacity of the original system and the target system, and the data storage situation of the target system. For scenario 1, use recovery plan A for data recovery, for scenario 2, use recovery plan B for data recovery, and for scenario 3, use recovery plan C for data recovery (which will only be obtained once The first storage address and the second storage address). It can be seen from this that the embodiment of the present application can realize compatible processing of the three scenarios, ensure the fast and safe backup of the target metadata and target file data in any one of the scenarios, and can ensure that the target system is able to protect the target metadata after restoration. Normal storage and use of data and target file data.
  • the metadata area and file data area of the F2FS file system are described.
  • the metadata area of the F2FS file system includes super block, check point, and segment information table (Segment). Information Table (SIT), Node Address Table (NAT), and Segment Summary Area (SSA). The description of each part is as follows:
  • SIT is used to identify the validity of the data on each file data block in the file data area.
  • the data in the SIT is also stored in the form of data blocks, where each SIT data block is filled with multiple sit_entry data, and each sit_entry data Corresponding to a 64-byte valid_map, a valid_map corresponds to 512 file data blocks in the file data area, so the sit_entry data and the file data blocks in the file data area are in a one-to-one correspondence according to the physical address order. Theoretically, the correspondence can be calculated by SIT
  • the file data block position offset data can realize the positioning of the file data block without recording the real storage address of the file data.
  • NAT is used to record the index node (inode) data of the file.
  • inode index node
  • NAT is filled with nat_entry data, and each nat_entry data records an inode and the corresponding storage address of the inode in the file data area.
  • the storage address of the file data block corresponding to the inode may be a file Any position in the data area. (Usually after the file system is created, there will be inode data of the root node of the file system in NAT)
  • Checkpoint is used to record the validity of each field in SIT and NAT.
  • SIT0/SIT1 In the metadata area, there are two copies of SIT and NAT, namely SIT0/SIT1 and NAT0/NAT1.
  • Checkpoint is used to record whether SIT0 is used.
  • the corresponding field of is still the corresponding field in SIT1, and whether to use the corresponding field in NAT0 or the corresponding field in NAT1.
  • SSA is used to record the operation log information of SIT and NAT.
  • Super block is used to record the overall information of the file system, including the total amount, usage, and remaining amount of inodes and file data blocks, as well as the format and related information of the file system.
  • an identification field is set in the sit_entry data and/or nat_entry data in advance to store the type identification.
  • This field can be a newly added field in the sit_entry data and/or nat_entry data, or it can be Reuse an existing field in sit_entry data and/or nat_entry data, in which you can select only sit_entry data for identification field setting, or only nat_entry data for identification field setting, or both of sit_entry data and nat_entry data.
  • the corresponding identification field can be set by the technicians, and it is not limited here.
  • the business layer declares the type of the file or inherits the type attribute of the parent directory to determine the file corresponding According to the determined type, the type identification data in the identification field will be set or modified, and the inod data of the file header will be added to the NAT.
  • the embodiment of the present application will delete the corresponding identifier of the file in the valid_map of the SIT and delete the corresponding inode data in the NAT at the same time.
  • this embodiment of the application will also perform some corresponding auxiliary operations and records in Check Point and SSA simultaneously.
  • Step 1 Screening of target metadata and target file data blocks.
  • the operations corresponding to S101 and S102 specifically include:
  • the target file data block corresponding to the target sit_entry data or the target nat_entry data is filtered out.
  • the identification field is set in the sit_entry data and the nat_entry data.
  • the identification field is set in the sit_entry data and the nat_entry data as an example Note that at this time, S101 needs to match the type identification corresponding to the file type in the sit_entry data and the nat_entry data at the same time, so as to realize the effective screening of the target sit_entry data and the target nat_entry data corresponding to the file type.
  • both sit_entry data and nat_entry data can locate the corresponding position of the file data block in the file data area, at this time, the target file data block can be located by any one of the target sit_entry data and the target nat_entry data. filter.
  • the specific selection of target sit_entry data or target nat_entry data is not limited here, and can be set by the technician.
  • the operations corresponding to S101 and S102 specifically include:
  • the type identification of the nat_entry data needs to be traversed in S101 to find the corresponding target nat_entry data.
  • S102 it is necessary to locate the corresponding target file data block according to the target nat_entry data.
  • the embodiment of the application also needs to locate the target file data block in the file The location in the data area (this location can be either a physical storage address or location offset data) to locate the corresponding target sit_entry data, thereby achieving complete acquisition of target metadata.
  • the operations corresponding to S101 and S102 specifically include:
  • the target file data block corresponding to the target sit_entry data is filtered out. According to the storage address of the target file data block in the file data area, find the corresponding target nat_entry data.
  • the type identification of the sit_entry data needs to be traversed in S101 to find the corresponding target sit_entry data.
  • S102 it is necessary to locate the corresponding target file data block according to the target sit_entry data.
  • the embodiment of the application also needs to locate the target file data block in the file The physical storage address in the data area is used to locate the corresponding target nat_entry data, thereby achieving complete acquisition of target metadata.
  • target nat_entry data, target sit_entry data, and target file data block in the fifth embodiment of this application can also be selected according to the actual situation. Refer to the related description in the second embodiment of the present application, which will not be repeated here.
  • checkpoint data and segment summary area data can also be backed up together to ensure the robustness of the file system .
  • the dumping operations at this time include:
  • Step 2 Restore the target metadata and target file data to the target system.
  • the first embodiment of the application will directly copy the target nat_entry data and the storage address of the target sit_entry data in the metadata area of the original system to In the corresponding storage address in the target system metadata area, at the same time, according to the storage address of the target file data block in the file data area, it is directly copied to the corresponding storage address in the target system file data area.
  • the conversion operation is as follows:
  • the address conversion is direct mapping, that is, to find the SIT segment with sufficient free length in the target system, and then map the target sit_entry data to the corresponding free
  • the SIT segment maps the target sit_entry data M1 in the original system to Mk in the target system, 1 ⁇ k ⁇ n.
  • the target nat_entry data For the target nat_entry data, first determine the target sit_entry data corresponding to the target nat_entry data, and determine the mapping relationship between the first storage address and the third storage address of the target nat_entry data according to the mapping relationship between the first storage address and the third storage address of the target sit_entry data According to the mapping relationship and the first storage address of the target nat_entry data, the third storage address corresponding to the target nat_entry data can be determined.
  • the fourth storage address corresponding to the data block of the target file can be located and copied.
  • the operation includes: traversing the target file data block, and extracting the address index field of each target file data block
  • the first, second, and third-level storage address of the record and the fourth storage address of each target file data block are updated to the address index field in the associated target file data block to update the first, second, and third-level storage address to ensure
  • the target file data blocks can be indexed normally to ensure the normal use of the target file data blocks by the target system.
  • the sit_entry data and/or nat_entry data in the F2FS file system are typed, and when file backup is required, the sit_entry data of the file to be backed up is selected according to the file type of the file to be backed up And/or nat_entry data, and read the target file data block sequentially according to the selected sit_entry data and/or nat_entry data, and finally perform the target file system backup of the sit_entry data, nat_entry data and target file data block to achieve
  • the embodiment of the present application can save a lot of money. File data block reading time, file backup efficiency is greatly improved.
  • Embodiment 6 is a diagrammatic representation of Embodiment 6
  • FIG. 5 shows an implementation flow chart of the file backup method provided in the sixth embodiment of the present application, which is applied to the first terminal device installed with the first file system, as detailed as follows:
  • S501 Obtain the file type of the file to be backed up, and filter out target metadata corresponding to the file type from the metadata area of the first file system according to the type identifier contained in the metadata in the metadata area of the first file system.
  • S502 Filter out target file data blocks corresponding to the target metadata from the file data area of the first file system.
  • S503 Send the target metadata and the target file data block to the second terminal device installed with the second file system, where the target metadata and target file data are used to instruct the second terminal device to restore the target metadata to the second file system And restore the target file data block to the file data area of the second file system.
  • the file backup principle of the sixth embodiment of the present application is the same as that of the first embodiment of the present application, and will not be described in detail here.
  • the first terminal device as the execution subject will be directly connected to another second terminal device installed with the target system.
  • the first terminal device only needs to perform target metadata and
  • the target file data block is screened, and the target metadata and target file data block are sent to the second terminal device installed with the target system.
  • the specific target metadata and target file data block are restored to the target system for operation, and the second terminal device carry out.
  • the sixth embodiment of the present application can also be used in combination with the above-mentioned embodiments two to five of the present application. At this time, only the target metadata and target file data blocks need to be restored to the target system and assigned to the implementation of the present application.
  • the second terminal device in Example 6 is sufficient. For details, please refer to the description of the above-mentioned Embodiments 2 to 5 of the present application, which will not be repeated here.
  • FIG. 6 shows a schematic diagram of system interaction of the file backup system provided by the embodiment of the present application. For ease of description, only the parts related to the embodiment of the present application are shown.
  • the file backup system includes: a first terminal device and a second terminal device.
  • a first file system is installed in the first terminal device, and a second file system is installed in the second terminal device.
  • the first terminal device is configured to obtain the file type of the file to be backed up, and filter the file type from the metadata area of the first file system according to the type identifier included in the metadata area of the first file system The corresponding target metadata.
  • the first terminal device is further configured to filter out target file data blocks corresponding to the target metadata from the file data area of the first file system.
  • the first terminal device is further configured to send the target metadata and the target file data block to the second terminal device.
  • the second terminal device is configured to restore the target metadata to the metadata area of the second file system, and restore the target file data block to the file data area of the second file system.
  • the embodiments of the present application provide a process for each terminal device in the file backup system to realize their respective functions.
  • Embodiment 8 is a diagrammatic representation of Embodiment 8
  • FIG. 7 shows an implementation flow chart of the file backup method provided by the eighth embodiment of the present application, which is applied to the first terminal device with the first file system installed, and the details are as follows:
  • S701 Obtain the file type of the file to be backed up, and filter out target metadata corresponding to the file type from the metadata area of the first file system according to the type identifier included in the metadata in the metadata area of the first file system.
  • S702 Filter out target file data blocks corresponding to the target metadata from the file data area of the first file system.
  • S703 Send the target metadata and the target file data block to the storage device to instruct the storage device to store the target metadata and the target file data block, and send the target metadata and the target file data block to the second file installed
  • the second terminal device of the system restores the target metadata to the metadata area of the second file system through the second terminal device, and restores the target file data block to the file data area of the second file system.
  • the file backup principle of the eighth embodiment of the present application is the same as that of the second embodiment of the present application, and will not be described in detail here. For details, please refer to the descriptions of the first and second embodiments of the present application and other related embodiments.
  • the difference from the second embodiment of the present application is that in the eighth embodiment of the present application, the first terminal device as the execution subject will be connected to a storage device (corresponding to the second embodiment of the present application, at this time, the first storage space is Refers to the storage space in the storage device) is directly connected, and the storage device will be directly connected to another second terminal device installed with the target system.
  • the first terminal device only needs to perform target metadata and target files
  • the data block is screened, and the target metadata and target file data block are sent to the storage device.
  • the target metadata and target file data block are sent to the second terminal device installed with the target system.
  • the specific target The operation of restoring metadata and target file data blocks to the target system is completed by the second terminal device.
  • the eighth embodiment of the present application can also be combined with the above-mentioned embodiments three to five of the present application.
  • only the target metadata and target file data blocks need to be restored to the target system and assigned to the implementation of the present application.
  • the second terminal device in Example 8 is sufficient.
  • the eighth embodiment of the present application will set up a storage device between the two terminal devices, and the storage device will dump the target metadata and the target file data block.
  • a cloud server can be used as a storage device to perform physical backup. Two terminal devices at two locations far apart in space perform file backups.
  • FIG. 8 shows a schematic diagram of system interaction of the file backup system provided by the embodiment of the present application. For ease of description, only the parts related to the embodiment of the present application are shown.
  • the file backup system includes: a first terminal device, a second terminal device, and a storage device.
  • a first file system is installed in the first terminal device, and a second file system is installed in the second terminal device.
  • the first terminal device is configured to obtain the file type of the file to be backed up, and filter the file type from the metadata area of the first file system according to the type identifier contained in the metadata area of the first file system The corresponding target metadata.
  • the first terminal device is further configured to filter out target file data blocks corresponding to the target metadata from the file data area of the first file system.
  • the first terminal device is further configured to send the target metadata and the target file data block to the storage device.
  • the storage device is configured to store the target metadata and the target file data block, and send the target metadata and the target file data block to the second terminal device.
  • the second terminal device is configured to restore the target metadata to the metadata area of the second file system, and restore the target file data block to the file data area of the second file system.
  • the embodiments of the present application provide a process for each terminal device and storage device in the file backup system to realize their respective functions.
  • the eighth embodiment shown in FIG. 7 and other related method embodiments please refer to the description of the eighth embodiment shown in FIG. 7 and other related method embodiments, which will not be repeated here.
  • FIG. 9 shows an implementation flowchart of the file backup method provided in the tenth embodiment of the present application, which is applied to the first terminal device with the first file system installed, and the details are as follows:
  • S901 Obtain the file type of the file to be backed up, and filter out the target metadata corresponding to the file type from the metadata area of the first file system according to the type identifier included in the metadata in the metadata area of the first file system.
  • S902 Filter out target file data blocks corresponding to the target metadata from the file data area of the first file system.
  • the file backup principle of the tenth embodiment of the present application is the same as that of the second embodiment of the present application, and will not be described in detail here.
  • the first terminal device as the execution subject will be connected to a storage device (corresponding to the second embodiment of this application, at this time the first storage space is Refers to the storage space in the storage device) is directly connected, and the storage device will be directly connected to another second terminal device installed with the target system.
  • the first terminal device only needs to perform target metadata and target files
  • the data block is screened, and the target metadata and target file data block are sent to the storage device.
  • the target metadata and target file data block are sent to the second terminal device installed with the target system, and The target metadata and target file data blocks are restored to the target system in the second terminal device. Therefore, in the tenth embodiment of the present application, the specific target metadata and target file data blocks are restored to the target system by the storage device.
  • the tenth embodiment of the present application can also be used in combination with the above-mentioned embodiments three to five of the present application. At this time, only the target metadata and target file data blocks need to be restored to the target system and assigned to the implementation of the present application.
  • the storage device in Example 10 is sufficient. For details, please refer to the description of the above-mentioned Embodiments 3 to 5 of this application, which will not be repeated here.
  • a storage device (the storage device is a terminal device with data recovery processing and storage capabilities) is set between two terminal devices. Data blocks of the target file are dumped.
  • the embodiment of the present application can also perform well between the terminal devices. For example, you can use a cloud server as a storage device to back up files on two terminal devices in two locations with a relatively long physical space.
  • the specific target metadata and target file data block recovery to the target system in the tenth embodiment of the present application is completed by the storage device.
  • the advantage is that it can adapt to some weaker data processing capabilities.
  • terminal devices such as mobile hard disks and other special terminal devices, which only have extremely weak data processing capabilities, and the target metadata and target file data block recovery operations are too demanding, so it can be implemented by storage devices at this time Operations such as writing data to the second terminal device to complete the recovery of target metadata and target file data blocks.
  • Embodiment 11 is a diagrammatic representation of Embodiment 11:
  • FIG. 10 shows a schematic diagram of system interaction of the file backup system provided by the embodiment of the present application. For ease of description, only the parts related to the embodiment of the present application are shown.
  • the file backup system includes: a first terminal device, a second terminal device, and a storage device.
  • a first file system is installed in the first terminal device, and a second file system is installed in the second terminal device.
  • the first terminal device is configured to obtain the file type of the file to be backed up, and filter the file type from the metadata area of the first file system according to the type identifier contained in the metadata area of the first file system The corresponding target metadata.
  • the first terminal device is further configured to filter out target file data blocks corresponding to the target metadata from the file data area of the first file system.
  • the first terminal device is further configured to send the target metadata and the target file data block to the storage device.
  • the storage device is used to store the target metadata and the target file data block, restore the target metadata to the metadata area of the second file system, and restore the target file data block to the file data of the second file system Area.
  • the embodiment of the present application provides a process for each terminal device and storage device in the file backup system to realize their respective functions.
  • each terminal device and storage device in the file backup system to realize their respective functions.
  • the “original system needs to be cleared of data” is used as the background to explain the relevant solutions, but it is understandable that in practical applications, when the original system When the target system and the target system are installed on two different terminal devices, the file backup itself may not be related to whether the original system performs data clearing, that is, even if the original system does not perform data clearing, the above embodiments of the present application can still realize the backup to be backed up. Fast and safe backup of files to meet the needs of different practical application scenarios.
  • FIG. 11 shows a structural block diagram of a file backup device provided in an embodiment of the present application. For ease of description, only the parts related to the embodiment of the present application are shown.
  • the file backup device includes:
  • the metadata obtaining module 111 is used to obtain the file type of the file to be backed up, and filter out the corresponding file type from the metadata area of the first file system according to the type identification contained in the metadata in the metadata area of the first file system Target metadata.
  • the data block obtaining module 112 is configured to filter out the target file data block corresponding to the target metadata from the file data area of the first file system.
  • the data recovery module 113 is used for recovering the target metadata to the metadata area of the second file system, and recovering the target file data block to the file data area of the second file system.
  • the data recovery module 113 includes:
  • the storage module is used to copy the target metadata and the target file data block to the first storage space.
  • the recovery module is used for copying the target metadata in the first storage space to the metadata area of the second file system, and copying the target file data block in the first storage space to the file data area of the second file system.
  • the file backup device further includes:
  • the first address obtaining module is used to obtain the first storage address of the target metadata in the first file system.
  • the second address obtaining module is used to obtain the second storage address of the target file data block in the first file system.
  • the data recovery module 113 further includes:
  • the first type of recovery module is used to copy the target metadata to the second file according to the first storage address if the system type and capacity of the first file system and the second file system are the same, and no data is stored in the second file system
  • the data recovery module 113 further includes:
  • the first address conversion module is used if the system type of the first file system and the system type of the second file system are the same, and the capacities of the second file system and the first file system are different, and/or, in the second file system Data is stored, address conversion is performed on the first storage address to obtain a third storage address, and the second storage address is converted to obtain a fourth storage address.
  • the second type of recovery module is used to copy the target metadata to the metadata area of the second file system according to the third storage address, and copy the target file data block to the file data area of the second file system according to the fourth storage address.
  • the data recovery module 113 further includes: a data conversion module, configured to perform format conversion on the target metadata and the target file data block if the system type of the first file system and the system type of the second file system are different.
  • the second address conversion module is configured to perform address conversion on the first storage address to obtain a fifth storage address, and perform conversion on the second storage address to obtain a sixth storage address.
  • the third type of recovery module is used to copy the target metadata after format conversion to the metadata area of the second file system according to the fifth storage address, and copy the target file data block after format conversion according to the sixth storage address To the file data area of the second file system.
  • the second type of recovery module includes:
  • the address index update module is used to update the address index field according to the second storage address and the fourth storage address if the target file data block contains the address index field, and copy the updated target file data block to the fourth storage address according to the fourth storage address
  • the address index field is used to store the storage addresses of one or more target file data blocks.
  • the address index update module includes: a data block decryption module for decrypting the target file data block if the target file data block contains an address index field and the target file data block is encrypted to obtain the decrypted address index field .
  • the index update encryption module is used to update the decrypted address index field according to the second storage address and the fourth storage address, and to encrypt the updated target file data block.
  • FIG. 12 is a schematic structural diagram of a terminal device provided by an embodiment of the present application.
  • the terminal device 12 of this embodiment includes: at least one processor 120 (only one is shown in FIG. 12), and a memory 121.
  • Computer program 122 When the processor 120 executes the computer program 122, the steps in the above-mentioned file backup method embodiments, such as steps 101 to 103 shown in FIG. 1, are implemented.
  • the processor 120 executes the computer program 122, the functions of the modules/units in the foregoing device embodiments, for example, the functions of the modules 121 to 123 shown in FIG.
  • the terminal device 12 may be a computing device such as a mobile phone, a tablet computer, a desktop computer, a notebook, a palmtop computer, and a cloud server.
  • the terminal device may include, but is not limited to, a processor 120 and a memory 121.
  • FIG. 12 is only an example of the terminal device 12, and does not constitute a limitation on the terminal device 12. It may include more or less components than those shown in the figure, or a combination of certain components, or different components.
  • the terminal device may also include an input sending device, a network access device, a bus, and the like.
  • the so-called processor 120 may be a central processing unit (Central Processing Unit, CPU), or other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), Ready-made programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc.
  • the general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like.
  • the memory 121 may be an internal storage unit of the terminal device 12 in some embodiments, such as a hard disk or a memory of the terminal device 12.
  • the memory 121 may also be an external storage device of the terminal device 12, such as a plug-in hard disk equipped on the terminal device 12, a smart memory card (Smart Media Card, SMC), or a Secure Digital (SD). Card, Flash Card, etc. Further, the memory 121 may also include both an internal storage unit of the terminal device 12 and an external storage device.
  • the memory 121 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of the computer program.
  • the memory 121 may also be used to temporarily store data that has been sent or will be sent.
  • the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated unit can be implemented in the form of hardware or software functional unit.
  • the embodiments of the present application also provide a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in each of the foregoing method embodiments can be realized.
  • the embodiments of the present application provide a computer program product.
  • the steps in the foregoing method embodiments can be realized when the mobile terminal is executed.
  • the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium.
  • the computer program can be stored in a computer-readable storage medium.
  • the computer program can be stored in a computer-readable storage medium.
  • the steps of the foregoing method embodiments can be implemented.
  • the computer program includes computer program code, and the computer program code may be in the form of source code, object code, executable file, or some intermediate forms.
  • the computer-readable medium may at least include: any entity or device capable of carrying the computer program code to the photographing device/terminal device, recording medium, computer memory, read-only memory (ROM, Read-Only Memory), and random access memory (RAM, Random Access Memory), electric carrier signal, telecommunications signal and software distribution medium.
  • ROM read-only memory
  • RAM random access memory
  • electric carrier signal telecommunications signal and software distribution medium.
  • U disk mobile hard disk, floppy disk or CD-ROM, etc.
  • computer-readable media cannot be electrical carrier signals and telecommunication signals.
  • the disclosed device/terminal device and method may be implemented in other ways.
  • the device/terminal device embodiments described above are merely illustrative.
  • the division of the modules or units is only a logical function division, and there may be other divisions in actual implementation, such as multiple units.
  • components can be combined or integrated into another system, or some features can be omitted or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Quality & Reliability (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present application is applicable to the technical field of data backup. Provided are a file backup method and apparatus, and a terminal device. The method comprises: acquiring the file type of a file to be backed up, and according to type identifiers included in metadata in a metadata area of a first file system, screening the metadata area of the first file system to obtain target metadata corresponding to the file type; screening a file data area of the first file system to obtain a target file data block corresponding to the target metadata; and recovering the target metadata and the target file data block to a metadata area and a file data area of a second file system. By means of the embodiments of the present application, a large amount of data block reading time can be saved, thereby greatly improving the efficiency of file backup.

Description

文件备份方法、装置及终端设备File backup method, device and terminal equipment
本申请要求于2019年12月28日提交国家知识产权局、申请号为201911384164.8、申请名称为“文件备份方法、装置及终端设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the State Intellectual Property Office on December 28, 2019, the application number is 201911384164.8, and the application name is "File backup method, device and terminal equipment", the entire content of which is incorporated herein by reference Applying.
技术领域Technical field
本申请属于数据备份技术领域,尤其涉及文件备份方法、装置及终端设备。This application belongs to the technical field of data backup, and in particular relates to file backup methods, devices and terminal equipment.
背景技术Background technique
在进行文件***的数据清除时,若需要保留一部分文件,往往都是先将原文件***中需要保留的文件按照目录结构逐条拷贝出来,再将文件按照目录结构逐条写入目标文件***,但实际情况中文件***往往存在较为严重的数据碎片化情况,从而导致文件备份的过程耗时极长,效率低下。When clearing the data of the file system, if you need to retain some files, you usually copy the files that need to be retained in the original file system one by one according to the directory structure, and then write the files into the target file system one by one according to the directory structure. In this case, the file system often has serious data fragmentation, which causes the file backup process to be extremely time-consuming and inefficient.
发明内容Summary of the invention
本申请实施例提供了文件备份方法、装置及终端设备,可以解决文件备份效率低下问题。The embodiments of the present application provide a file backup method, device, and terminal device, which can solve the problem of low file backup efficiency.
第一方面,本申请实施例提供了一种文件备份方法,包括:In the first aspect, an embodiment of the present application provides a file backup method, including:
先获取待备份文件的文件类型,再对第一文件***的元数据区中元数据包含的类型标识进行匹配,从第一文件***的元数据区中筛选出文件类型对应的目标文件数据。The file type of the file to be backed up is obtained first, and then the type identifier contained in the metadata in the metadata area of the first file system is matched, and the target file data corresponding to the file type is filtered out from the metadata area of the first file system.
在获取到目标元数据之后,根据目标元数据从第一文件***的文件数据区之中筛选出目标元数据对应的目标文件数据块,从而完成了对待备份文件对应的目标元数据和目标文件数据块的筛选。After the target metadata is acquired, the target file data block corresponding to the target metadata is filtered from the file data area of the first file system according to the target metadata, thereby completing the target metadata and target file data corresponding to the file to be backed up Block filtering.
最后将筛选出的所有目标元数据和目标文件数据块恢复到第二文件***之中,完成对待备份文件的备份。Finally, all the selected target metadata and target file data blocks are restored to the second file system to complete the backup of the file to be backed up.
由于文件***中文件是以文件数据块的形式进行存储的,同时单个元数据可以同时索引一个或多个文件数据块,因此在进行文件备份时,根据元数据的顺序以及元数据索引文件数据块的顺序,可以实现对文件数据块的批量顺序读取,在文件***数据碎片化严重的情况下,相比需要进行大量的随机数据块读取的基于目录结构文件备份而言,本申请实施例可以节约大量的文件数据块读取时间,文件备份效率得到极大的提升。Because the files in the file system are stored in the form of file data blocks, and a single metadata can index one or more file data blocks at the same time, so when the file is backed up, the file data blocks are indexed according to the order of the metadata and the metadata In the case of serious file system data fragmentation, compared to the file backup based on the directory structure that requires a large number of random data block readings, the embodiment of the present application can realize batch sequential reading of file data blocks. Can save a lot of file data block reading time, file backup efficiency is greatly improved.
在第一方面的一种可能的实现方式中,当第一文件***和第二文件***是同一***时,对目标元数据和目标文件数据块进行恢复的操作具体包括:In a possible implementation manner of the first aspect, when the first file system and the second file system are the same system, the operation of restoring the target metadata and the target file data block specifically includes:
将所述目标元数据和目标文件数据块拷贝至第一存储空间,并在所述第一文件***数据清除后,将第一存储空间中的目标元数据拷贝至第二文件***的元数据区,以及将第一存储空间中的目标文件数据块拷贝至第二文件***的文件数据区。其中,第一存储空间可以是终端设备的内部存储空间,也可以是其他存储器件的存储空间。Copy the target metadata and target file data blocks to the first storage space, and after the first file system data is cleared, copy the target metadata in the first storage space to the metadata area of the second file system , And copy the target file data block in the first storage space to the file data area of the second file system. The first storage space may be the internal storage space of the terminal device, or the storage space of other storage devices.
在本申请实施例中,通过设置一个转存的空间进行目标元数据和目标文件数据块存储,并在数据清除完成后才进行文件备份,保障了第一文件***文件备份的正常进行。In the embodiment of the present application, the target metadata and target file data block are stored by setting a dump space, and the file backup is performed after the data clearing is completed, which ensures the normal progress of the file backup of the first file system.
在第一方面的另一种可能的实现方式中,当第一文件***和第二文件***不是同一***时,但第一文件***和第二文件***都是安装于同一终端设备时,对目标元数据和目标文件数据块进行恢复的操作具体包括:In another possible implementation of the first aspect, when the first file system and the second file system are not the same system, but the first file system and the second file system are both installed on the same terminal device, the target The operations for recovering metadata and target file data blocks specifically include:
将目标元数据和目标文件数据块拷贝至第一存储空间,并在第二文件***安装完成后,将第一存储空间中的目标元数据拷贝至第二文件***的元数据区,以及将第一存储空间中的目标文件数据块拷贝至第二文件***的文件数据区。Copy the target metadata and target file data block to the first storage space, and after the second file system is installed, copy the target metadata in the first storage space to the metadata area of the second file system, and copy the first file system to the metadata area of the second file system. The target file data block in a storage space is copied to the file data area of the second file system.
在本申请实施例中,通过设置一个转存的空间进行目标元数据和目标文件数据块存储,并在文件***安装完成后才进行文件备份,保障了第一文件***文件备份的正常进行。In the embodiment of the present application, the target metadata and target file data block are stored by setting a dump space, and the file backup is performed after the file system installation is completed, which ensures the normal progress of the file backup of the first file system.
在第一方面的另一种可能的实现方式中,为了能最大程度地兼容不同第一文件***和第二文件***的不同实际情况,保障对待备份文件的快速安全备份,本申请实施例包括:In another possible implementation of the first aspect, in order to be compatible with the different actual situations of different first file systems and second file systems to the greatest extent, and to ensure fast and safe backup of files to be backed up, the embodiments of the present application include:
获取待备份文件的文件类型,并根据第一文件***的元数据区中元数据包含的类型标识,从第一文件***的元数据区中,筛选出文件类型对应的目标元数据。获取目标元数据在第一文件***中的第一存储地址。Obtain the file type of the file to be backed up, and filter out the target metadata corresponding to the file type from the metadata area of the first file system according to the type identifier included in the metadata in the metadata area of the first file system. Acquire the first storage address of the target metadata in the first file system.
从第一文件***的文件数据区中,筛选出目标元数据对应的目标文件数据块。获取目标文件数据块在第一文件***中的第二存储地址。From the file data area of the first file system, filter out the target file data blocks corresponding to the target metadata. Acquire the second storage address of the target file data block in the first file system.
若第一文件***与第二文件***的***类型和容量均相同,且第二文件***内未存储数据,按照第一存储地址将目标元数据拷贝至第二文件***的元数据区,并按照第二存储地址将目标文件数据块拷贝至第二文件***的文件数据区。If the system type and capacity of the first file system and the second file system are the same, and no data is stored in the second file system, copy the target metadata to the metadata area of the second file system according to the first storage address, and follow The second storage address copies the target file data block to the file data area of the second file system.
若第一文件***的***类型和第二文件***的***类型相同,且第二文件***和第一文件***的容量不相同,和/或,第二文件***内存储有数据,对第一存储地址进行地址转换得到第三存储地址,并对第二存储地址进行转换得到第四存储地址。按照第三存储地址将目标元数据拷贝至第二文件***的元数据区,并按照第四存储地址将目标文件数据块拷贝至第二文件***的文件数据区。If the system type of the first file system and the system type of the second file system are the same, and the capacities of the second file system and the first file system are different, and/or, the second file system stores data, the first storage Address conversion is performed to obtain a third storage address, and the second storage address is converted to obtain a fourth storage address. The target metadata is copied to the metadata area of the second file system according to the third storage address, and the target file data block is copied to the file data area of the second file system according to the fourth storage address.
若第一文件***的***类型和第二文件***的***类型不相同,对目标元数据和目标文件数据块进行格式转换。对第一存储地址进行地址转换得到第五存储地址,并对第二存储地址进行转换得到第六存储地址。按照第五存储地址,将格式转换后的目标元数据拷贝至第二文件***的元数据区,并按照第六存储地址,将格式转换后的目标文件数据块拷贝至第二文件***的文件数据区。If the system type of the first file system and the system type of the second file system are not the same, the target metadata and the target file data block are formatted. Perform address conversion on the first storage address to obtain a fifth storage address, and perform conversion on the second storage address to obtain a sixth storage address. Copy the target metadata after format conversion to the metadata area of the second file system according to the fifth storage address, and copy the target file data block after format conversion to the file data of the second file system according to the sixth storage address Area.
本申请实施例在获取到目标元数据、目标文件数据块、第一储存地址以及第二储存地址之后,会根据第一文件***和第二文件***的***类型、容量以及第二文件***数据存储情况来识别场景,并根据不同的场景特点设计了对应的恢复方案。由此可知,本申请实施例可以实现对三种场景的兼容处理,保障在任意一种场景之中对目标元数据和目标文件数据的快速安全备份,且可以保障第二文件***对恢复后的目标元数据和目标文件数据的正常存储和使用。After obtaining the target metadata, the target file data block, the first storage address, and the second storage address, the embodiment of the application will store data according to the system type and capacity of the first file system and the second file system, and the data of the second file system. Identify the scene according to the situation, and design the corresponding recovery plan according to the characteristics of different scenes. It can be seen that the embodiment of the present application can realize the compatible processing of three scenarios, ensure the fast and safe backup of target metadata and target file data in any one scenario, and can ensure that the second file system is able to ensure the recovery of the target metadata and target file data. Normal storage and use of target metadata and target file data.
在第一方面的另一种可能的实现方式中,第一文件***可以是F2FS文件***,此时目标元数据和目标文件数据块的筛选过程,包括:In another possible implementation manner of the first aspect, the first file system may be an F2FS file system. In this case, the screening process of target metadata and target file data blocks includes:
遍历所述第一文件***内各个sit_entry数据的类型标识,筛选出类型标识与所述文件类型匹配的目标sit_entry数据;遍历所述第一文件***内的各个nat_entry数据的类型标识,筛选出类型标识与所述文件类型匹配的目标nat_entry数据;Traverse the type identification of each sit_entry data in the first file system to filter out target sit_entry data whose type identification matches the file type; traverse the type identification of each nat_entry data in the first file system to filter out the type identification Target nat_entry data matching the file type;
从所述第一文件***的文件数据区中,筛选出所述目标sit_entry数据或所述目标 nat_entry数据对应的所述目标文件数据块。From the file data area of the first file system, filter out the target file data block corresponding to the target sit_entry data or the target nat_entry data.
由于sit_entry数据和nat_entry数据都可以定位出文件数据块在文件数据区中对应的位置,因此此时可以通过目标sit_entry数据和目标nat_entry数据中的任意一个数据,来进行目标文件数据块的定位筛选。Since both sit_entry data and nat_entry data can locate the corresponding position of the file data block in the file data area, at this time, any one of the target sit_entry data and the target nat_entry data can be used to locate and filter the target file data block.
第二方面,对应于第一方面的文件备份方法,本申请实施例提供了一种文件备份装置,包括:In the second aspect, corresponding to the file backup method of the first aspect, an embodiment of the present application provides a file backup device, including:
元数据获取模块,用于获取待备份文件的文件类型,并根据第一文件***的元数据区中元数据包含的类型标识,从所述第一文件***的元数据区中,筛选出所述文件类型对应的目标元数据;The metadata obtaining module is used to obtain the file type of the file to be backed up, and filter out the file type from the metadata area of the first file system according to the type identifier contained in the metadata area of the first file system. Target metadata corresponding to the file type;
数据块获取模块,用于从所述第一文件***的文件数据区中,筛选出所述目标元数据对应的目标文件数据块;A data block acquisition module, configured to filter out target file data blocks corresponding to the target metadata from the file data area of the first file system;
数据恢复模块,用于将所述目标元数据恢复至第二文件***的元数据区,以及将所述目标文件数据块恢复至所述第二文件***的文件数据区。The data recovery module is used for recovering the target metadata to the metadata area of the second file system, and recovering the target file data block to the file data area of the second file system.
第三方面,本申请实施例提供了一种文件备份方法,应用于安装有第一文件***的第一终端设备,所述文件备份方法包括:In a third aspect, an embodiment of the present application provides a file backup method, which is applied to a first terminal device with a first file system installed, and the file backup method includes:
获取待备份文件的文件类型,并根据所述第一文件***的元数据区中元数据包含的类型标识,从所述第一文件***的元数据区中,筛选出所述文件类型对应的目标元数据;Obtain the file type of the file to be backed up, and filter out the target corresponding to the file type from the metadata area of the first file system according to the type identifier contained in the metadata in the metadata area of the first file system Metadata
从所述第一文件***的文件数据区中,筛选出所述目标元数据对应的目标文件数据块;Filtering out target file data blocks corresponding to the target metadata from the file data area of the first file system;
将所述目标元数据和所述目标文件数据块发送至安装有第二文件***的第二终端设备,以指示所述第二终端设备将所述目标元数据恢复至第二文件***的元数据区,以及将所述目标文件数据块恢复至所述第二文件***的文件数据区。Send the target metadata and the target file data block to a second terminal device installed with a second file system to instruct the second terminal device to restore the target metadata to the metadata of the second file system Area, and restore the target file data block to the file data area of the second file system.
由于文件***中文件是以文件数据块的形式进行存储的,同时单个元数据可以同时索引一个或多个文件数据块,因此在进行文件备份时,根据元数据的顺序以及元数据索引文件数据块的顺序,可以实现对文件数据块的批量顺序读取,在文件***数据碎片化严重的情况下,相比需要进行大量的随机数据块读取的基于目录结构文件备份而言,本申请实施例可以节约大量的文件数据块读取时间,文件备份效率得到极大的提升,同时,可以实现跨设备的文件备份。Because the files in the file system are stored in the form of file data blocks, and a single metadata can index one or more file data blocks at the same time, so when the file is backed up, the file data blocks are indexed according to the order of the metadata and the metadata In the case of serious file system data fragmentation, compared to the file backup based on the directory structure that requires a large number of random data block readings, the embodiment of the present application can realize batch sequential reading of file data blocks. It can save a lot of file data block reading time, file backup efficiency is greatly improved, and at the same time, cross-device file backup can be realized.
第四方面,对应于第三方面的文件备份方法,本申请实施例提供了一种文件备份***,包括:第一终端设备和第二终端设备,所述第一终端设备中安装有第一文件***,所述第二终端设备中安装有第二文件***;In a fourth aspect, corresponding to the file backup method of the third aspect, an embodiment of the present application provides a file backup system, including: a first terminal device and a second terminal device, the first terminal device is installed with a first file System, a second file system is installed in the second terminal device;
所述第一终端设备用于,获取待备份文件的文件类型,并根据所述第一文件***的元数据区中元数据包含的类型标识,从所述第一文件***的元数据区中,筛选出所述文件类型对应的目标元数据;The first terminal device is configured to obtain the file type of the file to be backed up, and from the metadata area of the first file system according to the type identifier included in the metadata in the metadata area of the first file system, Filter out the target metadata corresponding to the file type;
所述第一终端设备还用于,从所述第一文件***的文件数据区中,筛选出所述目标元数据对应的目标文件数据块;The first terminal device is further configured to filter out target file data blocks corresponding to the target metadata from the file data area of the first file system;
所述第一终端设备还用于,将所述目标元数据和所述目标文件数据块发送至所述第二终端设备;The first terminal device is further configured to send the target metadata and the target file data block to the second terminal device;
所述第二终端设备用于,将所述目标元数据恢复至所述第二文件***的元数据区,以及将所述目标文件数据块恢复至所述第二文件***的文件数据区。The second terminal device is configured to restore the target metadata to the metadata area of the second file system, and restore the target file data block to the file data area of the second file system.
第五方面,本申请实施例提供了一种文件备份方法,应用于安装有第一文件***的第一终端设备,所述文件备份方法包括:In a fifth aspect, an embodiment of the present application provides a file backup method, which is applied to a first terminal device with a first file system installed, and the file backup method includes:
获取待备份文件的文件类型,并根据所述第一文件***的元数据区中元数据包含的类型标识, 从所述第一文件***的元数据区中,筛选出所述文件类型对应的目标元数据;Obtain the file type of the file to be backed up, and filter out the target corresponding to the file type from the metadata area of the first file system according to the type identifier contained in the metadata in the metadata area of the first file system Metadata
从所述第一文件***的文件数据区中,筛选出所述目标元数据对应的目标文件数据块;Filtering out target file data blocks corresponding to the target metadata from the file data area of the first file system;
将所述目标元数据和所述目标文件数据块发送至存储设备,以指示所述存储设备,对所述目标元数据和所述目标文件数据块进行存储,并将所述目标元数据和所述目标文件数据块发送至安装有第二文件***的第二终端设备,通过所述第二终端设备将所述目标元数据恢复至第二文件***的元数据区,以及将所述目标文件数据块恢复至所述第二文件***的文件数据区。Send the target metadata and the target file data block to a storage device to instruct the storage device to store the target metadata and the target file data block, and combine the target metadata and the target file data block. The target file data block is sent to a second terminal device installed with a second file system, the target metadata is restored to the metadata area of the second file system through the second terminal device, and the target file data The block is restored to the file data area of the second file system.
由于文件***中文件是以文件数据块的形式进行存储的,同时单个元数据可以同时索引一个或多个文件数据块,因此在进行文件备份时,根据元数据的顺序以及元数据索引文件数据块的顺序,可以实现对文件数据块的批量顺序读取,在文件***数据碎片化严重的情况下,相比需要进行大量的随机数据块读取的基于目录结构文件备份而言,本申请实施例可以节约大量的文件数据块读取时间,文件备份效率得到极大的提升。同时,通过在两个终端设备之间设置一个存储设备,由该存储设备对目标元数据和目标文件数据块进行转存,一方面,使得即使文件备份过程出现了数据丢失等错误,也可以及时从存储设备中恢复,进而提高了目标元数据和目标文件数据块的安全性和可靠性,另一方面,对于由于物理空间距离过远和硬件配置不支持同种设备直连等原因,无法实现终端设备之间直连操作的情况,本申请实施例也可以很好地进行终端设备之间的文件备份。Because the files in the file system are stored in the form of file data blocks, and a single metadata can index one or more file data blocks at the same time, so when the file is backed up, the file data blocks are indexed according to the order of the metadata and the metadata In the case of serious file system data fragmentation, compared to the file backup based on the directory structure that requires a large number of random data block readings, the embodiment of the present application can realize batch sequential reading of file data blocks. Can save a lot of file data block reading time, file backup efficiency is greatly improved. At the same time, by setting up a storage device between the two terminal devices, the storage device dumps the target metadata and target file data blocks. On the one hand, even if errors such as data loss occur in the file backup process, it can be timely Recovering from the storage device improves the security and reliability of the target metadata and target file data blocks. On the other hand, it cannot be achieved due to the long physical distance and the hardware configuration that does not support direct connection of the same device. In the case of direct connection operations between terminal devices, the embodiment of the present application can also perform file backup between terminal devices well.
第六方面,对应于第五方面的文件备份方法,本申请实施例提供了一种文件备份***,包括:第一终端设备、第二终端设备和存储设备,所述第一终端设备中安装有第一文件***,所述第二终端设备中安装有第二文件***;According to a sixth aspect, corresponding to the file backup method of the fifth aspect, an embodiment of the present application provides a file backup system, including: a first terminal device, a second terminal device, and a storage device. The first terminal device is installed with A first file system, a second file system is installed in the second terminal device;
所述第一终端设备用于,获取待备份文件的文件类型,并根据所述第一文件***的元数据区中元数据包含的类型标识,从所述第一文件***的元数据区中,筛选出所述文件类型对应的目标元数据;The first terminal device is configured to obtain the file type of the file to be backed up, and from the metadata area of the first file system according to the type identifier included in the metadata in the metadata area of the first file system, Filter out the target metadata corresponding to the file type;
所述第一终端设备还用于,从所述第一文件***的文件数据区中,筛选出所述目标元数据对应的目标文件数据块;The first terminal device is further configured to filter out target file data blocks corresponding to the target metadata from the file data area of the first file system;
所述第一终端设备还用于,将所述目标元数据和所述目标文件数据块发送至所述存储设备;The first terminal device is further configured to send the target metadata and the target file data block to the storage device;
所述存储设备用于,对所述目标元数据和所述目标文件数据块进行存储,并将所述目标元数据和所述目标文件数据块发送至所述第二终端设备;The storage device is configured to store the target metadata and the target file data block, and send the target metadata and the target file data block to the second terminal device;
所述第二终端设备用于,将所述目标元数据恢复至第二文件***的元数据区,以及将所述目标文件数据块恢复至所述第二文件***的文件数据区。The second terminal device is configured to restore the target metadata to the metadata area of the second file system, and restore the target file data block to the file data area of the second file system.
第七方面,本申请实施例提供了一种文件备份方法,应用于安装有第一文件***的第一终端设备,包括:In a seventh aspect, an embodiment of the present application provides a file backup method, which is applied to a first terminal device with a first file system installed, and includes:
获取待备份文件的文件类型,并根据所述第一文件***的元数据区中元数据包含的类型标识,从所述第一文件***的元数据区中,筛选出所述文件类型对应的目标元数据;Obtain the file type of the file to be backed up, and filter out the target corresponding to the file type from the metadata area of the first file system according to the type identifier contained in the metadata in the metadata area of the first file system Metadata
从所述第一文件***的文件数据区中,筛选出所述目标元数据对应的目标文件数据块;Filtering out target file data blocks corresponding to the target metadata from the file data area of the first file system;
将所述目标元数据和所述目标文件数据块发送至存储设备,以指示所述存储设备对所述目标元数据和所述目标文件数据块进行存储,并将所述目标元数据恢复至第二文件***的元数据区,以及将所述目标文件数据块恢复至所述第二文件***的文件数据区,所述第二文件***安装于第二终端设备。Send the target metadata and the target file data block to a storage device to instruct the storage device to store the target metadata and the target file data block, and restore the target metadata to the first Two metadata areas of the file system, and the file data area of the second file system that restores the target file data block to the second file system, and the second file system is installed in a second terminal device.
由于文件***中文件是以文件数据块的形式进行存储的,同时单个元数据可以同时索引一个 或多个文件数据块,因此在进行文件备份时,根据元数据的顺序以及元数据索引文件数据块的顺序,可以实现对文件数据块的批量顺序读取,在文件***数据碎片化严重的情况下,相比需要进行大量的随机数据块读取的基于目录结构文件备份而言,本申请实施例可以节约大量的文件数据块读取时间,文件备份效率得到极大的提升。同时,通过在两个终端设备之间设置一个存储设备,由该存储设备对目标元数据和目标文件数据块进行转存,一方面,使得即使文件备份过程出现了数据丢失等错误,也可以及时从存储设备中恢复,进而提高了目标元数据和目标文件数据块的安全性和可靠性,另一方面,对于由于物理空间距离过远和硬件配置不支持同种设备直连等原因,无法实现终端设备之间直连操作的情况,本申请实施例也可以很好地进行终端设备之间的文件备份。另外,本申请实施例还可以适应一些数据处理能力较弱的第二终端设备情况,实现快速安全的文件备份。Because the files in the file system are stored in the form of file data blocks, and a single metadata can index one or more file data blocks at the same time, so when the file is backed up, the file data blocks are indexed according to the order of the metadata and the metadata In the case of serious file system data fragmentation, compared to the file backup based on the directory structure that requires a large number of random data block readings, the embodiment of the present application can realize batch sequential reading of file data blocks. Can save a lot of file data block reading time, file backup efficiency is greatly improved. At the same time, by setting up a storage device between the two terminal devices, the storage device dumps the target metadata and target file data blocks. On the one hand, even if errors such as data loss occur in the file backup process, it can be timely Recovering from the storage device improves the security and reliability of the target metadata and target file data blocks. On the other hand, it cannot be achieved due to the long physical distance and the hardware configuration that does not support direct connection of the same device. In the case of direct connection operations between terminal devices, the embodiment of the present application can also perform file backup between terminal devices well. In addition, the embodiments of the present application can also be adapted to the situation of some second terminal devices with weak data processing capabilities, so as to realize fast and safe file backup.
第八方面,对应于第七方面的文件备份方法,本申请实施例提供了一种文件备份***,包括:第一终端设备、第二终端设备和存储设备,所述第一终端设备中安装有第一文件***,所述第二终端设备中安装有第二文件***;According to an eighth aspect, corresponding to the file backup method of the seventh aspect, an embodiment of the present application provides a file backup system, including: a first terminal device, a second terminal device, and a storage device. The first terminal device is installed with A first file system, a second file system is installed in the second terminal device;
所述第一终端设备用于,获取待备份文件的文件类型,并根据所述第一文件***的元数据区中元数据包含的类型标识,从所述第一文件***的元数据区中,筛选出所述文件类型对应的目标元数据;The first terminal device is configured to obtain the file type of the file to be backed up, and from the metadata area of the first file system according to the type identifier included in the metadata in the metadata area of the first file system, Filter out the target metadata corresponding to the file type;
所述第一终端设备还用于,从所述第一文件***的文件数据区中,筛选出所述目标元数据对应的目标文件数据块;The first terminal device is further configured to filter out target file data blocks corresponding to the target metadata from the file data area of the first file system;
所述第一终端设备还用于,将所述目标元数据和所述目标文件数据块发送至所述存储设备;The first terminal device is further configured to send the target metadata and the target file data block to the storage device;
所述存储设备用于,对所述目标元数据和所述目标文件数据块进行存储,并将所述目标元数据恢复至第二文件***的元数据区,以及将所述目标文件数据块恢复至所述第二文件***的文件数据区。The storage device is configured to store the target metadata and the target file data block, restore the target metadata to the metadata area of the second file system, and restore the target file data block To the file data area of the second file system.
第九方面,本申请实施例提供了一种终端设备,所述终端设备包括存储器、处理器,所述存储器上存储有可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现如上述第一方面中任一项所述文件备份方法的步骤。In a ninth aspect, an embodiment of the present application provides a terminal device. The terminal device includes a memory and a processor. The memory stores a computer program that can run on the processor, and the processor executes the The computer program implements the steps of the file backup method described in any one of the above-mentioned first aspects.
第十方面,本申请实施例提供了一种计算机可读存储介质,包括:存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如上述第一方面中任一项所述文件备份方法的步骤。In a tenth aspect, an embodiment of the present application provides a computer-readable storage medium, including: a computer program stored thereon, wherein the computer program is executed by a processor to implement any one of the above-mentioned aspects of the first aspect. Steps of file backup method.
第十一方面,本申请实施例提供了一种计算机程序产品,当计算机程序产品在终端设备上运行时,使得终端设备执行上述第一方面中任一项所述的文件备份方法的步骤。In an eleventh aspect, an embodiment of the present application provides a computer program product that, when the computer program product runs on a terminal device, causes the terminal device to execute the steps of the file backup method described in any one of the above-mentioned first aspects.
可以理解的是,上述第二方面以及第九方面至第十一方面的有益效果可以参见上述第一方面中的相关描述,在此不再赘述。It can be understood that the beneficial effects of the second aspect and the ninth to the eleventh aspects can be referred to the related description in the first aspect, which is not repeated here.
附图说明Description of the drawings
图1是本申请实施例一提供的文件备份方法的流程示意图;FIG. 1 is a schematic flowchart of a file backup method provided in Embodiment 1 of the present application;
图2A是本申请实施例二提供的应用场景示意图;FIG. 2A is a schematic diagram of an application scenario provided by Embodiment 2 of the present application;
图2B是本申请实施例二提供的另一应用场景示意图;2B is a schematic diagram of another application scenario provided by Embodiment 2 of the present application;
图3是本申请实施例四提供的文件备份方法的流程示意图;3 is a schematic flowchart of a file backup method provided by Embodiment 4 of the present application;
图4A是本申请实施例五提供的应用场景示意图;4A is a schematic diagram of an application scenario provided by Embodiment 5 of the present application;
图4B是本申请实施例五提供的另一应用场景示意图;4B is a schematic diagram of another application scenario provided by Embodiment 5 of the present application;
图5是本申请实施例六提供的另一文件备份方法的流程示意图;5 is a schematic flowchart of another file backup method provided by Embodiment 6 of the present application;
图6是本申请实施例七提供的文件备份***的***交互示意图;6 is a schematic diagram of system interaction of the file backup system provided in the seventh embodiment of the present application;
图7是本申请实施例八提供的另一文件备份方法的流程示意图;FIG. 7 is a schematic flowchart of another file backup method provided in Embodiment 8 of the present application;
图8是本申请实施例九提供的另一文件备份***的***交互示意图;FIG. 8 is a schematic diagram of system interaction of another file backup system provided in the ninth embodiment of the present application;
图9是本申请实施例十提供的另一文件备份方法的流程示意图;FIG. 9 is a schematic flowchart of another file backup method provided in the tenth embodiment of the present application;
图10是本申请实施例十一提供的另一文件备份***的***交互示意图;10 is a schematic diagram of system interaction of another file backup system provided in the eleventh embodiment of the present application;
图11是本申请实施例十二提供的文件备份装置的结构示意图;FIG. 11 is a schematic structural diagram of a file backup device provided in Embodiment 12 of the present application;
图12是本申请实施例十三提供的终端设备的结构示意图。FIG. 12 is a schematic structural diagram of a terminal device provided by Embodiment 13 of the present application.
具体实施方式Detailed ways
以下描述中,为了说明而不是为了限定,提出了诸如特定***结构、技术之类的具体细节,以便透彻理解本申请实施例。然而,本领域的技术人员应当清楚,在没有这些具体细节的其它实施例中也可以实现本申请。在其它情况中,省略对众所周知的***、装置、电路以及方法的详细说明,以免不必要的细节妨碍本申请的描述。In the following description, for the purpose of illustration rather than limitation, specific details such as a specific system structure and technology are proposed for a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application can also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid unnecessary details from obstructing the description of this application.
应当理解,当在本申请说明书和所附权利要求书中使用时,术语“包括”指示所描述特征、整体、步骤、操作、元素和/或组件的存在,但并不排除一个或多个其它特征、整体、步骤、操作、元素、组件和/或其集合的存在或添加。It should be understood that when used in the specification and appended claims of this application, the term "comprising" indicates the existence of the described features, wholes, steps, operations, elements and/or components, but does not exclude one or more other The existence or addition of features, wholes, steps, operations, elements, components, and/or collections thereof.
还应当理解,在本申请说明书和所附权利要求书中使用的术语“和/或”是指相关联列出的项中的一个或多个的任何组合以及所有可能组合,并且包括这些组合。It should also be understood that the term "and/or" used in the specification and appended claims of this application refers to any combination of one or more of the associated listed items and all possible combinations, and includes these combinations.
如在本申请说明书和所附权利要求书中所使用的那样,术语“如果”可以依据上下文被解释为“当...时”或“一旦”或“响应于确定”或“响应于检测到”。类似地,短语“如果确定”或“如果检测到[所描述条件或事件]”可以依据上下文被解释为意指“一旦确定”或“响应于确定”或“一旦检测到[所描述条件或事件]”或“响应于检测到[所描述条件或事件]”。As used in the description of this application and the appended claims, the term "if" can be construed as "when" or "once" or "in response to determination" or "in response to detecting ". Similarly, the phrase "if determined" or "if detected [described condition or event]" can be interpreted as meaning "once determined" or "in response to determination" or "once detected [described condition or event]" depending on the context ]" or "in response to detection of [condition or event described]".
另外,在本申请说明书和所附权利要求书的描述中,术语“第一”、“第二”、“第三”等仅用于区分描述,而不能理解为指示或暗示相对重要性。还应理解的是,虽然术语“第一”、“第二”等在文本中在一些本申请实施例中用来描述各种元素,但是这些元素不应该受到这些术语的限制。这些术语只是用来将一个元素与另一元素区分开。例如,第一文件***可以被命名为第二文件***,并且类似地,第二文件***可以被命名为第一文件***,而不背离各种所描述的实施例的范围。第一文件***和第二文件***都是文件***,但是它们不是同一文件***。In addition, in the description of the specification of this application and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the description, and cannot be understood as indicating or implying relative importance. It should also be understood that although the terms “first”, “second”, etc. are used in the text in some embodiments of the present application to describe various elements, these elements should not be limited by these terms. These terms are only used to distinguish one element from another. For example, the first file system may be named the second file system, and similarly, the second file system may be named the first file system without departing from the scope of the various described embodiments. The first file system and the second file system are both file systems, but they are not the same file system.
在本申请说明书中描述的参考“一个实施例”或“一些实施例”等意味着在本申请的一个或多个实施例中包括结合该实施例描述的特定特征、结构或特点。由此,在本说明书中的不同之处出现的语句“在一个实施例中”、“在一些实施例中”、“在其他一些实施例中”、“在另外一些实施例中”等不是必然都参考相同的实施例,而是意味着“一个或多个但不是所有的实施例”,除非是以其他方式另外特别强调。术语“包括”、“包含”、“具有”及它们的变形都意味着“包括但不限于”,除非是以其他方式另外特别强调。The reference to "one embodiment" or "some embodiments" described in the specification of this application means that one or more embodiments of this application include a specific feature, structure, or characteristic described in combination with the embodiment. Therefore, the sentences "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. appearing in different places in this specification are not necessarily All refer to the same embodiment, but mean "one or more but not all embodiments" unless it is specifically emphasized otherwise. The terms "including", "including", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized.
为了便于理解本申请,此处先对本申请实施例进行简要说明:In order to facilitate the understanding of this application, here is a brief description of the embodiments of this application:
文件***,是操作***中负责管理和存储文件信息的软件机构,是对文件存储设备的空间进行组织和分配,负责文件存储并对存入的文件进行保护和检索的***,文件***由三部分组成:与文件管理有关软件、被管理文件以及实施文件管理所需数据结构。文件***内有元数据区和文件数据区,其中,文件数据区是负责对文件进行存储的区域,且在文件数据区中文件是以文件数据块的形式进行存储。元数据区是支持文件***架构的区域,用于存储文件的索引、有效性、健 壮性保护等元数据,以及文件***本身的属性数据。The file system is the software organization responsible for managing and storing file information in the operating system. It organizes and allocates the space of file storage devices, is responsible for file storage, and protects and retrieves stored files. The file system consists of three parts. Composition: software related to file management, managed files, and data structure required for file management. The file system has a metadata area and a file data area. The file data area is an area responsible for storing files, and the file is stored in the form of file data blocks in the file data area. The metadata area is an area that supports the file system architecture and is used to store metadata such as file index, validity, and robustness protection, as well as attribute data of the file system itself.
在进行文件***的数据清除时,有时可能需要保留原文件***中的一些文件,例如一些设备***运行时所必须的部分资源和应用安装包等文件、在利用全覆盖更新的方式对设备***软件进行更新时的更新文件,以及用户使用时产生的一些可用于作为设备凭证的一次性数据文件,对于这些文件,即使对文件***进行格式化等数据清除操作,也是希望在数据清除操作后保证文件不丢失。为了保留这些文件,相关技术往往都是先将原文件***中需要保留的文件按照目录结构逐条拷贝出来,再将文件按照目录结构逐条写入目标文件***,但实际情况中文件***往往存在较为严重的数据碎片化情况,当按照目录结构的文件夹顺序来进行文件备份时,由于同一文件夹下的文件可能会分散储存在各处,甚至同一文件也可能被拆分储存至各处,从而导致备份的过程会有大量的随机寻址读存数据的操作,进而导致整个备份的过程耗时极长,效率低下。When clearing the data of the file system, it may sometimes be necessary to retain some files in the original file system, such as some resources and application installation packages necessary for the operation of the device system, and use the full coverage update method to update the device system software. Update files when updating, and some one-time data files that can be used as device credentials when users use them. For these files, even if the file system is formatted and other data clear operations, it is hoped that the files will be guaranteed after the data clear operation Not lost. In order to retain these files, related technologies usually copy the files that need to be retained in the original file system one by one according to the directory structure, and then write the files into the target file system one by one according to the directory structure. However, in actual situations, the file system is often more serious. Data fragmentation. When the file backup is performed in the folder order of the directory structure, the files in the same folder may be scattered and stored in various places, and even the same file may be split and stored in various places, resulting in During the backup process, there will be a large number of random addressing and reading and storing data operations, which in turn causes the entire backup process to be extremely time-consuming and inefficient.
为了提高文件备份的效率,本申请实施例会预先在元数据中标识各个文件的文件类型,在需要进行文件备份时,根据待备份文件的文件类型来选取出待备份文件的元数据,并根据元数据来确定出待备份文件对应的各个文件数据块,最后对选取出的元数据和文件数据块进行目标文件***的备份,从而完成了对待备份文件的备份。由于文件***中文件是以文件数据块的形式进行存储的,同时单个元数据可以同时索引一个或多个文件数据块,因此在进行文件备份时,根据元数据的顺序以及元数据索引文件数据块的顺序,可以实现对文件数据块的批量顺序读取,在文件***数据碎片化严重的情况下,相比需要进行大量的随机数据块读取的基于目录结构文件备份而言,本申请实施例可以节约大量的文件数据块读取时间,文件备份的效率大大提升。其中,对文件类型确定的方法此处不予限定,可由技术人员根据实际情况设定,例如在一些实施例中,可以由技术人员预先提供可选择的文件类型选项并存储至终端设备之中,由终端设备在用户进行文件存储或文件类型修改时,对可选择的文件类型选项进行显示,以供用户进行选取设置,在另一些实施例中,也可以由技术人员预先设置好各个文件对应的文件类型,此时终端设备只需要根据设置好的文件类型数据来对文件进行分类标识即可。In order to improve the efficiency of file backup, this embodiment of the application will pre-identify the file type of each file in the metadata. When file backup is required, the metadata of the file to be backed up is selected according to the file type of the file to be backed up, and the metadata is selected according to the metadata. The data is used to determine each file data block corresponding to the file to be backed up, and finally the selected metadata and file data block are backed up to the target file system, thereby completing the backup of the file to be backed up. Because the files in the file system are stored in the form of file data blocks, and a single metadata can index one or more file data blocks at the same time, so when the file is backed up, the file data blocks are indexed according to the order of the metadata and the metadata In the case of serious file system data fragmentation, compared to the file backup based on the directory structure that requires a large number of random data block readings, the embodiment of the present application can realize batch sequential reading of file data blocks. It can save a lot of file data block reading time, and the efficiency of file backup is greatly improved. The method for determining the file type is not limited here, and can be set by the technician according to the actual situation. For example, in some embodiments, the technician can provide selectable file type options in advance and store them in the terminal device. When the user performs file storage or file type modification, the terminal device displays the selectable file type options for the user to select and set. In other embodiments, the technical staff can also set the corresponding file type in advance. File type. At this time, the terminal device only needs to classify and identify the file according to the set file type data.
同时,对本申请实施例中涉及到的一些名词进行解释如下:At the same time, some terms involved in the embodiments of this application are explained as follows:
第一文件***和第二文件***,其中,第一文件***是指需要进行文件保留的原文件***,以下简称原***,第二文件***是指文件目标存储的文件***,以下简称目标***,本申请实施例中的文件备份,即是指将待备份文件对应的目标元数据和目标文件数据块从原***备份到目标***中,同时应当理解地,在不同的实际应用场景之中,原***和目标***既可以是同一个***,也可以是不同的两个***,当为同一个***时,目标***即为经过数据清除之后的原***。The first file system and the second file system, where the first file system refers to the original file system that requires file retention, hereinafter referred to as the original system, and the second file system refers to the file system where the file target is stored, hereinafter referred to as the target system, The file backup in the embodiments of this application refers to backing up the target metadata and target file data blocks corresponding to the file to be backed up from the original system to the target system. At the same time, it should be understood that in different actual application scenarios, the original The system and the target system can be the same system or two different systems. When they are the same system, the target system is the original system after data clearing.
类型标识,用于标识文件类型的数据,在本申请实施例中,会预先在文件对应的元数据中选取或增加一个字段专门用于记录文件的类型标识,并会在每次新增文件和修改文件类型时,根据实际文件的文件类型来设置或更新文件元数据中的类型标识。其中,本申请实施例不对文件类型的划分规则以及对应类型标识的数据内容进行限定,可由技术人员根据实际需求进行设定,例如在一些实施例中,可以以不同等级的方式来设定文件需备份的重要等级,此时每个文件对应的文件类型就是一个具体的等级,如第一级、第二级和第三级,而类型标识就是一个具体的等级标识,如可以设置为:第一级对应的类型标识为A,第二级对应的类型标识为B,第三级对应的类型标识为C,而在另一些实施例之中,也可以根据不同应用场景之下对文件备份的实际需求,来对文件进行分类并设置对应的类型标识,例如对应于a场景、b场景和c场景,将三个场景之下需备份的文件分别划分为第一类、第二类和第三类文件,此时对应的类型标识就是一个具体的分类标 识,如可以设置为:第一类对应的类型标识为数字1,第二类对应的类型标识为数字2,第三类对应的类型标识为数字3。The type identification is used to identify the data of the file type. In the embodiment of this application, a field will be selected or added in the metadata corresponding to the file in advance to record the type identification of the file, and will be added every time a file and When modifying the file type, the type identification in the file metadata is set or updated according to the file type of the actual file. Among them, the embodiment of this application does not limit the file type classification rules and the data content of the corresponding type identification, which can be set by the technicians according to actual needs. For example, in some embodiments, the file requirements can be set in different levels. The importance level of the backup. At this time, the file type corresponding to each file is a specific level, such as the first level, the second level, and the third level, and the type identifier is a specific level identifier, such as: first The type corresponding to the second level is identified as A, the corresponding type of the second level is identified as B, and the corresponding type of the third level is identified as C. In other embodiments, it can also be based on the actual file backup under different application scenarios. Need to classify files and set corresponding type identifications, for example, corresponding to scene a, scene b, and scene c, and divide the files that need to be backed up under the three scenes into type 1, type 2, and type 3. File, the corresponding type identifier at this time is a specific classification identifier, for example, it can be set as: the type identifier corresponding to the first type is number 1, the type identifier corresponding to the second type is number 2, and the type identifier corresponding to the third type is The number 3.
同时,本申请实施例中,文件备份方法的执行主体为具有一定数据处理功能和数据存储功能的终端设备,其中一定的数据处理功能,是指可以进行本申请实施例中的数据筛选和拷贝等操作。同时,本申请实施例不对终端设备的具体设备类型进行限定,包括但不限于如手机、平板电脑、可穿戴设备、车载设备、增强现实(augmented reality,AR)/虚拟现实(virtual reality,VR)设备、笔记本电脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本、个人数字助理(personal digital assistant,PDA)等终端设备。At the same time, in the embodiments of this application, the execution subject of the file backup method is a terminal device with certain data processing functions and data storage functions. The certain data processing functions mean that the data filtering and copying in the embodiments of this application can be performed. operating. At the same time, the embodiments of this application do not limit the specific device types of terminal devices, including but not limited to mobile phones, tablet computers, wearable devices, in-vehicle devices, augmented reality (AR)/virtual reality (VR) Devices, laptops, ultra-mobile personal computers (UMPC), netbooks, personal digital assistants (personal digital assistants, PDAs) and other terminal devices.
为了说明本申请的技术方案,下面通过具体实施例来进行说明。In order to illustrate the technical solution of the present application, specific embodiments are used for description below.
实施例一:Example one:
图1示出了本申请实施例一提供的文件备份方法的实现流程图,详述如下:Fig. 1 shows the implementation flow chart of the file backup method provided in the first embodiment of the present application, and the details are as follows:
S101,获取待备份文件的文件类型,并根据第一文件***的元数据区中元数据包含的类型标识,从第一文件***的元数据区中,筛选出文件类型对应的目标元数据。S101: Obtain the file type of the file to be backed up, and filter out target metadata corresponding to the file type from the metadata area of the first file system according to the type identifier contained in the metadata in the metadata area of the first file system.
由上述说明可知,本申请实施例会预先设置好对文件类型的划分规则以及每种文件类型对应的类型标识,并会在每次文件存储和文件类型修改时,根据文件实际类型进行元数据中类型标识的设置或更新,因此在进行文件备份时,只需要获取待备份文件的文件类型,并根据文件类型对应的类型标识对第一文件***元数据区内的元数据进行标识匹配,即可实现对待备份文件对应的元数据的快速定位。其中,对待备份文件的文件类型的获取方式此处不予限定,根据实际场景需求的不同,获取的方法也可以存在一定的差异,例如可以在终端设备中进行可选取文件类型的显示,由用户自行在终端设备中进行选取操作,再根据用户的操作确定出具体待备份文件的文件类型,亦可以由技术人员预先选取好一些默认备份的文件类型,此时直接读取默认的文件类型即可。As can be seen from the above description, this embodiment of the application will pre-set the classification rules for file types and the type identification corresponding to each file type, and will perform the type in the metadata according to the actual type of the file every time the file is stored and the file type is modified. Set or update the identification, therefore, when performing file backup, only need to obtain the file type of the file to be backed up, and identify and match the metadata in the metadata area of the first file system according to the type identification corresponding to the file type. Quickly locate the metadata corresponding to the file to be backed up. Among them, the method of obtaining the file type of the file to be backed up is not limited here. Depending on the actual scenario requirements, the method of obtaining may also have certain differences. For example, the display of selectable file types can be displayed in the terminal device, and the user Perform the selection operation in the terminal device by yourself, and then determine the specific file type of the file to be backed up according to the user's operation. The technician can also select some default file types for backup in advance, and then directly read the default file type. .
同时应当说明地,由于不同应用场景之下所需备份的文件数量可能有所差异,使得对应待备份的文件类型数量也可能存在差异,即本申请实施例中待备份的文件类型既可以仅包含一种文件类型,也可以同时包含多种文件类型,本申请实施例不对具体待备份的文件类型数进行限定,可由技术人员根据实际应用场景选取或设定。以一实例对S101进行说明,假设将文件类型划分为第一类、第二类、第三类文件和第四类,且设置第一类对应的类型标识为数字1,第二类对应的类型标识为数字2,第三类对应的类型标识为数字3,第四类对应的类型标识为数字4,同时,在预先设置好各个文件元数据对应的类型标识的基础上,假设需要备份第二类和第四类的文件,此时本申请实施例会对第一文件***元数据区中的各个元数据分别进行类型标识的匹配,筛选出类型标识为2或4的所有元数据,从而到所有包含类型标识为2或4的目标元数据。At the same time, it should be noted that the number of files that need to be backed up under different application scenarios may be different, so that the number of file types to be backed up may also be different. That is, the file types to be backed up in the embodiment of this application may include only One file type may also contain multiple file types at the same time. The embodiment of this application does not limit the number of specific file types to be backed up, and can be selected or set by a technician according to actual application scenarios. Take an example to explain S101. Suppose the file types are divided into the first type, the second type, the third type and the fourth type, and the type identification corresponding to the first type is set as the number 1, and the second type corresponds to the type The identification is number 2, the type identification corresponding to the third type is number 3, and the type identification corresponding to the fourth type is number 4. At the same time, based on the type identification corresponding to each file metadata is set in advance, it is assumed that the second type needs to be backed up. Type and Type IV files. At this time, the embodiment of the application will match the type identification of each metadata in the metadata area of the first file system, and filter out all the metadata whose type identification is 2 or 4, so as to get all the metadata in the metadata area of the first file system. Contains target metadata whose type ID is 2 or 4.
S102,从第一文件***的文件数据区中,筛选出目标元数据对应的目标文件数据块。S102: Filter out target file data blocks corresponding to the target metadata from the file data area of the first file system.
应当说明地,由于文件***中文件是以文件数据块的形式进行存储,而单个文件数据块的实际体积往往较小,因此实际应用中,大部分的文件***对于体积较大的文件往往都会被分散存储至多个文件数据块中。同时单个文件对应的元数据也会以一个或多个最小存储单元的形式进行存储,其中根据不同文件***对元数据的存储方式的不同,元数据的最小存储单元包括但不限于如元数据段和元数据块,具体需根据实际文件***确定。因此一个元数据最小存储单元可能同时对应着多个文件数据块。同时由于单个最小存储单元可以索引的文件数据块数量较为有限,因此在文件体积大于单个最小存储单元可索引的文件数据块体积之和时,文件***就会采用多个最小存储单元来对同一个文件对应的文件数据块进行地址索引。因此实际应用中单个文件可能同时对应 着多个元数据最小存储单元,并同时对应着多个文件数据块。在本申请实施例中,将所有待备份文件对应的元数据最小存储单元内的数据统称为目标元数据,同时将所有待备份文件对应的文件数据块统称为目标文件数据块。It should be noted that because files in the file system are stored in the form of file data blocks, and the actual volume of a single file data block is often small, in practical applications, most file systems tend to be used for larger files. Distributed storage to multiple file data blocks. At the same time, the metadata corresponding to a single file will also be stored in the form of one or more minimum storage units. The minimum storage unit of metadata includes, but is not limited to, the metadata section according to the different storage methods of the metadata in different file systems. And metadata block, the specific needs to be determined according to the actual file system. Therefore, a minimum storage unit of metadata may correspond to multiple file data blocks at the same time. At the same time, because the number of file data blocks that can be indexed by a single smallest storage unit is relatively limited, when the file volume is greater than the sum of the file data blocks that can be indexed by a single smallest storage unit, the file system will use multiple smallest storage units to compare the same The file data block corresponding to the file is indexed by the address. Therefore, in practical applications, a single file may simultaneously correspond to multiple minimum metadata storage units and simultaneously correspond to multiple file data blocks. In the embodiments of the present application, the data in the minimum metadata storage unit corresponding to all files to be backed up are collectively referred to as target metadata, and the file data blocks corresponding to all files to be backed up are collectively referred to as target file data blocks.
由于元数据中会记载对应文件数据块的地址索引,因此根据目标元数据中存储的地址索引,即可快速定位出所需备份的目标文件数据块(实际文件数据块定位操作中还可能会涉及到文件数据块之间的地址索引,即根据某一文件数据块内存储的其他文件数据块的存储地址或位置关系,来索引查找出对应的其他文件数据块,因此具体的目标文件数据块查找过程,需根据实际的目标元数据情况以及查找出的目标文件数据块情况决定,此处不予详述)。其中,由上述说明可知,对于单个目标元数据而言,由于其可以同时索引多个目标文件数据块,因此在进行目标文件数据块读取的时候,可以根据目标元数据中的地址索引实现对目标文件数据块的顺序读取。其中,在不同的可选实施方式中,顺序读取可以包括:Since the address index of the corresponding file data block is recorded in the metadata, the target file data block to be backed up can be quickly located according to the address index stored in the target metadata (the actual file data block positioning operation may also involve To the address index between file data blocks, that is, according to the storage address or location relationship of other file data blocks stored in a certain file data block, to index and find the corresponding other file data blocks, so the specific target file data block is searched The process needs to be determined according to the actual target metadata situation and the found target file data block situation, which will not be described in detail here). Among them, it can be seen from the above description that for a single target metadata, since it can index multiple target file data blocks at the same time, when reading the target file data block, it can be matched according to the address index in the target metadata. Sequential reading of data blocks of the target file. Among them, in different optional implementation manners, sequential reading may include:
1、针对元数据内存储着全盘顺序索引的情况,例如F2FS文件***中的段信息表数据,此时得到的地址索引本身就是顺序依靠的,此时顺序读取速度很快,效率极高。1. For the case where the full disk sequential index is stored in the metadata, such as the segment information table data in the F2FS file system, the address index obtained at this time depends on the order itself. At this time, the sequential reading speed is very fast and the efficiency is extremely high.
2、针对元数据内没有存储着全盘顺序索引的情况,此时读取出来的地址索引本身既可能是顺序依靠的,也可能是存在一定间隔的,甚至可能存在顺序错乱。对于顺序依靠的情况,顺序读取的速度很快效率高。对于存在一定间隔的地址索引,由于地址索引属于已知数据,因此可以通过先对地址索引进行排序再依次进行读取的操作,从而使得顺序读取变成了对已有地址索引的依次查找。此时相对现有技术中的地址索引需要大量的随机寻址读存数据而言,读取的速度无疑更快,效率更高。对于顺序错乱的情况,亦可以通过先先对地址索引进行排序使得索引地址的顺序恢复正常,再依次进行读取的操作,使得顺序读取变成了对已有地址索引的依次查找。此时相对现有技术中的地址索引需要大量的随机寻址读存数据而言,读取的速度同样更快,效率更高。2. For the case that the full disk sequential index is not stored in the metadata, the address index read out at this time may be sequence dependent, or there may be a certain interval, and there may even be an order disorder. For the case where the sequence depends on the sequence, the speed of sequential reading is very fast and efficient. For address indexes with a certain interval, since the address indexes belong to known data, the operation of sorting the address indexes and then sequentially reading them can be performed, so that sequential reading becomes a sequential search of existing address indexes. In this case, compared to the address index in the prior art requiring a large amount of random addressing to read and store data, the reading speed is undoubtedly faster and more efficient. In the case of disorder, the order of the index addresses can be restored to normal by first sorting the address indexes, and then read operations sequentially, so that sequential reading becomes a sequential search of existing address indexes. At this time, compared with the address index in the prior art that requires a large amount of random addressing to read and store data, the reading speed is also faster and the efficiency is higher.
同时,对于同一待备份文件的目标元数据而言,若将S102设置为每次遍历多个目标元数据,并对当次遍历的目标元数据对应的目标文件数据块进行读取,此时可以实现对目标元数据的顺序读取,并实现更大范围的目标文件数据块顺序读取。因此相对需要进行大量的随机数据块读取的基于目录结构文件备份而言,本申请实施例可以极大地减少文件数据块寻址操作的耗时,节约大量的文件数据块读取时间,进而提升文件备份的效率。At the same time, for the target metadata of the same file to be backed up, if S102 is set to traverse multiple target metadata each time, and the target file data block corresponding to the target metadata traversed this time is read, then Achieve sequential reading of target metadata and a larger range of sequential reading of target file data blocks. Therefore, compared with a file backup based on a directory structure that requires a large number of random data block readings, the embodiments of the present application can greatly reduce the time consumption of file data block addressing operations, save a large amount of file data block reading time, and further improve The efficiency of file backup.
S103,将目标元数据恢复至第二文件***的元数据区,以及将目标文件数据块恢复至第二文件***的文件数据区。S103: Restore the target metadata to the metadata area of the second file system, and restore the target file data block to the file data area of the second file system.
在筛选出所需备份的目标元数据和目标文件数据块之后,只需将目标元数据和目标文件数据块恢复至目标***的元数据区和文件数据区,即可实现对待备份文件的有效备份。本申请实施例不对具体的目标元数据和目标文件数据块恢复方法进行限定,可由技术人员根据实际需求进行选取或者设定,亦可以参考本申请实施例三的相关说明。After filtering out the target metadata and target file data blocks to be backed up, you only need to restore the target metadata and target file data blocks to the metadata area and file data area of the target system to achieve effective backup of the file to be backed up . The embodiment of the present application does not limit the specific target metadata and target file data block recovery method, which can be selected or set by a technician according to actual needs, or may refer to the relevant description of the third embodiment of the present application.
为了提高文件备份的效率,本申请实施例会预先在元数据中标识各个文件的文件类型,在需要进行文件备份时,根据待备份文件的文件类型来选取出待备份文件的元数据,并根据元数据来确定出待备份文件对应的各个文件数据块,最后对选取出的元数据和文件数据块进行目标文件***的备份,从而完成了对待备份文件的备份。由于文件***中文件是以文件数据块的形式进行存储的,同时单个元数据可以同时索引一个或多个文件数据块,因此在进行文件备份时,根据元数据的顺序以及元数据索引文件数据块的顺序,可以实现对文件数据块的批量顺序读取,在文件***数据碎片化严重的情况下,相比需要进行大量的随机数据块读取的基于目录结构文件备份而言, 本申请实施例可以节约大量的文件数据块读取时间,文件备份的效率大大提升。In order to improve the efficiency of file backup, this embodiment of the application will pre-identify the file type of each file in the metadata. When file backup is required, the metadata of the file to be backed up is selected according to the file type of the file to be backed up, and the metadata is selected according to the metadata. The data is used to determine each file data block corresponding to the file to be backed up, and finally the selected metadata and file data block are backed up to the target file system, thereby completing the backup of the file to be backed up. Because the files in the file system are stored in the form of file data blocks, and a single metadata can index one or more file data blocks at the same time, so when the file is backed up, the file data blocks are indexed according to the order of the metadata and the metadata In the case of serious file system data fragmentation, compared to the file backup based on the directory structure that requires a large number of random data block readings, the embodiment of the present application can realize batch sequential reading of file data blocks. It can save a lot of file data block reading time, and the efficiency of file backup is greatly improved.
实施例二:Embodiment two:
根据实际应用场景的不同,本申请实施例一中的原***和目标***既可以是同一***也可以是不同***,因此在本申请实施例中,S103至少包括两种可能的情况:According to different actual application scenarios, the original system and the target system in the first embodiment of this application can be the same system or different systems. Therefore, in this embodiment of the application, S103 includes at least two possible situations:
1、原***和目标***是同一***。此时,将目标元数据和目标文件数据块恢复至目标***,实际是指将目标元数据和目标文件数据块恢复至数据清除操作完成后的原***。1. The original system and the target system are the same system. At this time, restoring the target metadata and target file data blocks to the target system actually refers to restoring the target metadata and target file data blocks to the original system after the data removal operation is completed.
2、原***和目标***不是同一***。此时,将目标元数据和目标文件数据块恢复至目标***,则是指将目标元数据和目标文件数据块存储至目标***。2. The original system and the target system are not the same system. At this time, restoring the target metadata and target file data blocks to the target system means storing the target metadata and target file data blocks to the target system.
其中,对于情况1而言,由于原***需要进行数据清除,因此在进行S103的恢复操作之前,必须有一个转存的空间进行目标元数据和目标文件数据块存储,因此为了保障原***数据备份的正常进行,作为本申请的一个实施例,对目标元数据和目标文件数据块进行恢复的操作具体包括:Among them, for case 1, because the original system needs to clear data, there must be a dump space for target metadata and target file data block storage before the S103 recovery operation, so in order to ensure the original system data backup As an embodiment of this application, the operation of restoring target metadata and target file data blocks specifically includes:
将所述目标元数据和目标文件数据块拷贝至第一存储空间。Copy the target metadata and the target file data block to the first storage space.
其中,根据实际应用场景的不同,第一存储空间具体情况可以存在一定的差异,例如,第一存储空间可以是作为执行主体的终端设备的内部存储空间,如一些智能手机在设计时就会预留出一部分内存用于进行数据临时存储,此时就可以将这些预留的内存空间作为本申请实施例中的第一存储空间,同时,第一存储空间也可以是终端设备之外的其他存储器件中的存储空间,例如可以在终端设备外接一个如优盘和内存卡之类的存储器件,此时第一存储空间就是指这些存储器件内的存储空间,或者也可以将终端设备与具有存储功能的第三方设备进行连接,并由第三方设备进行目标元数据和目标文件数据的转存,此时第一存储空间就是指第三方设备中的存储空间。Among them, according to different actual application scenarios, the specific situation of the first storage space may have certain differences. For example, the first storage space may be the internal storage space of the terminal device as the execution subject. For example, some smart phones will be pre-designed. A part of the memory is set aside for temporary storage of data. At this time, these reserved memory spaces can be used as the first storage space in the embodiment of the present application. At the same time, the first storage space can also be other storage than the terminal device. The storage space in the software, for example, a storage device such as a USB flash drive and a memory card can be connected to the terminal device. In this case, the first storage space refers to the storage space in these storage devices, or the terminal device can be connected with a storage function. The third-party device is connected to the third-party device, and the third-party device transfers the target metadata and target file data. In this case, the first storage space refers to the storage space in the third-party device.
在所述第一文件***数据清除后,将第一存储空间中的目标元数据拷贝至第二文件***的元数据区,以及将第一存储空间中的目标文件数据块拷贝至第二文件***的文件数据区。After the first file system data is cleared, the target metadata in the first storage space is copied to the metadata area of the second file system, and the target file data block in the first storage space is copied to the second file system The file data area.
在完成对目标元数据和目标文件数据的转存之后,本申请实施例会等待原***的数据清除操作,直至数据清除操作完成之后,才会将目标元数据和目标文件数据重新拷贝至原***的元数据区和文件数据区。其中,数据清除的方式根据实际场景情况而定,此处不予限定,包括但不限于如数据格式化、删除所有数据以及重新安装文件***等。After the transfer of the target metadata and target file data is completed, the embodiment of the present application will wait for the data clearing operation of the original system, and will not copy the target metadata and target file data to the original system until the data clearing operation is completed. Metadata area and file data area. Among them, the way of data clearing depends on the actual situation, which is not limited here, including but not limited to data formatting, deleting all data, and reinstalling the file system.
另一方面,对于情况2而言,此时需要根据原***和目标***是否安装于同一终端设备,来确定是否需要等待原***的数据清除操作,以及具体对应的数据恢复操作:On the other hand, for case 2, at this time, it is necessary to determine whether it is necessary to wait for the data removal operation of the original system and the corresponding data recovery operation according to whether the original system and the target system are installed on the same terminal device:
a、若原***和目标***都是安装于同一终端设备,即对终端设备安装新的文件***。a. If both the original system and the target system are installed on the same terminal device, a new file system is installed on the terminal device.
此时仍需要在进行S103的恢复操作之前有一个转存的空间进行数据存储,且需要在目标***安装完成之后,再对目标元数据和目标文件数据块进行恢复的操作,作为本申请的一个实施例,此时对目标元数据和目标文件数据块进行恢复的操作具体包括:At this time, it is still necessary to have a dump space for data storage before the restoration operation of S103, and it is necessary to restore the target metadata and target file data blocks after the installation of the target system is completed, as a part of this application In the embodiment, the operation of restoring the target metadata and the target file data block at this time specifically includes:
将目标元数据和目标文件数据块拷贝至第一存储空间。Copy the target metadata and the target file data block to the first storage space.
在第二文件***安装完成后,将第一存储空间中的目标元数据拷贝至第二文件***的元数据区,以及将第一存储空间中的目标文件数据块拷贝至第二文件***的文件数据区。After the installation of the second file system is completed, copy the target metadata in the first storage space to the metadata area of the second file system, and copy the target file data blocks in the first storage space to the files in the second file system Data area.
其中,具体的原理可参考情况1对应的实施例说明,此处不予赘述,区别仅在于本申请实施例对应的在第二文件***安装完成后,触发对应的目标元数据和目标文件数据块恢复操作。Among them, the specific principle can be described with reference to the embodiment corresponding to case 1, which will not be repeated here. The difference is only that the corresponding target metadata and target file data block are triggered after the second file system is installed in the embodiment of this application. Recovery operation.
b、若原***和目标***是安装于不同终端设备,即文件备份是指将待备份文件从一个终端设备中备份到另一个终端设备中。b. If the original system and the target system are installed on different terminal devices, file backup refers to backing up the files to be backed up from one terminal device to another terminal device.
以终端设备均为手机为例,假设本申请实施例的执行主体为手机A,安装有目标***的终端 设备为手机B,参考图2A,此时理论上可以直接将目标元数据和目标文件数据块存储至目标***而不进行转存,且由于目标***与原***不在一个终端设备之中,因此无论原***数据清除是否完成,都不会影响对目标元数据和目标文件数据块的恢复,即S103数据恢复的操作无需考虑原***数据清除是否完成,即在一些实施例中,可以在筛选出所需备份的目标元数据和目标文件数据块之后,直接由作为执行主体的终端设备控制,将筛选出来的目标元数据和目标文件数据块恢复至另一台终端设备之中。Taking a mobile phone as an example, the terminal device is assumed to be mobile phone A and the terminal device installed with the target system is mobile phone B. Referring to Figure 2A, the target metadata and target file data can be directly combined in theory. Blocks are stored to the target system without dumping, and because the target system and the original system are not in the same terminal device, no matter whether the original system data is cleared or not, it will not affect the recovery of target metadata and target file data blocks. That is, the operation of S103 data recovery does not need to consider whether the original system data removal is completed. That is, in some embodiments, after the target metadata and target file data blocks that need to be backed up are filtered out, they can be directly controlled by the terminal device as the execution subject. Restore the filtered target metadata and target file data blocks to another terminal device.
实际应用中发现,直接进行跨设备的数据备份可能存在一定的数据丢失风险,不利于数据备份安全性和可靠性,因此在另一些实施例之中,对目标元数据和目标文件数据块进行恢复的操作具体包括:In practical applications, it is found that directly performing cross-device data backup may have a certain risk of data loss, which is not conducive to the security and reliability of data backup. Therefore, in other embodiments, the target metadata and target file data blocks are restored. The specific operations include:
将目标元数据和目标文件数据块拷贝至第一存储空间。Copy the target metadata and the target file data block to the first storage space.
将第一存储空间中的目标元数据拷贝至第二文件***的元数据区,以及将第一存储空间中的目标文件数据块拷贝至第二文件***的文件数据区。Copy the target metadata in the first storage space to the metadata area of the second file system, and copy the target file data block in the first storage space to the file data area of the second file system.
其中,具体的原理与情况1对应的实施例相同,此处不予赘述,但与情况1对应的实施例不同之处在于,本申请实施例无需考虑原***数据清除是否完成,同样以终端设备均为手机为例,假设本申请实施例的执行主体为手机A,安装有目标***的终端设备为手机B,第一存储空间是指存储设备中的存储空间,参考图2B,在将目标元数据和目标文件数据块转存至存储设备之后,即可由作为执行主体的终端设备控制,将存储设备中的目标元数据和目标文件数据块恢复至另一台终端设备之中。Among them, the specific principle is the same as that of the embodiment corresponding to case 1, and will not be repeated here, but the difference of the embodiment corresponding to case 1 is that the embodiment of this application does not need to consider whether the original system data clearing is completed. Take mobile phones as examples. Assume that the execution subject of the embodiments of this application is mobile phone A, and the terminal device installed with the target system is mobile phone B. The first storage space refers to the storage space in the storage device. After the data and target file data blocks are transferred to the storage device, they can be controlled by the terminal device as the execution subject to restore the target metadata and target file data blocks in the storage device to another terminal device.
实施例三:Example three:
在一些安全性要求较高的场景之中,为了保障文件的安全,常常会对文件进行数据块级别的加密存储,此时若按照目录结构的文件夹顺序进行文件备份,就必须先对整个文件数据区进行解密,才能在解密后的数据中找到文件数据块之间和目录路径之间等逻辑关系,从而形成对应的文件或文件夹的相应信息,并进行待备份文件所有文件数据块的查找和备份操作,这样虽然可以实现文件备份,但由于所有文件数据块都被解密,且文件会以未加密的状态暴露,从而使得整个文件备份的过程文件安全性极低。In some scenarios with high security requirements, in order to ensure the security of files, files are often encrypted and stored at the data block level. At this time, if files are backed up in the folder order of the directory structure, the entire file must be backed up first. The data area is decrypted to find the logical relationship between the file data blocks and the directory path in the decrypted data, thereby forming the corresponding information of the corresponding file or folder, and searching for all the file data blocks of the file to be backed up In this way, although file backup can be realized, all file data blocks are decrypted and the file will be exposed in an unencrypted state, which makes the file security of the entire file backup process extremely low.
为了在保障文件备份效率的同时提高文件备份的安全性,考虑到实际应用中文件***的类型有很多种,例如HDFS、NFS、F2FS和HFS+等,对于不同类型的文件***而言,其元数据的种类、存储方式、格式和体积,以及文件数据块的存储方式和体积等都可能会存在一定的差异,因此对于不同类型的两个文件***而言,在进行文件恢复时需要考虑到文件***之间的数据格式转换,以保障写入目标***的数据可以被目标***正常存储和使用,而对于相同类型的文件***而言,在进行文件恢复时虽然不用进行数据格式转换等操作,但由于不同文件***的数据存储情况也有可能会存在一定差异,例如文件***的容量大小的可能存在差异,同时目标***当前的存储情况不一定与原***提取目标元数据和目标文件数据块时的存储情况相同,因此即使是同一类型的文件***在进行文件恢复时,也需要根据实际两个文件***的容量和当前存储情况来制定适宜的恢复方案,以保障写入目标***的数据可以被目标***正常存储和使用,因此在上述本申请实施例一或二的基础上,本申请实施例会根据原***和目标***的***类型、容量以及数据存储情况,来进行文件备份场景的分类,并针对每种场景的特点和需求提供对应安全性较高的目标元数据和目标文件数据块恢复方案,可选的场景分类及对应恢复方案详述如下:In order to improve the security of file backup while ensuring the efficiency of file backup, considering that there are many types of file systems in practical applications, such as HDFS, NFS, F2FS, and HFS+, for different types of file systems, their metadata There may be some differences in the type, storage method, format and volume, as well as the storage method and volume of file data blocks. Therefore, for two file systems of different types, the file system needs to be taken into consideration when recovering files. To ensure that the data written to the target system can be stored and used normally by the target system. For the same type of file system, although there is no need to perform operations such as data format conversion when recovering files, The data storage situation of different file systems may also have certain differences. For example, the capacity of the file system may be different, and the current storage situation of the target system may not be the same as the storage situation when the original system extracts target metadata and target file data blocks. The same, so even when the file system of the same type is performing file recovery, it is necessary to formulate a suitable recovery plan based on the actual capacity of the two file systems and the current storage situation to ensure that the data written to the target system can be normal by the target system Storage and use. Therefore, on the basis of the above-mentioned embodiment 1 or 2 of this application, this embodiment of the application will classify file backup scenarios according to the system type, capacity and data storage situation of the original system and the target system, and each The characteristics and requirements of the scene provide a relatively safe target metadata and target file data block recovery plan. The optional scene classification and corresponding recovery plan are detailed as follows:
场景1:原***和目标***的***类型和容量均相同,且目标***中未存储数据。Scenario 1: The system type and capacity of the original system and the target system are the same, and no data is stored in the target system.
其中,未存储数据是指文件***未被写入数据。当原***和目标***的***类型和容量均相同时,说明原***和目标***对数据的存储方式和最大存储能力相同,此时若目标***中未被写入数据,说明目标***内的元数据区和文件数据区任意位置都可以进行数据存储,理论上此时可以在不进行任何地址映射情况下,直接将目标元数据和目标文件数据块放入目标***之中,实现对目标元数据和目标文件数据块的无地址偏移恢复。在此基础上,作为对场景1的一种可选目标元数据与目标文件数据块的恢复方案A,在S103之前,本申请实施例还包括:Among them, unstored data means that the file system has not written data. When the system type and capacity of the original system and the target system are the same, it means that the original system and the target system have the same data storage method and maximum storage capacity. At this time, if no data is written in the target system, it means that the target system has no data. Data storage can be performed anywhere in the data area and file data area. In theory, the target metadata and target file data block can be directly put into the target system without any address mapping at this time to realize the target metadata And the target file data block has no address offset recovery. On this basis, as an optional target metadata and target file data block recovery scheme A for scenario 1, before S103, the embodiment of the present application further includes:
获取目标元数据在第一文件***中的第一存储地址。获取目标文件数据块在第一文件***中的第二存储地址。Acquire the first storage address of the target metadata in the first file system. Acquire the second storage address of the target file data block in the first file system.
为了将目标元数据和目标文件数据块恢复至目标***,首先需要获知目标元数据和目标文件数据块在原***之中的存储地址,因此本申请实施例在S103进行数据恢复操作之前,还会获取目标元数据在第一文件***的元数据区中的第一储存地址,以及目标文件数据块在第一文件***的文件数据区中的第二存储地址。其中,本申请实施例不对获取第一储存地址和第二存储地址的执行时机进行过多限制,只需保障在S103之前即可,如可以是在S101筛选出目标元数据的同时获取对应的第一储存地址,在S102筛选出目标文件数据块的同时获取对应的第二储存地址,也可以是在S102之后S103之前,获取第一储存地址和第二存储地址。In order to restore the target metadata and target file data block to the target system, it is first necessary to know the storage address of the target metadata and target file data block in the original system. Therefore, in this embodiment of the present application, before the data recovery operation in S103, it also obtains The first storage address of the target metadata in the metadata area of the first file system, and the second storage address of the target file data block in the file data area of the first file system. Among them, the embodiment of the present application does not limit the execution timing of obtaining the first storage address and the second storage address too much. It only needs to ensure that it is before S103. For example, the target metadata can be filtered out in S101 while the corresponding first storage address is obtained. For a storage address, obtain the corresponding second storage address while screening the target file data block in S102, or obtain the first storage address and the second storage address after S102 and before S103.
同时,当本申请实施例与上述本申请实施例二进行结合时,若需要使用第一存储空间进行数据转存,此时需将第一储存地址、第二储存地址、目标元数据和目标文件数据一同存储至第一存储空间。At the same time, when the embodiment of this application is combined with the above-mentioned embodiment 2 of this application, if the first storage space needs to be used for data transfer, the first storage address, the second storage address, the target metadata and the target file need to be transferred. The data is stored in the first storage space together.
将目标元数据与目标文件数据块恢复至目标***的具体操作步骤,包括:The specific steps for restoring target metadata and target file data blocks to the target system include:
若第一文件***与第二文件***的***类型和容量均相同,且第二文件***内未存储数据,按照第一存储地址将目标元数据拷贝至第二文件***的元数据区,并按照第二存储地址将目标文件数据块拷贝至第二文件***的文件数据区。If the system type and capacity of the first file system and the second file system are the same, and no data is stored in the second file system, copy the target metadata to the metadata area of the second file system according to the first storage address, and follow The second storage address copies the target file data block to the file data area of the second file system.
在获取到第一储存地址和第二储存地址的基础上,本申请实施例会直接按照对应的第一存储地址,来将目标元数据一一拷贝到目标***的元数据区之中,同时按照对应的第二储存地址将各个目标文件数据块一一拷贝至目标***文件数据区之中,此时各个目标元数据和目标文件数据块在目标***中的位置与在原***中的位置完全相同,因此无需对元数据和文件数据块中包含的一些数据索引信息进行修改,也可以保证目标元数据和目标文件数据块可以被目标***正常存储和使用。On the basis of obtaining the first storage address and the second storage address, the embodiment of this application will directly copy the target metadata to the metadata area of the target system according to the corresponding first storage address, and at the same time according to the corresponding The second storage address copies each target file data block one by one into the target system file data area. At this time, the location of each target metadata and target file data block in the target system is exactly the same as the location in the original system, so There is no need to modify some data index information contained in the metadata and file data blocks, and it can also ensure that the target metadata and target file data blocks can be stored and used normally by the target system.
在本申请实施例中,当处于场景1时,会根据目标元数据和目标文件数据块在原***中的存储地址,直接拷贝到目标***对应位置,从而实现对目标元数据和目标文件数据在目标***中的无地址偏移恢复,同时,由于本申请实施例对文件数据块的备份无需进行存储地址修改,因此不存在地址映射和文件数据块之间的地址索引信息更新,进而使得即使对文件数据块进行了加密,本申请实施例的文件备份全过程也无需对已加密文件数据块解密操作,避免了对文件数据块以及整体文件的暴露风险,极大地增强了文件备份的安全性。In the embodiment of this application, when it is in scenario 1, the target metadata and the storage address of the target file data block in the original system will be directly copied to the corresponding location of the target system, so as to achieve the target metadata and target file data in the target system. There is no address offset recovery in the system. At the same time, because the embodiment of the application does not need to modify the storage address for the backup of the file data block, there is no address mapping and the address index information update between the file data block, so that even the file data block is updated. The data blocks are encrypted, and there is no need to decrypt the encrypted file data blocks in the entire file backup process of the embodiment of the present application, which avoids the risk of exposure to the file data blocks and the entire file, and greatly enhances the security of the file backup.
场景2:原***和目标***的***类型相同,但两者的容量不同,或者目标***中存储有数据,或者两者容量不同且目标***中存储有数据。Scenario 2: The original system and the target system are of the same system type, but the capacities of the two are different, or the target system stores data, or the capacities of the two are different and the target system stores data.
其中,存储有数据是指文件***已被写入数据。原***和目标***的***类型相同说明两者对数据存储的方式相同,无需进行数据格式转换,但当两者容量不同时,说明元数据与文件数据块之间地址索引和目录路径关键等,会因为容量变化而发生一定的偏移,进而使得这些信息在目 标***中无法直接使用,而当目标***中存储有数据时,说明目标***中第一存储地址和第二存储地址对应的位置处可能会有数据存储,无法直接进行对应位置的数据拷贝,因此,在原***和目标***容量不一致和目标***中已被写入数据这两种情况中的任意一种或两种发生时,都说明此时无法直接进行目标元数据和目标文件数据的拷贝,必须要有一个地址转换的操作,以保证数据在目标***中正常存储和使用。在此基础上,作为对场景2的一种可选目标元数据与目标文件数据块的恢复方案B,在S103之前,本申请实施例还包括:Among them, stored data means that the file system has written data. The system types of the original system and the target system are the same, which means that the two methods of data storage are the same, and there is no need to perform data format conversion. However, when the capacities of the two are different, it means that the address index and directory path between metadata and file data blocks are critical, etc. A certain offset will occur due to changes in capacity, which will make this information unavailable for direct use in the target system. When data is stored in the target system, it indicates that the target system corresponds to the first storage address and the second storage address. There may be data storage, and it is impossible to directly copy the data at the corresponding location. Therefore, when either or both of the capacity of the original system and the target system are inconsistent and the data has been written in the target system, it will be explained At this time, it is not possible to directly copy the target metadata and target file data, and an address conversion operation is necessary to ensure the normal storage and use of the data in the target system. On this basis, as an optional target metadata and target file data block recovery solution B for scenario 2, before S103, the embodiment of the present application further includes:
获取目标元数据在第一文件***中的第一存储地址。获取目标文件数据块在第一文件***中的第二存储地址。Acquire the first storage address of the target metadata in the first file system. Acquire the second storage address of the target file data block in the first file system.
此处的原理与恢复方案A相同,具体可参考恢复方案A中的相关说明,此处不予赘述。The principle here is the same as the recovery plan A. For details, please refer to the relevant description in the recovery plan A, which will not be repeated here.
将目标元数据与目标文件数据块恢复至目标***的具体操作步骤,包括:The specific steps for restoring target metadata and target file data blocks to the target system include:
若第一文件***的***类型和第二文件***的***类型相同,且第二文件***和第一文件***的容量不相同,和/或,第二文件***内存储有数据,对第一存储地址进行地址转换得到第三存储地址,并对第二存储地址进行转换得到第四存储地址。If the system type of the first file system and the system type of the second file system are the same, and the capacities of the second file system and the first file system are different, and/or, the second file system stores data, the first storage Address conversion is performed to obtain a third storage address, and the second storage address is converted to obtain a fourth storage address.
在获取到第一储存地址和第二储存地址的基础上,本申请实施例会对第一存储地址进行转换,得到目标元数据在目标***的元数据区中对应的第三储存地址,以及目标文件数据块在目标***的文件数据区中对应的第四储存地址。其中,本申请实施例不对具体使用的地址转换方法进行限定,可由技术人员根据实际需求进行选取或者设定,包括但不限于如使用哈希映射、散列表映射或内存映射的方法进行地址映射转换。On the basis of obtaining the first storage address and the second storage address, the embodiment of the present application converts the first storage address to obtain the third storage address corresponding to the target metadata in the metadata area of the target system, and the target file The data block corresponds to the fourth storage address in the file data area of the target system. Among them, the embodiments of this application do not limit the specific address conversion methods used, and can be selected or set by the technicians according to actual needs, including but not limited to, such as using hash mapping, hash table mapping, or memory mapping to perform address mapping conversion .
按照第三存储地址将目标元数据拷贝至第二文件***的元数据区,并按照第四存储地址将目标文件数据块拷贝至第二文件***的文件数据区。The target metadata is copied to the metadata area of the second file system according to the third storage address, and the target file data block is copied to the file data area of the second file system according to the fourth storage address.
在确定出第三储存地址和第四储存地址之后,本申请实施例会按照对应的第三存储地址,来将目标元数据一一拷贝到目标***的元数据区之中,同时按照对应的第四储存地址将各个目标文件数据块一一拷贝至目标***文件数据区之中,此时由于容量差异和数据存储情况的差异,一般都会导致目标元数据和目标文件数据块产生一定的存储地址偏移,进而实现对目标元数据和目标文件数据块的地址偏移恢复。After the third storage address and the fourth storage address are determined, the embodiment of the present application will copy the target metadata one by one to the metadata area of the target system according to the corresponding third storage address, and at the same time according to the corresponding fourth storage address. The storage address copies each target file data block one by one to the target system file data area. At this time, due to differences in capacity and data storage conditions, the target metadata and target file data blocks will generally cause a certain storage address offset , And then realize the address offset recovery of the target metadata and the target file data block.
在本申请实施例中,当处于场景2时,会根据目标元数据和目标文件数据块在原***中的存储地址进行地址转换得到在目标***中对应的存储地址,并根据转换后的存储地址进行目标元数据和目标文件数据块的拷贝,使得本申请实施例可以实现对数据的有效恢复,保证目标元数据和目标文件数据块可以被目标***正常存储和使用,同时由于本申请实施例是基于文件数据块级别的数据恢复,因此即使文件***中对文件数据块进行了加密,本申请实施例也只要在有需要使用某个文件数据块内的信息时,才对该文件数据块进行解密,既无需对整个文件数据区进行数据解密,更无需还原出待备份文件的文件全貌,避免了对大量文件数据块以及整体文件的暴露风险,使得本申请实施例对文件备份的安全性大大提升。In the embodiment of the present application, when it is in scenario 2, the address conversion is performed according to the storage address of the target metadata and the target file data block in the original system to obtain the corresponding storage address in the target system, and the conversion is performed according to the converted storage address The copy of the target metadata and the target file data block enables the embodiment of this application to achieve effective recovery of data, ensuring that the target metadata and target file data block can be normally stored and used by the target system. At the same time, the embodiment of this application is based on Data recovery at the file data block level. Therefore, even if the file data block is encrypted in the file system, the embodiment of the present application will only decrypt the file data block when it is necessary to use the information in the file data block. There is no need to decrypt data in the entire file data area, and there is no need to restore the entire file view of the file to be backed up. This avoids the risk of exposing a large number of file data blocks and the entire file, so that the security of file backup in the embodiments of the present application is greatly improved.
在恢复方案B的基础上,考虑到实际应用之中,文件数据块之间可能会存在一定的关联,对于存在关联文件数据块的情况,一般会在文件数据块中存储一些相关联的文件数据块的存储地址,例如当单个文件被分散存储为多个文件数据块时,实际应用中元数据中一般仅会记录该文件对应的部分文件数据块储存地址,同时会在这些文件数据块之中设置一个地址索引字段,用于记录关联的一个或多个文件数据块的存储地址,此时对该文件对应文件数据块的查找过程就是先通过元数据定位出部分文件数据块,再根据已定位出来的数据块中地址索引字段的存储地址,来进一步 定位出剩余的文件数据块,进而实现对该文件所有文件数据块的筛选定位。在此基础上,为了保障目标元数据和目标文件数据块可以被目标***正常使用,就必须保障各个目标文件数据块中地址索引字段记录数据的准确可靠。On the basis of recovery plan B, considering the actual application, there may be a certain association between file data blocks. For the case where there are associated file data blocks, some associated file data will generally be stored in the file data block The storage address of the block. For example, when a single file is stored as multiple file data blocks, the metadata in actual applications generally only records the storage address of the file data block corresponding to the file, and it will be in these file data blocks at the same time. Set an address index field to record the storage address of one or more file data blocks associated. At this time, the search process for the file data block corresponding to the file is to first locate some file data blocks through metadata, and then according to the located The storage address of the address index field in the output data block is used to further locate the remaining file data blocks, and then realize the screening and positioning of all file data blocks of the file. On this basis, in order to ensure that the target metadata and target file data blocks can be used normally by the target system, it is necessary to ensure the accuracy and reliability of the data recorded in the address index field of each target file data block.
作为本申请的一个实施例,为了保障各个目标文件数据块中地址索引字段记录数据的准确可靠,恢复方案B中,按照第四存储地址将目标文件数据块拷贝至第二文件***的文件数据区的操作,具体包括:As an embodiment of the present application, in order to ensure the accuracy and reliability of the data recorded in the address index field of each target file data block, in the recovery scheme B, the target file data block is copied to the file data area of the second file system according to the fourth storage address The operations include:
若目标文件数据块中包含地址索引字段,根据第二储存地址和第四存储地址更新地址索引字段,并按照第四存储地址,将更新后的目标文件数据块拷贝至第二文件***的文件数据区,地址索引字段用于存储一个或多个目标文件数据块的存储地址。If the target file data block contains an address index field, update the address index field according to the second storage address and the fourth storage address, and copy the updated target file data block to the file data of the second file system according to the fourth storage address Area, the address index field is used to store the storage address of one or more target file data blocks.
对于存在地址索引字段的目标文件数据块,本申请实施例会根据其内原本记录的相关文件数据块的第二存储地址查询对应的第四存储地址,并将查询出的第四储存地址替换原第二存储地址记录至地址索引字段之中,从而实现对地址索引字段内数据的准确更新,再根据该目标文件数据块第四存储地址,对该目标文件数据块进行拷贝,即可保障目标***中的各个目标文件数据块中地址索引字段记录数据的准确可靠。For a target file data block with an address index field, this embodiment of the application will query the corresponding fourth storage address according to the second storage address of the related file data block originally recorded therein, and replace the queried fourth storage address with the original first storage address. Second, the storage address is recorded in the address index field, so as to realize the accurate update of the data in the address index field, and then according to the fourth storage address of the target file data block, the target file data block is copied to ensure the target system The data recorded in the address index field in each target file data block is accurate and reliable.
在上述场景2相关的各个实施例的基础上,考虑到实际情况中目标文件数据块可能存在被加密的情况,此时无法直接读取目标文件数据块中的数据,更无法修改其中地址索引字段内的存储地址,因此需要对已加密的目标文件数据块进行解密,并在解密的基础上进行地址索引字段等操作,因此,在本申请实施例中,对地址索引字段更新的操作,具体包括:On the basis of the various embodiments related to the above scenario 2, considering that the target file data block may be encrypted in actual situations, the data in the target file data block cannot be directly read at this time, and the address index field cannot be modified. Therefore, it is necessary to decrypt the encrypted target file data block, and perform operations such as the address index field on the basis of the decryption. Therefore, in the embodiment of the present application, the operation of updating the address index field specifically includes :
若目标文件数据块中包含地址索引字段且目标文件数据块被加密,对目标文件数据块进行解密,得到解密后的地址索引字段。If the target file data block contains an address index field and the target file data block is encrypted, the target file data block is decrypted to obtain the decrypted address index field.
根据第二存储地址和第四存储地址更新解密后的地址索引字段,并对更新后的目标文件数据块进行加密。The decrypted address index field is updated according to the second storage address and the fourth storage address, and the updated target file data block is encrypted.
当目标文件数据块需要进行地址索引字段更新但又被加密时,本申请实施例会先对其进行解密,从而得到解密后的目标文件数据块,再根据地址索引字段中记录的关联文件数据块的第二存储地址查询出对应的第四存储地址,并对地址索引字段进行更新,最后再对更新后的目标文件数据块重新进行加密处理,即可实现对加密目标文件数据块的地址索引字段准确更新,保障各个目标文件数据块中地址索引字段记录数据的准确可靠,同时由于本申请实施例是以单个目标文件数据块为单位进行加密解密,以及地址索引字段的更新操作,因此不会将整个待备份文件完整解密,进而保证了整个过程的安全性。When the target file data block needs to be updated in the address index field but is encrypted, the embodiment of the application will decrypt it first to obtain the decrypted target file data block, and then according to the associated file data block recorded in the address index field The second storage address queries the corresponding fourth storage address, updates the address index field, and finally re-encrypts the updated target file data block to realize the accuracy of the address index field of the encrypted target file data block The update ensures the accuracy and reliability of the data recorded in the address index field in each target file data block. At the same time, since the embodiment of this application uses a single target file data block as a unit for encryption and decryption, as well as the update operation of the address index field, the entire The files to be backed up are completely decrypted, thereby ensuring the security of the entire process.
场景3:原***和目标***的***类型不相同。Scenario 3: The system types of the original system and the target system are different.
当原***和目标***的***类型不同时,说明两者对元数据存储和文件数据块存储的方式会存在一定的差异,因此理论上无法直接进行目标元数据和目标文件数据块的拷贝。为了适应原***和目标***的***类型不同的情况,需要对筛查出来的目标元数据和目标文件数据块进行格式转换和存储地址转换,以保证数据恢复后,目标元数据和目标文件数据块可以被目标***正常存储和使用。在此基础上,作为对场景3的一中可选目标元数据与目标文件数据块的恢复方案C,在S103之前,本申请实施例还包括:When the system types of the original system and the target system are different, it means that there will be a certain difference in the ways of storing metadata and file data blocks between the two. Therefore, in theory, it is impossible to directly copy the target metadata and target file data blocks. In order to adapt to the different system types of the original system and the target system, it is necessary to perform format conversion and storage address conversion on the target metadata and target file data blocks that are screened out to ensure that the target metadata and target file data blocks are restored after data recovery. It can be stored and used normally by the target system. On this basis, as a recovery scheme C for one of the optional target metadata and target file data blocks in scenario 3, before S103, the embodiment of the present application further includes:
获取目标元数据在第一文件***中的第一存储地址。获取目标文件数据块在第一文件***中的第二存储地址。Acquire the first storage address of the target metadata in the first file system. Acquire the second storage address of the target file data block in the first file system.
此处的原理与恢复方案A相同,具体可参考恢复方案A中的相关说明,此处不予赘述。The principle here is the same as the recovery plan A. For details, please refer to the relevant description in the recovery plan A, which will not be repeated here.
将目标元数据与目标文件数据块恢复至目标***的具体操作步骤,包括:The specific steps for restoring target metadata and target file data blocks to the target system include:
若第一文件***的***类型和第二文件***的***类型不相同,对目标元数据和目标文件数据块进行格式转换。对第一存储地址进行地址转换得到第五存储地址,并对第二存储地址进行转换得到第六存储地址。If the system type of the first file system and the system type of the second file system are not the same, the target metadata and the target file data block are formatted. Perform address conversion on the first storage address to obtain a fifth storage address, and perform conversion on the second storage address to obtain a sixth storage address.
其中,具体的格式转换方法可由技术人员根据实际原***和目标***对元数据和文件数据块的存储要求选取或设定(在文件***的***类型已知的情况下,文件***对元数据的种类、存储方式、格式和体积,以及文件数据块的存储方式和体积等存储需求都是已知信息),此处不予限定,只需保证在存储地址无误的基础上,转换后的目标元数据和目标文件数据可以正常被目标***进行存储和使用即可。Among them, the specific format conversion method can be selected or set by the technician according to the actual storage requirements of the original system and the target system for metadata and file data blocks (when the system type of the file system is known, the file system's metadata The type, storage method, format and volume, as well as the storage method and volume of the file data block are all known information), which is not limited here, and only needs to ensure that the converted target element is based on the correct storage address. The data and target file data can be stored and used by the target system normally.
按照第五存储地址,将格式转换后的目标元数据拷贝至第二文件***的元数据区,并按照第六存储地址,将格式转换后的目标文件数据块拷贝至第二文件***的文件数据区。Copy the target metadata after format conversion to the metadata area of the second file system according to the fifth storage address, and copy the target file data block after format conversion to the file data of the second file system according to the sixth storage address Area.
在确定出第五储存地址和第六储存地址之后,本申请实施例会按照对应的第五存储地址,来将目标元数据一一拷贝到目标***的元数据区之中,同时按照对应的第六储存地址将各个目标文件数据块一一拷贝至目标***文件数据区之中,进而实现对目标元数据和目标文件数据块的有效恢复。After the fifth storage address and the sixth storage address are determined, the embodiment of the application will copy the target metadata to the metadata area of the target system one by one according to the corresponding fifth storage address, and at the same time according to the corresponding sixth storage address. The storage address copies each target file data block one by one to the target system file data area, thereby realizing effective recovery of the target metadata and the target file data block.
在本申请实施例中,当处于场景3时,会根据原***和目标***对数据的存储要求对目标元数据和目标文件数据块进行格式转换,并根据目标元数据和目标文件数据块在原***中的存储地址进行地址转换得到在目标***中对应的存储地址,最后转换后的存储地址进行目标元数据和目标文件数据块的拷贝,使得本申请实施例可以实现对数据的有效恢复,保证目标元数据和目标文件数据块可以被目标***正常存储和使用,同时由于本申请实施例是基于文件数据块级别的数据恢复,因此即使文件***中对文件数据块进行了加密,本申请实施例也只要在有需要使用某个文件数据块内的信息时,才对该文件数据块进行解密(未加密的情况下,只需进行格式转换和地址转换即可),既无需对整个文件数据区进行数据解密,更无需还原出待备份文件的文件全貌,避免了对大量文件数据块以及整体文件的暴露风险,使得本申请实施例对文件备份的安全性大大提升。In the embodiment of this application, when it is in scenario 3, the target metadata and target file data blocks are formatted according to the data storage requirements of the original system and the target system, and the target metadata and target file data blocks are in the original system according to the target metadata and target file data blocks. Perform address conversion on the storage address in the target system to obtain the corresponding storage address in the target system. Finally, the converted storage address performs the copy of the target metadata and the target file data block, so that the embodiment of the present application can achieve effective data recovery and ensure the target Metadata and target file data blocks can be normally stored and used by the target system. At the same time, because the embodiment of the application is based on data recovery at the file data block level, even if the file data block is encrypted in the file system, the embodiment of the application is still As long as it is necessary to use the information in a file data block, the file data block can be decrypted (in the case of unencrypted, only format conversion and address conversion are required), and there is no need to perform the entire file data area. Data decryption also eliminates the need to restore the full picture of the file to be backed up, avoiding the risk of exposure to a large number of file data blocks and the entire file, so that the security of the file backup in the embodiment of the present application is greatly improved.
作为本申请的一个可选实施例,在恢复方案B的基础上,为了保障各个目标文件数据块中地址索引字段记录数据的准确可靠,按照第六存储地址,将格式转换后的目标文件数据块拷贝至第二文件***的文件数据区的操作,具体包括:As an optional embodiment of the present application, on the basis of the restoration scheme B, in order to ensure the accuracy and reliability of the data recorded in the address index field in each target file data block, the target file data block after the format conversion is converted according to the sixth storage address The operation of copying to the file data area of the second file system specifically includes:
若格式转换后的目标文件数据块中包含地址索引字段,根据第二储存地址和第六存储地址更新地址索引字段,并按照第六存储地址,将更新后的目标文件数据块拷贝至第二文件***的文件数据区,地址索引字段用于存储一个或多个目标文件数据块的存储地址。If the target file data block after format conversion contains an address index field, update the address index field according to the second storage address and the sixth storage address, and copy the updated target file data block to the second file according to the sixth storage address In the file data area of the system, the address index field is used to store the storage address of one or more target file data blocks.
本申请实施例的原理与上述恢复方案B中实施例的原理相同,仅是将第四存储地址替换为了第六存储地址,具体可参加恢复方案B中实施例的相关说明,此处不予赘述。The principle of the embodiment of this application is the same as the principle of the embodiment in the above restoration scheme B, except that the fourth storage address is replaced with the sixth storage address. For details, please refer to the related description of the embodiment in the restoration scheme B, which will not be repeated here. .
在本申请实施例三中,当不需要进行数据格式转换和存储地址转换时,本申请实施例整个文件备份的过程耗时较短,可以极大地缩短文件备份导致的终端设备不可用的时长,优化了用户体验,而当需要进行数据格式转换和/或存储地址转换时,在待备份文件不会影响用户正常使用终端设备的情况下,数据格式转换和存储地址转换的操作,均可以在用户正常使用终端设备时后台进行,此时整个文件备份导致的终端设备不可用的时长,对于用户而言是极短的,进而优化了用户体验。同时,对于本申请实施例一至三的文件备份方法可能带来的存储碎片化问题,也同样可以 在用户正常使用终端设备时后台进行文件碎片整理操作,以保证用户的良好使用体验。In the third embodiment of the present application, when data format conversion and storage address conversion are not required, the entire file backup process in the embodiment of the present application takes less time, which can greatly shorten the unavailability of the terminal device caused by the file backup. The user experience is optimized. When data format conversion and/or storage address conversion are required, the operations of data format conversion and storage address conversion can be performed by the user under the condition that the file to be backed up will not affect the user’s normal use of the terminal device. When the terminal device is used normally, it is performed in the background. At this time, the unavailability of the terminal device caused by the entire file backup is extremely short for the user, thereby optimizing the user experience. At the same time, with regard to the storage fragmentation problems that may be caused by the file backup methods of Embodiments 1 to 3 of the present application, the file defragmentation operation can also be performed in the background when the user normally uses the terminal device to ensure a good user experience.
实施例四:Embodiment four:
由本申请实施例三的说明可知,恢复方案A、恢复方案B和恢复方案C分别是对场景1、场景2和场景3对应的独立恢复方案,为了应对三种场景,实际应用中可以将恢复方案A、恢复方案B和恢复方案C分别与上述本申请实施例一和二进行结合,从而得到对应的文件备份细化方案,但实际应用中每次文件备份可能遇到的场景是未知的,因此仅仅结合单种恢复方案并不能很好地应对实际场景情况。From the description of the third embodiment of this application, it can be seen that the restoration plan A, the restoration plan B, and the restoration plan C are independent restoration plans corresponding to scene 1, scene 2 and scene 3, respectively. In order to deal with the three scenes, the restoration plan can be used in practical applications. A. The restoration scheme B and the restoration scheme C are respectively combined with the above-mentioned embodiments 1 and 2 of this application to obtain the corresponding detailed file backup scheme, but the scenarios that may be encountered in each file backup in actual applications are unknown, so Merely combining a single recovery plan cannot cope with the actual situation well.
为了更好兼容不同实际场景,保证在不同场景下对目标元数据和目标文件数据块的高效安全备份,在本申请实施例中会对恢复方案A、恢复方案B和恢复方案C排列组合,从而到以下4种组合方案:In order to better be compatible with different actual scenarios and ensure efficient and safe backup of target metadata and target file data blocks in different scenarios, in the embodiment of the present application, the restoration scheme A, the restoration scheme B, and the restoration scheme C are arranged and combined, thereby To the following 4 combinations:
组合方案1:恢复方案A+恢复方案B。Combination Plan 1: Recovery Plan A + Recovery Plan B.
组合方案2:恢复方案A+恢复方案C。Combination Plan 2: Recovery Plan A + Recovery Plan C.
组合方案3:恢复方案B+恢复方案C。Combination Plan 3: Recovery Plan B + Recovery Plan C.
组合方案4:恢复方案A+恢复方案B+恢复方案C。Combination Plan 4: Recovery Plan A+ Recovery Plan B+ Recovery Plan C.
在4种组合方案的基础上,可以任意选择一种组合方案来与本申请实施例一和二进行组合,进而得到对应的文件备份细化方案,此时得到的文件备份细化方案中,会根据原***和目标***的***类型、容量以及目标***数据存储情况来识别场景,并根据具体的场景进行从组合方案中选取实际场景对应的恢复方案。其中,具体的组合方案选取方法此处不予限定,可由技术人员根据实际应用需求进行选取。应当理解地,对于单个恢复方案与本申请实施例一和二结合应用的文件备份细化方案中,在S103之前,必须要有一次对目标元数据和目标文件数据块在原***中的第一储存地址和第二存储地址的获取操作,以保障后续恢复方案的正常执行,但对于组合方案与本申请实施例一和二结合应用的情况,由于组合方案中各个恢复方案都是对S103的并列细化方案,此时对应的在S103之前,只需要有一次获取第一储存地址和第二存储地址的操作即可。On the basis of the four combination schemes, you can arbitrarily choose a combination scheme to combine with Embodiments 1 and 2 of this application to obtain the corresponding file backup refinement plan. In the file backup refinement plan obtained at this time, The scene is identified according to the system type and capacity of the original system and the target system, and the data storage situation of the target system, and the recovery plan corresponding to the actual scene is selected from the combination plan according to the specific scene. Among them, the specific combination scheme selection method is not limited here, and can be selected by the technician according to actual application requirements. It should be understood that in the file backup refinement solution applied in combination with the first and second embodiments of this application for a single recovery solution, before S103, there must be a first storage of the target metadata and target file data blocks in the original system. The operation of obtaining the address and the second storage address is to ensure the normal execution of the subsequent recovery scheme. However, for the combined application of the combined scheme with the first and second embodiments of this application, since each recovery scheme in the combined scheme is a parallel detail to S103 In this case, before S103, only one operation of obtaining the first storage address and the second storage address is required.
以一实例进行说明,在本申请实施例中假设将组合方案4与本申请实施例一进行结合应用,且设置在筛选出目标元数据的同时获取对应的第一存储地址,在筛选出目标文件数据块的同时获取对应的第二存储地址,参考图3,本申请实施例,包括:To illustrate with an example, in the embodiment of this application, it is assumed that the combination scheme 4 and the embodiment 1 of this application are combined and applied, and it is set to obtain the corresponding first storage address while filtering out the target metadata, and then the target file is filtered out. Obtain the corresponding second storage address at the same time as the data block. Referring to FIG. 3, the embodiment of the present application includes:
S301,获取待备份文件的文件类型,并根据第一文件***的元数据区中元数据包含的类型标识,从第一文件***的元数据区中,筛选出文件类型对应的目标元数据。获取目标元数据在第一文件***中的第一存储地址。S301: Obtain the file type of the file to be backed up, and filter out the target metadata corresponding to the file type from the metadata area of the first file system according to the type identifier included in the metadata in the metadata area of the first file system. Acquire the first storage address of the target metadata in the first file system.
S302,从第一文件***的文件数据区中,筛选出目标元数据对应的目标文件数据块。获取目标文件数据块在第一文件***中的第二存储地址。S302: Filter out target file data blocks corresponding to the target metadata from the file data area of the first file system. Acquire the second storage address of the target file data block in the first file system.
S303,若第一文件***与第二文件***的***类型和容量均相同,且第二文件***内未存储数据,按照第一存储地址将目标元数据拷贝至第二文件***的元数据区,并按照第二存储地址将目标文件数据块拷贝至第二文件***的文件数据区。S303: If the system type and capacity of the first file system and the second file system are the same, and no data is stored in the second file system, copy the target metadata to the metadata area of the second file system according to the first storage address, And according to the second storage address, the target file data block is copied to the file data area of the second file system.
S304,若第一文件***的***类型和第二文件***的***类型相同,且第二文件***和第一文件***的容量不相同,和/或,第二文件***内存储有数据,对第一存储地址进行地址转换得到第三存储地址,并对第二存储地址进行转换得到第四存储地址。S304: If the system type of the first file system and the system type of the second file system are the same, and the capacities of the second file system and the first file system are different, and/or, data is stored in the second file system, Address conversion is performed on a storage address to obtain a third storage address, and the second storage address is converted to obtain a fourth storage address.
S305,按照第三存储地址将目标元数据拷贝至第二文件***的元数据区,并按照第四存储地址将目标文件数据块拷贝至第二文件***的文件数据区。S305: Copy the target metadata to the metadata area of the second file system according to the third storage address, and copy the target file data block to the file data area of the second file system according to the fourth storage address.
S306,若第一文件***的***类型和第二文件***的***类型不相同,对目标元数据和目标文件数据块进行格式转换。对第一存储地址进行地址转换得到第五存储地址,并对第二存储地址进行转换得到第六存储地址。S306: If the system type of the first file system is different from the system type of the second file system, perform format conversion on the target metadata and the target file data block. Perform address conversion on the first storage address to obtain a fifth storage address, and perform conversion on the second storage address to obtain a sixth storage address.
S307,按照第五存储地址,将格式转换后的目标元数据拷贝至第二文件***的元数据区,并按照第六存储地址,将格式转换后的目标文件数据块拷贝至第二文件***的文件数据区。S307. Copy the target metadata after the format conversion to the metadata area of the second file system according to the fifth storage address, and copy the target file data block after the format conversion to the second file system according to the sixth storage address. File data area.
本申请实施例在获取到目标元数据、目标文件数据块、第一储存地址以及第二储存地址之后,会根据原***和目标***的***类型、容量以及目标***数据存储情况来识别场景,在为场景1时,采用恢复方案A来进行数据恢复,在为场景2时,采用恢复方案B来进行数据恢复,在为场景3时,采用恢复方案C来进行数据恢复(这其中仅会获取一次第一储存地址和第二储存地址)。由此可知,本申请实施例可以实现对三种场景的兼容处理,保障在任意一种场景之中对目标元数据和目标文件数据的快速安全备份,且可以保障目标***对恢复后的目标元数据和目标文件数据的正常存储和使用。After obtaining the target metadata, the target file data block, the first storage address, and the second storage address, the embodiment of this application will identify the scene according to the system type and capacity of the original system and the target system, and the data storage situation of the target system. For scenario 1, use recovery plan A for data recovery, for scenario 2, use recovery plan B for data recovery, and for scenario 3, use recovery plan C for data recovery (which will only be obtained once The first storage address and the second storage address). It can be seen from this that the embodiment of the present application can realize compatible processing of the three scenarios, ensure the fast and safe backup of the target metadata and target file data in any one of the scenarios, and can ensure that the target system is able to protect the target metadata after restoration. Normal storage and use of data and target file data.
实施例五:Embodiment five:
作为本申请的一个具体实施例,以原***为F2FS文件***为例,对上述本申请实施例一至四中文件备份的操作进行相关说明。As a specific embodiment of the present application, taking the original system as the F2FS file system as an example, the above-mentioned file backup operations in the first to fourth embodiments of the present application will be described.
首先对F2FS文件***的元数据区和文件数据区进行说明,参考图4A,F2FS文件***的元数据区中,包含有超级块(Super block)、检查点(Check point)、段信息表(Segment Information Table,SIT)、节点地址表(Node Address Table,NAT)和段摘要区(Segment Summary Area,SSA),其中,对各个部分的说明如下:First, the metadata area and file data area of the F2FS file system are described. Referring to Figure 4A, the metadata area of the F2FS file system includes super block, check point, and segment information table (Segment). Information Table (SIT), Node Address Table (NAT), and Segment Summary Area (SSA). The description of each part is as follows:
SIT,用于标识文件数据区中每个文件数据块上的数据有效性,SIT中的数据也是以数据块的形式进行存储,其中每个SIT数据块由多个sit_entry数据填充,每个sit_entry数据对应一个64字节的valid_map,一个valid_map对应文件数据区内512个文件数据块,因此sit_entry数据和文件数据区内的文件数据块是按照物理地址顺序一一对应的,理论上可以通过SIT计算对应的文件数据块位置偏移数据,即可实现对文件数据块的定位,而不需要记录文件数据真实的存储地址。SIT is used to identify the validity of the data on each file data block in the file data area. The data in the SIT is also stored in the form of data blocks, where each SIT data block is filled with multiple sit_entry data, and each sit_entry data Corresponding to a 64-byte valid_map, a valid_map corresponds to 512 file data blocks in the file data area, so the sit_entry data and the file data blocks in the file data area are in a one-to-one correspondence according to the physical address order. Theoretically, the correspondence can be calculated by SIT The file data block position offset data can realize the positioning of the file data block without recording the real storage address of the file data.
NAT,用于记录文件的索引节点(inode)数据,在进行文件读取的时候,首先会向NAT查找文件对应的inode,由于inode是文件/文件夹的唯一索引编号,因此根据文件路径逐级查找,在文件数据区找到文件或文件夹的最终inode数据,再根据inode数据在NAT中即可找到文件在文件数据区对应的文件数据块位置,实现对文件数据块的定位。NAT以nat_entry数据填充,每个nat_entry数据记录一个inode以及该inode在文件数据区对应的存储地址。需要说明的是,nat_entry数据中记录的inode与其对应的文件数据块存储地址没有物理地址顺序关系,随着用户数据不断被写入、修改和擦除,inode对应的文件数据块存储地址可能是文件数据区中的任意位置。(通常文件***创建之后,NAT中会有一个文件***的根节点的inode数据)NAT is used to record the index node (inode) data of the file. When reading the file, it will first look up the inode corresponding to the file from the NAT. Since the inode is the unique index number of the file/folder, it is level by level according to the file path Search, find the final inode data of the file or folder in the file data area, and then find the file data block location corresponding to the file in the file data area in the NAT according to the inode data, so as to realize the positioning of the file data block. NAT is filled with nat_entry data, and each nat_entry data records an inode and the corresponding storage address of the inode in the file data area. It should be noted that there is no physical address sequence relationship between the inode recorded in the nat_entry data and the storage address of the corresponding file data block. As user data is continuously written, modified and erased, the storage address of the file data block corresponding to the inode may be a file Any position in the data area. (Usually after the file system is created, there will be inode data of the root node of the file system in NAT)
Check point,用于记录SIT和NAT中每个字段的有效性,在元数据区中,SIT和NAT各有两份,即SIT0/SIT1和NAT0/NAT1,Check point即用于记录是使用SIT0中的对应字段还是SIT1中的对应字段,以及是使用NAT0中的对应字段还是NAT1中的对应字段。Checkpoint is used to record the validity of each field in SIT and NAT. In the metadata area, there are two copies of SIT and NAT, namely SIT0/SIT1 and NAT0/NAT1. Checkpoint is used to record whether SIT0 is used. The corresponding field of is still the corresponding field in SIT1, and whether to use the corresponding field in NAT0 or the corresponding field in NAT1.
SSA,用于记录SIT和NAT的操作日志信息。SSA is used to record the operation log information of SIT and NAT.
Super block,用于记录文件***的整体信息,包括inode和文件数据块的总量、使用量、剩余量,以及文件***的格式与相关信息等。Super block is used to record the overall information of the file system, including the total amount, usage, and remaining amount of inodes and file data blocks, as well as the format and related information of the file system.
在本申请实施例中,会预先在sit_entry数据和/或nat_entry数据中设置一个标识字段用于存 储类型标识,该字段既可以是在sit_entry数据和/或nat_entry数据中新增的字段,也可以是复用一个sit_entry数据和/或nat_entry数据中已有的字段,其中既可以仅选取sit_entry数据进行标识字段设置,也可以仅选取nat_entry数据进行标识字段设置,亦可以在sit_entry数据和nat_entry数据中,均设置对应的标识字段,具体可由技术人员自行设定,此处不予限定。In the embodiment of this application, an identification field is set in the sit_entry data and/or nat_entry data in advance to store the type identification. This field can be a newly added field in the sit_entry data and/or nat_entry data, or it can be Reuse an existing field in sit_entry data and/or nat_entry data, in which you can select only sit_entry data for identification field setting, or only nat_entry data for identification field setting, or both of sit_entry data and nat_entry data. The corresponding identification field can be set by the technicians, and it is not limited here.
在设置好标识字段的基础上,本申请实施例在文件***每次创建一个新的文件或者修改文件类型的时候,由业务层申明该文件的类型或者继承父目录的类型属性以确定出文件对应的类型,并会根据确定出的类型来设置或修改标识字段中的类型标识数据,并在NAT中添加该文件头的inod数据。On the basis of setting the identification field, in the embodiment of this application, every time a new file is created or the file type is modified in the file system, the business layer declares the type of the file or inherits the type attribute of the parent directory to determine the file corresponding According to the determined type, the type identification data in the identification field will be set or modified, and the inod data of the file header will be added to the NAT.
当文件被删除时,本申请实施例会同时将文件在SIT的valid_map中对应的标识进行删除,并删除NAT中对应的inode数据。When a file is deleted, the embodiment of the present application will delete the corresponding identifier of the file in the valid_map of the SIT and delete the corresponding inode data in the NAT at the same time.
同时,在对文件操作时,本申请实施例还会同步在Check Point和SSA中进行一些对应的辅助操作和记录。At the same time, when operating on files, this embodiment of the application will also perform some corresponding auxiliary operations and records in Check Point and SSA simultaneously.
以下对本申请实施例进行文件备份的步骤进行说明:The following describes the steps of performing file backup in the embodiment of the present application:
步骤1:目标元数据和目标文件数据块的筛选。Step 1: Screening of target metadata and target file data blocks.
作为本申请的一个可选实施例,若在sit_entry数据和nat_entry数据中均设置对应的标识字段,在以F2FS文件***为原***进行文件备份时,对应S101和S102的操作具体包括:As an optional embodiment of the present application, if corresponding identification fields are set in both sit_entry data and nat_entry data, when the F2FS file system is used as the original system for file backup, the operations corresponding to S101 and S102 specifically include:
遍历第一文件***内各个sit_entry数据的类型标识,筛选出类型标识与文件类型匹配的目标sit_entry数据。遍历第一文件***内的各个nat_entry数据的类型标识,筛选出类型标识与文件类型匹配的目标nat_entry数据。Traverse the type identification of each sit_entry data in the first file system, and filter out target sit_entry data whose type identification matches the file type. Traverse the type identification of each nat_entry data in the first file system, and filter out the target nat_entry data whose type identification matches the file type.
从第一文件***的文件数据区中,筛选出目标sit_entry数据或目标nat_entry数据对应的目标文件数据块。From the file data area of the first file system, the target file data block corresponding to the target sit_entry data or the target nat_entry data is filtered out.
由上述对F2FS文件***的说明可知,对在sit_entry数据和nat_entry数据设置标识字段共有三种情况,本申请实施例中仅以其中的一种:同时在sit_entry数据和nat_entry数据设置标识字段为例进行说明,此时S101中需要同时在sit_entry数据和nat_entry数据中匹配出文件类型对应的类型标识,以实现对文件类型对应的目标sit_entry数据和目标nat_entry数据的有效筛选。As can be seen from the above description of the F2FS file system, there are three situations in which the identification field is set in the sit_entry data and the nat_entry data. In the embodiment of this application, only one of them is set: the identification field is set in the sit_entry data and the nat_entry data as an example Note that at this time, S101 needs to match the type identification corresponding to the file type in the sit_entry data and the nat_entry data at the same time, so as to realize the effective screening of the target sit_entry data and the target nat_entry data corresponding to the file type.
同时,由于sit_entry数据和nat_entry数据都可以定位出文件数据块在文件数据区中对应的位置,因此此时可以通过目标sit_entry数据和目标nat_entry数据中的任意一个数据,来进行目标文件数据块的定位筛选。其中具体选取目标sit_entry数据还是目标nat_entry数据此处不予限定,可由技术人员自行设定。At the same time, since both sit_entry data and nat_entry data can locate the corresponding position of the file data block in the file data area, at this time, the target file data block can be located by any one of the target sit_entry data and the target nat_entry data. filter. The specific selection of target sit_entry data or target nat_entry data is not limited here, and can be set by the technician.
作为本申请的另一个可选实施例,若仅在nat_entry数据中设置对应的标识字段,在以F2FS文件***为原***进行文件备份时,对应S101和S102的操作具体包括:As another optional embodiment of the present application, if only the corresponding identification field is set in the nat_entry data, when the F2FS file system is used as the original system for file backup, the operations corresponding to S101 and S102 specifically include:
遍历第一文件***内的各个nat_entry数据的类型标识,筛选出类型标识与文件类型匹配的目标nat_entry数据。Traverse the type identification of each nat_entry data in the first file system, and filter out the target nat_entry data whose type identification matches the file type.
从第一文件***的文件数据区中,筛选出目标nat_entry数据对应的目标文件数据块。根据目标文件数据块在文件数据区中的位置,查找出对应的目标sit_entry数据。From the file data area of the first file system, filter out the target file data block corresponding to the target nat_entry data. According to the location of the target file data block in the file data area, find out the corresponding target sit_entry data.
在本申请实施例中,仅在nat_entry数据中设置对应的标识字段,因此S101中需要对nat_entry数据的类型标识进行遍历,以找出对应的目标nat_entry数据。在S102中,则需要根据目标nat_entry数据定位出对应的目标文件数据块,但应理解地,由于SIT中记录的也是文件的元数据,因此本申请实施例中还需要根据目标文件数据块在文件数据区中的位置(此位置既可以是物理存储地址, 也可以是位置偏移数据)来定位出对应的目标sit_entry数据,进而实现对目标元数据的完整获取。In the embodiment of the present application, only the corresponding identification field is set in the nat_entry data. Therefore, the type identification of the nat_entry data needs to be traversed in S101 to find the corresponding target nat_entry data. In S102, it is necessary to locate the corresponding target file data block according to the target nat_entry data. However, it should be understood that since the metadata recorded in the SIT is also the metadata of the file, the embodiment of the application also needs to locate the target file data block in the file The location in the data area (this location can be either a physical storage address or location offset data) to locate the corresponding target sit_entry data, thereby achieving complete acquisition of target metadata.
作为本申请的另一个可选实施例,若仅在sit_entry数据中设置对应的标识字段,在以F2FS文件***为原***进行文件备份时,对应S101和S102的操作具体包括:As another optional embodiment of the present application, if only the corresponding identification field is set in the sit_entry data, when the F2FS file system is used as the original system for file backup, the operations corresponding to S101 and S102 specifically include:
遍历第一文件***内各个sit_entry数据的类型标识,筛选出类型标识与文件类型匹配的目标sit_entry数据。Traverse the type identification of each sit_entry data in the first file system, and filter out target sit_entry data whose type identification matches the file type.
从第一文件***的文件数据区中,筛选出目标sit_entry数据对应的目标文件数据块。根据目标文件数据块在文件数据区中的存储地址,查找出对应的目标nat_entry数据。From the file data area of the first file system, the target file data block corresponding to the target sit_entry data is filtered out. According to the storage address of the target file data block in the file data area, find the corresponding target nat_entry data.
在本申请实施例中,仅在sit_entry数据中设置对应的标识字段,因此S101中需要对sit_entry数据的类型标识进行遍历,以找出对应的目标sit_entry数据。在S102中,则需要根据目标sit_entry数据定位出对应的目标文件数据块,但应理解地,由于NAT中记录的也是文件的元数据,因此本申请实施例中还需要根据目标文件数据块在文件数据区中的物理存储地址来定位出对应的目标nat_entry数据,进而实现对目标元数据的完整获取。In the embodiment of the present application, only the corresponding identification field is set in the sit_entry data. Therefore, the type identification of the sit_entry data needs to be traversed in S101 to find the corresponding target sit_entry data. In S102, it is necessary to locate the corresponding target file data block according to the target sit_entry data. However, it should be understood that since the metadata of the file is also recorded in the NAT, the embodiment of the application also needs to locate the target file data block in the file The physical storage address in the data area is used to locate the corresponding target nat_entry data, thereby achieving complete acquisition of target metadata.
与本申请实施例二对应的,本申请实施例五中目标nat_entry数据、目标sit_entry数据和目标文件数据块的存储,也可以根据实际情况来选择是否需要进行第一存储空间的转存,具体可参考本申请实施例二中的相关说明,此处不予赘述。Corresponding to the second embodiment of this application, the storage of target nat_entry data, target sit_entry data, and target file data block in the fifth embodiment of this application can also be selected according to the actual situation. Refer to the related description in the second embodiment of the present application, which will not be repeated here.
作为本申请的一个可选实施例,在对目标nat_entry数据、目标sit_entry数据和目标文件数据块进行备份的同时,也可以将检查点数据和段摘要区数据一同备份,以保障文件***的健壮性。其中,若需要使用第一存储空间进行转存,此时转存的操作,包括:As an optional embodiment of this application, while backing up the target nat_entry data, target sit_entry data, and target file data blocks, checkpoint data and segment summary area data can also be backed up together to ensure the robustness of the file system . Among them, if the first storage space needs to be used for dumping, the dumping operations at this time include:
获取第一文件***的元数据区中的检查点数据和段摘要区数据,并将检查点数据、段摘要区数据、目标sit_entry数据和目标nat_entry数据拷贝至第一存储空间。Obtain checkpoint data and segment summary area data in the metadata area of the first file system, and copy the checkpoint data, segment summary area data, target sit_entry data, and target nat_entry data to the first storage space.
步骤2:将目标元数据和目标文件数据恢复至目标***。Step 2: Restore the target metadata and target file data to the target system.
其中,恢复的原理和一些可选的恢复方案等说明,可参考本申请实施例三和四中的说明,此处不予赘述。为了便于理解本申请实施例,此处仅以目标***也是F2FS文件***为例进行说明。For the description of the recovery principle and some optional recovery schemes, please refer to the descriptions in the third and fourth embodiments of the present application, which will not be repeated here. In order to facilitate the understanding of the embodiments of the present application, only the target system is also an F2FS file system as an example for description.
当本申请实施例处于本申请实施例三中的场景1的情况时,此时本申请实施例一会直接根据目标nat_entry数据和目标sit_entry数据在原***的元数据区中的存储地址,直接拷贝到目标***元数据区中对应的存储地址内,同时根据目标文件数据块在文件数据区内的存储地址,直接拷贝到目标***文件数据区中对应的存储地址内。When the embodiment of the application is in the situation of scenario 1 in the third embodiment of the application, at this time, the first embodiment of the application will directly copy the target nat_entry data and the storage address of the target sit_entry data in the metadata area of the original system to In the corresponding storage address in the target system metadata area, at the same time, according to the storage address of the target file data block in the file data area, it is directly copied to the corresponding storage address in the target system file data area.
当本申请实施例处于本申请实施例三中的场景2的情况时,此时原***和目标***容量不同,和/或目标***内存储有数据,因此需要先进行存储地址转换才能进行下一步的数据恢复,作为一个可选的存储地址转换实施例,参考图4B,转换的操作如下:When the embodiment of this application is in the situation of scenario 2 in the third embodiment of this application, the original system and the target system have different capacities, and/or data is stored in the target system. Therefore, the storage address conversion must be performed before the next step. As an optional storage address conversion embodiment, referring to FIG. 4B, the conversion operation is as follows:
对于目标sit_entry数据,目标sit_entry数据中的valid_map向目标***中的valid_map写入时,地址转换就是直接映射,即找到目标***中空闲长度足够的SIT段,再将目标sit_entry数据映射至该对应的空闲SIT段,如图4B中的将原***中的目标sit_entry数据M1映射至目标***中的Mk,1<k<n。For the target sit_entry data, when the valid_map in the target sit_entry data is written to the valid_map in the target system, the address conversion is direct mapping, that is, to find the SIT segment with sufficient free length in the target system, and then map the target sit_entry data to the corresponding free The SIT segment, as shown in Figure 4B, maps the target sit_entry data M1 in the original system to Mk in the target system, 1<k<n.
对于目标nat_entry数据,首先确定目标nat_entry数据对应的目标sit_entry数据,根据目标sit_entry数据的第一存储地址和第三存储地址映射关系,确定出目标nat_entry数据的第一存储地址和第三存储地址映射关系,再根据该映射关系和目标nat_entry数据的第一存储地址,可确定出目标nat_entry数据对应的第三存储地址。在对目标nat_entry数据进行存储地址转换和恢复的同时,还需要根据目标nat_entry数据新的第三存储地址,对目标nat_entry数据中的inode数据进行更新, 以保证目标nat_entry数据的正常可用。For the target nat_entry data, first determine the target sit_entry data corresponding to the target nat_entry data, and determine the mapping relationship between the first storage address and the third storage address of the target nat_entry data according to the mapping relationship between the first storage address and the third storage address of the target sit_entry data According to the mapping relationship and the first storage address of the target nat_entry data, the third storage address corresponding to the target nat_entry data can be determined. While converting and restoring the storage address of the target nat_entry data, it is also necessary to update the inode data in the target nat_entry data according to the new third storage address of the target nat_entry data to ensure the normal availability of the target nat_entry data.
对于目标文件数据块,与目标nat_entry数据类似的,根据目标sit_entry数据的第一存储地址和第三存储地址映射关系,以及目标文件数据块对应的目标nat_entry数据和目标文件数据块的第二存储地址,即可定位出目标文件数据块对应的第四存储地址并进行拷贝。For the target file data block, similar to the target nat_entry data, according to the mapping relationship between the first storage address and the third storage address of the target sit_entry data, and the target nat_entry data corresponding to the target file data block and the second storage address of the target file data block , The fourth storage address corresponding to the data block of the target file can be located and copied.
其中,在对目标文件数据块中node索引(即上述本申请实施例三中的地址索引字段)进行更新时,操作包括:遍历目标文件数据块,提取出各个目标文件数据块的地址索引字段中记录的一/二/三级存储地址,并各个目标文件数据块的第四存储地址,对相关联的目标文件数据块中的地址索引字段,进行一/二/三级存储地址更新,以保证目标文件数据块之间能正常进行地址索引,保证目标***对目标文件数据块的正常使用。Wherein, when the node index in the target file data block (that is, the address index field in the third embodiment of the present application) is updated, the operation includes: traversing the target file data block, and extracting the address index field of each target file data block The first, second, and third-level storage address of the record and the fourth storage address of each target file data block are updated to the address index field in the associated target file data block to update the first, second, and third-level storage address to ensure The target file data blocks can be indexed normally to ensure the normal use of the target file data blocks by the target system.
在本申请实施例五中,对F2FS文件***中的sit_entry数据和/或nat_entry数据进行类型标识,并在需要进行文件备份的时候,根据待备份文件的文件类型来选取出待备份文件的sit_entry数据和/或nat_entry数据,并根据选取出来的sit_entry数据和/或nat_entry数据来进行目标文件数据块的顺序读取,最后对sit_entry数据、nat_entry数据和目标文件数据块进行目标文件***的备份,从而实现了对文件数据块的批量顺序读取,在文件***数据碎片化严重的情况下,相比需要进行大量的随机数据块读取的基于目录结构文件备份而言,本申请实施例可以节约大量的文件数据块读取时间,文件备份的效率大大提升。In the fifth embodiment of the present application, the sit_entry data and/or nat_entry data in the F2FS file system are typed, and when file backup is required, the sit_entry data of the file to be backed up is selected according to the file type of the file to be backed up And/or nat_entry data, and read the target file data block sequentially according to the selected sit_entry data and/or nat_entry data, and finally perform the target file system backup of the sit_entry data, nat_entry data and target file data block to achieve In order to read the file data blocks in batches sequentially, in the case of severe file system data fragmentation, compared to the directory structure file backup that requires a large number of random data block readings, the embodiment of the present application can save a lot of money. File data block reading time, file backup efficiency is greatly improved.
同时,通过对场景1、场景2和场景3设置对应的恢复方案,使得在进行数据恢复时,可以通过仅解密单个文件数据块,甚至不解密任何文件数据块的方式,实现对sit_entry数据、nat_entry数据和目标文件数据块的恢复,相对相关技术而言,文件暴露的可能性大大降低,文件备份的安全性得到了极大的提升。且通过设置不同的恢复方案组合,还可以实现对不同实际应用场景的良好兼容,保障在任意一种场景之中对sit_entry数据、nat_entry数据和目标文件数据块的快速安全备份,且可以保障目标***对恢复后的sit_entry数据、nat_entry数据和目标文件数据块的正常存储和使用。At the same time, by setting corresponding recovery schemes for scenario 1, scenario 2, and scenario 3, when data recovery is performed, it is possible to decrypt sit_entry data and nat_entry data by decrypting only a single file data block, or even without decrypting any file data block. The recovery of data and target file data blocks, compared with related technologies, greatly reduces the possibility of file exposure, and the security of file backup has been greatly improved. And by setting different combinations of recovery schemes, good compatibility with different practical application scenarios can be achieved, ensuring fast and safe backup of sit_entry data, nat_entry data, and target file data blocks in any scenario, and the target system can be guaranteed Normal storage and use of restored sit_entry data, nat_entry data and target file data blocks.
实施例六:Embodiment 6:
图5示出了本申请实施例六提供的文件备份方法的实现流程图,应用于安装有第一文件***的第一终端设备,详述如下:FIG. 5 shows an implementation flow chart of the file backup method provided in the sixth embodiment of the present application, which is applied to the first terminal device installed with the first file system, as detailed as follows:
S501,获取待备份文件的文件类型,并根据第一文件***的元数据区中元数据包含的类型标识,从第一文件***的元数据区中,筛选出文件类型对应的目标元数据。S501: Obtain the file type of the file to be backed up, and filter out target metadata corresponding to the file type from the metadata area of the first file system according to the type identifier contained in the metadata in the metadata area of the first file system.
S502,从第一文件***的文件数据区中,筛选出目标元数据对应的目标文件数据块。S502: Filter out target file data blocks corresponding to the target metadata from the file data area of the first file system.
S503,将目标元数据和目标文件数据块发送至安装有第二文件***的第二终端设备,目标元数据和目标文件数据用于指示第二终端设备,将目标元数据恢复至第二文件***的元数据区,以及将目标文件数据块恢复至第二文件***的文件数据区。S503: Send the target metadata and the target file data block to the second terminal device installed with the second file system, where the target metadata and target file data are used to instruct the second terminal device to restore the target metadata to the second file system And restore the target file data block to the file data area of the second file system.
本申请实施例六的文件备份原理与本申请实施例一相同,此处不予详述,具体可参考本申请实施例一及其他相关实施例的说明,但与本申请实施例一不同之处在于,在本申请实施例六中,作为执行主体的第一终端设备会与另一个安装有目标***的第二终端设备直接连接,在此基础上,第一终端设备只需进行目标元数据和目标文件数据块的筛选,并将目标元数据和目标文件数据块发送给安装有目标***的第二终端设备,具体的目标元数据和目标文件数据块恢复至目标***操作,由第二终端设备完成。The file backup principle of the sixth embodiment of the present application is the same as that of the first embodiment of the present application, and will not be described in detail here. For details, please refer to the description of the first embodiment of the present application and other related embodiments, but are different from the first embodiment of the present application In the sixth embodiment of the present application, the first terminal device as the execution subject will be directly connected to another second terminal device installed with the target system. On this basis, the first terminal device only needs to perform target metadata and The target file data block is screened, and the target metadata and target file data block are sent to the second terminal device installed with the target system. The specific target metadata and target file data block are restored to the target system for operation, and the second terminal device carry out.
可以理解地,本申请实施例六同样可以和上述本申请实施例二至五进行结合应用,此时只需 将目标元数据和目标文件数据块恢复至目标***的相关操作,分配给本申请实施例六中的第二终端设备即可,具体可参考上述本申请实施例二至五的说明,此处不予赘述。Understandably, the sixth embodiment of the present application can also be used in combination with the above-mentioned embodiments two to five of the present application. At this time, only the target metadata and target file data blocks need to be restored to the target system and assigned to the implementation of the present application. The second terminal device in Example 6 is sufficient. For details, please refer to the description of the above-mentioned Embodiments 2 to 5 of the present application, which will not be repeated here.
实施例七:Embodiment Seven:
对应于上文实施例六的文件备份方法,图6示出了本申请实施例提供的文件备份***的***交互示意图,为了便于说明,仅示出了与本申请实施例相关的部分。Corresponding to the file backup method of the sixth embodiment above, FIG. 6 shows a schematic diagram of system interaction of the file backup system provided by the embodiment of the present application. For ease of description, only the parts related to the embodiment of the present application are shown.
文件备份***,包括:第一终端设备和第二终端设备,第一终端设备中安装有第一文件***,第二终端设备中安装有第二文件***。The file backup system includes: a first terminal device and a second terminal device. A first file system is installed in the first terminal device, and a second file system is installed in the second terminal device.
S601,第一终端设备用于,获取待备份文件的文件类型,并根据第一文件***的元数据区中元数据包含的类型标识,从第一文件***的元数据区中,筛选出文件类型对应的目标元数据。S601: The first terminal device is configured to obtain the file type of the file to be backed up, and filter the file type from the metadata area of the first file system according to the type identifier included in the metadata area of the first file system The corresponding target metadata.
S602,第一终端设备还用于,从第一文件***的文件数据区中,筛选出目标元数据对应的目标文件数据块。S602: The first terminal device is further configured to filter out target file data blocks corresponding to the target metadata from the file data area of the first file system.
S603,第一终端设备还用于,将目标元数据和目标文件数据块发送至第二终端设备。S603: The first terminal device is further configured to send the target metadata and the target file data block to the second terminal device.
S604,第二终端设备用于,将目标元数据恢复至第二文件***的元数据区,以及将目标文件数据块恢复至第二文件***的文件数据区。S604: The second terminal device is configured to restore the target metadata to the metadata area of the second file system, and restore the target file data block to the file data area of the second file system.
本申请实施例提供文件备份***中各终端设备实现各自功能的过程,具体可参考前述图5所示实施例六以及其他相关方法实施例的描述,此处不再赘述。The embodiments of the present application provide a process for each terminal device in the file backup system to realize their respective functions. For details, please refer to the description of the sixth embodiment shown in FIG. 5 and other related method embodiments, which will not be repeated here.
实施例八:Embodiment 8:
图7示出了本申请实施例八提供的文件备份方法的实现流程图,应用于安装有第一文件***的第一终端设备,详述如下:FIG. 7 shows an implementation flow chart of the file backup method provided by the eighth embodiment of the present application, which is applied to the first terminal device with the first file system installed, and the details are as follows:
S701,获取待备份文件的文件类型,并根据第一文件***的元数据区中元数据包含的类型标识,从第一文件***的元数据区中,筛选出文件类型对应的目标元数据。S701: Obtain the file type of the file to be backed up, and filter out target metadata corresponding to the file type from the metadata area of the first file system according to the type identifier included in the metadata in the metadata area of the first file system.
S702,从第一文件***的文件数据区中,筛选出目标元数据对应的目标文件数据块。S702: Filter out target file data blocks corresponding to the target metadata from the file data area of the first file system.
S703,将目标元数据和目标文件数据块发送至存储设备,以指示存储设备,对目标元数据和目标文件数据块进行存储,并将目标元数据和目标文件数据块发送至安装有第二文件***的第二终端设备,通过第二终端设备将目标元数据恢复至第二文件***的元数据区,以及将目标文件数据块恢复至第二文件***的文件数据区。S703: Send the target metadata and the target file data block to the storage device to instruct the storage device to store the target metadata and the target file data block, and send the target metadata and the target file data block to the second file installed The second terminal device of the system restores the target metadata to the metadata area of the second file system through the second terminal device, and restores the target file data block to the file data area of the second file system.
本申请实施例八的文件备份原理与本申请实施例二相同,此处不予详述,具体可参考本申请实施例一和二及其他相关实施例的说明。The file backup principle of the eighth embodiment of the present application is the same as that of the second embodiment of the present application, and will not be described in detail here. For details, please refer to the descriptions of the first and second embodiments of the present application and other related embodiments.
但与本申请实施例二的不同之处在于,在本申请实施例八中,作为执行主体的第一终端设备会与一个存储设备(对应于本申请实施例二,此时第一存储空间就是指该存储设备中的存储空间)直接连接,而该存储设备会和另一个安装有目标***的第二终端设备直接连接,在此基础上,第一终端设备只需进行目标元数据和目标文件数据块的筛选,并将目标元数据和目标文件数据块发送给存储设备,由存储设备对目标元数据和目标文件数据块存储完成后,发送给安装有目标***的第二终端设备,具体目标元数据和目标文件数据块恢复至目标***操作则由第二终端设备完成。However, the difference from the second embodiment of the present application is that in the eighth embodiment of the present application, the first terminal device as the execution subject will be connected to a storage device (corresponding to the second embodiment of the present application, at this time, the first storage space is Refers to the storage space in the storage device) is directly connected, and the storage device will be directly connected to another second terminal device installed with the target system. On this basis, the first terminal device only needs to perform target metadata and target files The data block is screened, and the target metadata and target file data block are sent to the storage device. After the storage device completes the storage of the target metadata and target file data block, the target metadata and target file data block are sent to the second terminal device installed with the target system. The specific target The operation of restoring metadata and target file data blocks to the target system is completed by the second terminal device.
可以理解地,本申请实施例八同样可以和上述本申请实施例三至五进行结合应用,此时只需将目标元数据和目标文件数据块恢复至目标***的相关操作,分配给本申请实施例八中的第二终端设备即可,具体可参考上述本申请实施例三至五的说明,此处不予赘述。Understandably, the eighth embodiment of the present application can also be combined with the above-mentioned embodiments three to five of the present application. At this time, only the target metadata and target file data blocks need to be restored to the target system and assigned to the implementation of the present application. The second terminal device in Example 8 is sufficient. For details, please refer to the description of the above-mentioned Embodiments 3 to 5 of this application, which will not be repeated here.
同时应当说明地,与本申请实施例六相比,考虑到实际情况中终端设备直连并进行实时的数据传输和处理时,一方面容易出现数据丢失等问题,此时由于原***可能已经开始了数据清除, 从而导致丢失或出错的数据无法进行恢复,另一方面,受到物理空间距离和硬件配置等因素的限制,很多时候两个终端设备难以直接进行连接和数据传输,因此使得本申请实施例六难以实现。为了解决上述问题,本申请实施例八会在两个终端设备之间设置一个存储设备,由该存储设备对目标元数据和目标文件数据块进行转存,一方面,使得即使文件备份过程出现了数据丢失等错误,也可以及时从存储设备中恢复,进而提高了目标元数据和目标文件数据块的安全性和可靠性,另一方面,对于由于物理空间距离过远和硬件配置不支持同种设备直连等原因,无法实现终端设备之间直连操作的情况,本申请实施例也可以很好地进行终端设备之间的文件备份,例如,可以通过将云端服务器作为存储设备,来对物理空间距离较远的两个地点处的两台终端设备进行文件备份。At the same time, it should be noted that, compared with the sixth embodiment of the present application, considering that the terminal device is directly connected to perform real-time data transmission and processing in the actual situation, on the one hand, data loss and other problems are prone to occur. The data is cleared, so that the lost or erroneous data cannot be recovered. On the other hand, due to the limitations of physical space distance and hardware configuration, it is often difficult for two terminal devices to directly connect and transmit data, which makes the implementation of this application Example 6 is difficult to achieve. In order to solve the above problems, the eighth embodiment of the present application will set up a storage device between the two terminal devices, and the storage device will dump the target metadata and the target file data block. On the one hand, even if the file backup process occurs Errors such as data loss can also be recovered from the storage device in time, thereby improving the security and reliability of the target metadata and target file data blocks. On the other hand, the same type is not supported due to the distance between the physical space and the hardware configuration. For reasons such as direct connection of devices, direct connection operations between terminal devices cannot be realized. The embodiments of the present application can also perform file backups between terminal devices. For example, a cloud server can be used as a storage device to perform physical backup. Two terminal devices at two locations far apart in space perform file backups.
实施例九:Example 9:
对应于上文实施例的文件备份方法,图8示出了本申请实施例提供的文件备份***的***交互示意图,为了便于说明,仅示出了与本申请实施例相关的部分。Corresponding to the file backup method of the above embodiment, FIG. 8 shows a schematic diagram of system interaction of the file backup system provided by the embodiment of the present application. For ease of description, only the parts related to the embodiment of the present application are shown.
文件备份***,包括:第一终端设备、第二终端设备和存储设备,第一终端设备中安装有第一文件***,第二终端设备中安装有第二文件***。The file backup system includes: a first terminal device, a second terminal device, and a storage device. A first file system is installed in the first terminal device, and a second file system is installed in the second terminal device.
S801,第一终端设备用于,获取待备份文件的文件类型,并根据第一文件***的元数据区中元数据包含的类型标识,从第一文件***的元数据区中,筛选出文件类型对应的目标元数据。S801: The first terminal device is configured to obtain the file type of the file to be backed up, and filter the file type from the metadata area of the first file system according to the type identifier contained in the metadata area of the first file system The corresponding target metadata.
S802,第一终端设备还用于,从第一文件***的文件数据区中,筛选出目标元数据对应的目标文件数据块。S802: The first terminal device is further configured to filter out target file data blocks corresponding to the target metadata from the file data area of the first file system.
S803,第一终端设备还用于,将目标元数据和目标文件数据块发送至存储设备。S803: The first terminal device is further configured to send the target metadata and the target file data block to the storage device.
S804,存储设备用于,对目标元数据和目标文件数据块进行存储,并将目标元数据和目标文件数据块发送至第二终端设备。S804: The storage device is configured to store the target metadata and the target file data block, and send the target metadata and the target file data block to the second terminal device.
S805,第二终端设备用于,将目标元数据恢复至第二文件***的元数据区,以及将目标文件数据块恢复至第二文件***的文件数据区。S805: The second terminal device is configured to restore the target metadata to the metadata area of the second file system, and restore the target file data block to the file data area of the second file system.
本申请实施例提供文件备份***中各终端设备和存储设备实现各自功能的过程,具体可参考前述图7所示实施例八以及其他相关方法实施例的描述,此处不再赘述。The embodiments of the present application provide a process for each terminal device and storage device in the file backup system to realize their respective functions. For details, please refer to the description of the eighth embodiment shown in FIG. 7 and other related method embodiments, which will not be repeated here.
实施例十:Embodiment ten:
图9示出了本申请实施例十提供的文件备份方法的实现流程图,应用于安装有第一文件***的第一终端设备,详述如下:FIG. 9 shows an implementation flowchart of the file backup method provided in the tenth embodiment of the present application, which is applied to the first terminal device with the first file system installed, and the details are as follows:
S901,获取待备份文件的文件类型,并根据第一文件***的元数据区中元数据包含的类型标识,从第一文件***的元数据区中,筛选出文件类型对应的目标元数据。S901: Obtain the file type of the file to be backed up, and filter out the target metadata corresponding to the file type from the metadata area of the first file system according to the type identifier included in the metadata in the metadata area of the first file system.
S902,从第一文件***的文件数据区中,筛选出目标元数据对应的目标文件数据块。S902: Filter out target file data blocks corresponding to the target metadata from the file data area of the first file system.
S903,将目标元数据和目标文件数据块发送至存储设备,以指示存储设备对目标元数据和目标文件数据块进行存储,并将目标元数据恢复至第二文件***的元数据区,以及将目标文件数据块恢复至第二文件***的文件数据区,第二文件***安装于第二终端设备。S903. Send the target metadata and the target file data block to the storage device to instruct the storage device to store the target metadata and the target file data block, restore the target metadata to the metadata area of the second file system, and restore The target file data block is restored to the file data area of the second file system, and the second file system is installed on the second terminal device.
本申请实施例十的文件备份原理与本申请实施例二相同,此处不予详述,具体可参考本申请实施例一和二及其他相关实施例的说明。The file backup principle of the tenth embodiment of the present application is the same as that of the second embodiment of the present application, and will not be described in detail here. For details, please refer to the description of the first and second embodiments of the present application and other related embodiments.
但与本申请实施例二的不同之处在于,在本申请实施例十中,作为执行主体的第一终端设备会与一个存储设备(对应于本申请实施例二,此时第一存储空间就是指该存储设备中的存储空间)直接连接,而该存储设备会和另一个安装有目标***的第二终端设备直接连接,在此基础上,第 一终端设备只需进行目标元数据和目标文件数据块的筛选,并将目标元数据和目标文件数据块发送给存储设备,由存储设备对目标元数据和目标文件数据块存储完成后,发送给安装有目标***的第二终端设备,并将目标元数据和目标文件数据块恢复至第二终端设备中的目标***,因此在本申请实施例十中,具体的目标元数据和目标文件数据块恢复至目标***操作是由存储设备完成。However, the difference from the second embodiment of this application is that, in the tenth embodiment of this application, the first terminal device as the execution subject will be connected to a storage device (corresponding to the second embodiment of this application, at this time the first storage space is Refers to the storage space in the storage device) is directly connected, and the storage device will be directly connected to another second terminal device installed with the target system. On this basis, the first terminal device only needs to perform target metadata and target files The data block is screened, and the target metadata and target file data block are sent to the storage device. After the target metadata and target file data block are stored by the storage device, the target metadata and target file data block are sent to the second terminal device installed with the target system, and The target metadata and target file data blocks are restored to the target system in the second terminal device. Therefore, in the tenth embodiment of the present application, the specific target metadata and target file data blocks are restored to the target system by the storage device.
可以理解地,本申请实施例十同样可以和上述本申请实施例三至五进行结合应用,此时只需将目标元数据和目标文件数据块恢复至目标***的相关操作,分配给本申请实施例十中的存储设备即可,具体可参考上述本申请实施例三至五的说明,此处不予赘述。Understandably, the tenth embodiment of the present application can also be used in combination with the above-mentioned embodiments three to five of the present application. At this time, only the target metadata and target file data blocks need to be restored to the target system and assigned to the implementation of the present application. The storage device in Example 10 is sufficient. For details, please refer to the description of the above-mentioned Embodiments 3 to 5 of this application, which will not be repeated here.
同时应当说明地,与本申请实施例六相比,考虑到实际情况中终端设备直连并进行实时的数据传输和处理时,一方面容易出现数据丢失等问题,此时由于原***可能已经开始了数据清除,从而导致丢失或出错的数据无法进行恢复,另一方面,受到物理空间距离和硬件配置等因素的限制,很多时候两个终端设备难以直接进行连接和数据传输,因此使得本申请实施例六难以实现。为了解决上述问题,本申请实施例十会在两个终端设备之间设置一个存储设备(该存储设备是具有数据恢复的处理能力和存储能力的终端设备),由该存储设备对目标元数据和目标文件数据块进行转存,一方面,使得即使文件备份过程出现了数据丢失等错误,也可以及时从存储设备中恢复,进而提高了目标元数据和目标文件数据块的安全性和可靠性,另一方面,对于由于物理空间距离过远和硬件配置不支持同种设备直连等原因,无法实现终端设备之间直连操作的情况,本申请实施例也可以很好地进行终端设备之间的文件备份,例如,可以通过将云端服务器作为存储设备,来对物理空间距离较远的两个地点处的两台终端设备进行文件备份。At the same time, it should be noted that, compared with the sixth embodiment of the present application, considering that the terminal device is directly connected to perform real-time data transmission and processing in actual situations, problems such as data loss are prone to occur on the one hand. At this time, the original system may have started. The data is cleared, so that the lost or erroneous data cannot be recovered. On the other hand, due to the limitations of physical space distance and hardware configuration, it is often difficult for two terminal devices to directly connect and transmit data, which makes the implementation of this application Example 6 is difficult to achieve. In order to solve the above problems, in the tenth embodiment of the present application, a storage device (the storage device is a terminal device with data recovery processing and storage capabilities) is set between two terminal devices. Data blocks of the target file are dumped. On the one hand, even if errors such as data loss occur in the file backup process, they can be restored from the storage device in time, thereby improving the security and reliability of the target metadata and target file data blocks. On the other hand, for the situation that the direct connection operation between terminal devices cannot be realized due to the excessive physical space distance and the hardware configuration does not support the direct connection of the same kind of devices, the embodiment of the present application can also perform well between the terminal devices. For example, you can use a cloud server as a storage device to back up files on two terminal devices in two locations with a relatively long physical space.
与本申请实施例八相比,本申请实施例十中具体的目标元数据和目标文件数据块恢复至目标***操作是由存储设备完成,其好处在于:可以适应一些数据处理能力较弱的第二终端设备,如对于移动硬盘等特殊的终端设备而言,其仅具备极弱数据处理能力,目标元数据和目标文件数据块恢复操作对其要求过高,因此此时可以由存储设备来实现对第二终端设备的数据写入等操作,以完成对目标元数据和目标文件数据块的恢复。Compared with the eighth embodiment of the present application, the specific target metadata and target file data block recovery to the target system in the tenth embodiment of the present application is completed by the storage device. The advantage is that it can adapt to some weaker data processing capabilities. Second, terminal devices, such as mobile hard disks and other special terminal devices, which only have extremely weak data processing capabilities, and the target metadata and target file data block recovery operations are too demanding, so it can be implemented by storage devices at this time Operations such as writing data to the second terminal device to complete the recovery of target metadata and target file data blocks.
实施例十一:Embodiment 11:
对应于上文实施例十的文件备份方法,图10示出了本申请实施例提供的文件备份***的***交互示意图,为了便于说明,仅示出了与本申请实施例相关的部分。Corresponding to the file backup method of the tenth embodiment above, FIG. 10 shows a schematic diagram of system interaction of the file backup system provided by the embodiment of the present application. For ease of description, only the parts related to the embodiment of the present application are shown.
文件备份***,包括:第一终端设备、第二终端设备和存储设备,第一终端设备中安装有第一文件***,第二终端设备中安装有第二文件***。The file backup system includes: a first terminal device, a second terminal device, and a storage device. A first file system is installed in the first terminal device, and a second file system is installed in the second terminal device.
S1001,第一终端设备用于,获取待备份文件的文件类型,并根据第一文件***的元数据区中元数据包含的类型标识,从第一文件***的元数据区中,筛选出文件类型对应的目标元数据。S1001: The first terminal device is configured to obtain the file type of the file to be backed up, and filter the file type from the metadata area of the first file system according to the type identifier contained in the metadata area of the first file system The corresponding target metadata.
S1002,第一终端设备还用于,从第一文件***的文件数据区中,筛选出目标元数据对应的目标文件数据块。S1002: The first terminal device is further configured to filter out target file data blocks corresponding to the target metadata from the file data area of the first file system.
S1003,第一终端设备还用于,将目标元数据和目标文件数据块发送至存储设备。S1003: The first terminal device is further configured to send the target metadata and the target file data block to the storage device.
S1004,存储设备用于,对目标元数据和目标文件数据块进行存储,并将目标元数据恢复至第二文件***的元数据区,以及将目标文件数据块恢复至第二文件***的文件数据区。S1004. The storage device is used to store the target metadata and the target file data block, restore the target metadata to the metadata area of the second file system, and restore the target file data block to the file data of the second file system Area.
本申请实施例提供文件备份***中各终端设备和存储设备实现各自功能的过程,具体可参考前述图9所示实施例十以及其他相关方法实施例的描述,此处不再赘述。The embodiment of the present application provides a process for each terminal device and storage device in the file backup system to realize their respective functions. For details, please refer to the description of the tenth embodiment shown in FIG. 9 and other related method embodiments, which will not be repeated here.
应当特别说明地,在本申请实施例一至十一中,为了便于理解都是将“原***需要进行数据清除”为背景进行了相关方案说明,但可以理解地,在实际应用中,当原***和目标***分别安 装在两个不同的终端设备时,文件备份本身可以不与原***是否进行数据清除相关联,即此时即使原***不进行数据清除,上述本申请实施例仍可以实现对待备份文件的快速安全备份,以满足不同实际应用场景的需求,因此在此基础上,当原***和目标***分别安装在两个不同的终端设备时,上述本申请实施例一至十一中的原***是可以不进行数据清除的,此时仍可以实现上述本申请实施例一至十一中相关的技术效果。It should be particularly noted that in the first to eleventh embodiments of the present application, for ease of understanding, the “original system needs to be cleared of data” is used as the background to explain the relevant solutions, but it is understandable that in practical applications, when the original system When the target system and the target system are installed on two different terminal devices, the file backup itself may not be related to whether the original system performs data clearing, that is, even if the original system does not perform data clearing, the above embodiments of the present application can still realize the backup to be backed up. Fast and safe backup of files to meet the needs of different practical application scenarios. Therefore, on this basis, when the original system and the target system are installed on two different terminal devices, the original system in the above-mentioned embodiments 1 to 11 of this application It is not necessary to clear the data, and at this time, the related technical effects in the above-mentioned Embodiments 1 to 11 of the present application can still be achieved.
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。It should be understood that the size of the sequence number of each step in the foregoing embodiment does not mean the order of execution. The execution sequence of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application.
对应于上文实施例一至五的文件备份方法,图11示出了本申请实施例提供的文件备份装置的结构框图,为了便于说明,仅示出了与本申请实施例相关的部分。Corresponding to the file backup methods in the first to fifth embodiments above, FIG. 11 shows a structural block diagram of a file backup device provided in an embodiment of the present application. For ease of description, only the parts related to the embodiment of the present application are shown.
参照图11,该文件备份装置包括:Referring to Figure 11, the file backup device includes:
元数据获取模块111,用于获取待备份文件的文件类型,并根据第一文件***的元数据区中元数据包含的类型标识,从第一文件***的元数据区中,筛选出文件类型对应的目标元数据。The metadata obtaining module 111 is used to obtain the file type of the file to be backed up, and filter out the corresponding file type from the metadata area of the first file system according to the type identification contained in the metadata in the metadata area of the first file system Target metadata.
数据块获取模块112,用于从第一文件***的文件数据区中,筛选出目标元数据对应的目标文件数据块。The data block obtaining module 112 is configured to filter out the target file data block corresponding to the target metadata from the file data area of the first file system.
数据恢复模块113,用于将目标元数据恢复至第二文件***的元数据区,以及将目标文件数据块恢复至第二文件***的文件数据区。The data recovery module 113 is used for recovering the target metadata to the metadata area of the second file system, and recovering the target file data block to the file data area of the second file system.
进一步地,数据恢复模块113,包括:Further, the data recovery module 113 includes:
存储模块,用于将目标元数据和目标文件数据块拷贝至第一存储空间。The storage module is used to copy the target metadata and the target file data block to the first storage space.
恢复模块,用于将第一存储空间中的目标元数据拷贝至第二文件***的元数据区,以及将第一存储空间中的目标文件数据块拷贝至第二文件***的文件数据区。The recovery module is used for copying the target metadata in the first storage space to the metadata area of the second file system, and copying the target file data block in the first storage space to the file data area of the second file system.
进一步地,该文件备份装置,还包括:Further, the file backup device further includes:
第一地址获取模块,用于获取目标元数据在第一文件***中的第一存储地址。The first address obtaining module is used to obtain the first storage address of the target metadata in the first file system.
第二地址获取模块,用于获取目标文件数据块在第一文件***中的第二存储地址。The second address obtaining module is used to obtain the second storage address of the target file data block in the first file system.
进一步地,数据恢复模块113,还包括:Further, the data recovery module 113 further includes:
第一类恢复模块,用于若第一文件***与第二文件***的***类型和容量均相同,且第二文件***内未存储数据,按照第一存储地址将目标元数据拷贝至第二文件***的元数据区,并按照第二存储地址将目标文件数据块拷贝至第二文件***的文件数据区。The first type of recovery module is used to copy the target metadata to the second file according to the first storage address if the system type and capacity of the first file system and the second file system are the same, and no data is stored in the second file system The metadata area of the system, and copy the target file data block to the file data area of the second file system according to the second storage address.
进一步地,数据恢复模块113,还包括:Further, the data recovery module 113 further includes:
第一地址转换模块,用于若第一文件***的***类型和第二文件***的***类型相同,且第二文件***和第一文件***的容量不相同,和/或,第二文件***内存储有数据,对第一存储地址进行地址转换得到第三存储地址,并对第二存储地址进行转换得到第四存储地址。The first address conversion module is used if the system type of the first file system and the system type of the second file system are the same, and the capacities of the second file system and the first file system are different, and/or, in the second file system Data is stored, address conversion is performed on the first storage address to obtain a third storage address, and the second storage address is converted to obtain a fourth storage address.
第二类恢复模块,用于按照第三存储地址将目标元数据拷贝至第二文件***的元数据区,并按照第四存储地址将目标文件数据块拷贝至第二文件***的文件数据区。The second type of recovery module is used to copy the target metadata to the metadata area of the second file system according to the third storage address, and copy the target file data block to the file data area of the second file system according to the fourth storage address.
进一步地,数据恢复模块113,还包括:数据转换模块,用于若第一文件***的***类型和第二文件***的***类型不相同,对目标元数据和目标文件数据块进行格式转换。Further, the data recovery module 113 further includes: a data conversion module, configured to perform format conversion on the target metadata and the target file data block if the system type of the first file system and the system type of the second file system are different.
第二地址转换模块,用于对第一存储地址进行地址转换得到第五存储地址,并对第二存储地址进行转换得到第六存储地址。The second address conversion module is configured to perform address conversion on the first storage address to obtain a fifth storage address, and perform conversion on the second storage address to obtain a sixth storage address.
第三类恢复模块,用于按照第五存储地址,将格式转换后的目标元数据拷贝至第二文件***的元数据区,并按照第六存储地址,将格式转换后的目标文件数据块拷贝至第二文件***的文件 数据区。The third type of recovery module is used to copy the target metadata after format conversion to the metadata area of the second file system according to the fifth storage address, and copy the target file data block after format conversion according to the sixth storage address To the file data area of the second file system.
进一步地,第二类恢复模块,包括:Further, the second type of recovery module includes:
地址索引更新模块,用于若目标文件数据块中包含地址索引字段,根据第二储存地址和第四存储地址更新地址索引字段,并按照第四存储地址,将更新后的目标文件数据块拷贝至第二文件***的文件数据区,地址索引字段用于存储一个或多个目标文件数据块的存储地址。The address index update module is used to update the address index field according to the second storage address and the fourth storage address if the target file data block contains the address index field, and copy the updated target file data block to the fourth storage address according to the fourth storage address In the file data area of the second file system, the address index field is used to store the storage addresses of one or more target file data blocks.
进一步地,地址索引更新模块,包括:数据块解密模块,用于若目标文件数据块中包含地址索引字段且目标文件数据块被加密,对目标文件数据块进行解密,得到解密后的地址索引字段。Further, the address index update module includes: a data block decryption module for decrypting the target file data block if the target file data block contains an address index field and the target file data block is encrypted to obtain the decrypted address index field .
索引更新加密模块,用于根据第二存储地址和第四存储地址更新解密后的地址索引字段,并对更新后的目标文件数据块进行加密。The index update encryption module is used to update the decrypted address index field according to the second storage address and the fourth storage address, and to encrypt the updated target file data block.
需要说明的是,上述装置/单元之间的信息交互、执行过程等内容,由于与本申请方法实施例一至五基于同一构思,其具体功能及带来的技术效果,具体可参见方法实施例一至五部分,此处不再赘述。It should be noted that the information interaction and execution process between the above-mentioned devices/units are based on the same concept as the method embodiments 1 to 5 of this application, and their specific functions and technical effects can be found in the method embodiments 1 to 5. The five parts are not repeated here.
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将所述装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。实施例中的各功能单元、模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中,上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。另外,各功能单元、模块的具体名称也只是为了便于相互区分,并不用于限制本申请的保护范围。上述***中单元、模块的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and conciseness of description, only the division of the above functional units and modules is used as an example. In practical applications, the above functions can be allocated to different functional units and modules as required. Module completion, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist alone physically, or two or more units can be integrated into one unit. The above-mentioned integrated units can be hardware-based Formal realization can also be realized in the form of a software functional unit. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the present application. For the specific working process of the units and modules in the foregoing system, reference may be made to the corresponding process in the foregoing method embodiment, which will not be repeated here.
图12是本申请一实施例提供的终端设备的结构示意图。如图12所示,该实施例的终端设备12包括:至少一个处理器120(图12中仅示出一个)、存储器121,所述存储器121中存储有可在所述处理器120上运行的计算机程序122。所述处理器120执行所述计算机程序122时实现上述各个文件备份方法实施例中的步骤,例如图1所示的步骤101至103。或者,所述处理器120执行所述计算机程序122时实现上述各装置实施例中各模块/单元的功能,例如图10所示模块121至123的功能。FIG. 12 is a schematic structural diagram of a terminal device provided by an embodiment of the present application. As shown in FIG. 12, the terminal device 12 of this embodiment includes: at least one processor 120 (only one is shown in FIG. 12), and a memory 121. Computer program 122. When the processor 120 executes the computer program 122, the steps in the above-mentioned file backup method embodiments, such as steps 101 to 103 shown in FIG. 1, are implemented. Alternatively, when the processor 120 executes the computer program 122, the functions of the modules/units in the foregoing device embodiments, for example, the functions of the modules 121 to 123 shown in FIG.
所述终端设备12可以是手机、平板电脑、桌上型计算机、笔记本、掌上电脑及云端服务器等计算设备。所述终端设备可包括,但不仅限于,处理器120、存储器121。本领域技术人员可以理解,图12仅仅是终端设备12的示例,并不构成对终端设备12的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件,例如所述终端设备还可以包括输入发送设备、网络接入设备、总线等。The terminal device 12 may be a computing device such as a mobile phone, a tablet computer, a desktop computer, a notebook, a palmtop computer, and a cloud server. The terminal device may include, but is not limited to, a processor 120 and a memory 121. Those skilled in the art can understand that FIG. 12 is only an example of the terminal device 12, and does not constitute a limitation on the terminal device 12. It may include more or less components than those shown in the figure, or a combination of certain components, or different components. For example, the terminal device may also include an input sending device, a network access device, a bus, and the like.
所称处理器120可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器(Digital Signal Processor,DSP)、专用集成电路(Application Specific Integrated Circuit,ASIC)、现成可编程门阵列(Field-Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。The so-called processor 120 may be a central processing unit (Central Processing Unit, CPU), or other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), Ready-made programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like.
所述存储器121在一些实施例中可以是所述终端设备12的内部存储单元,例如终端设备12的硬盘或内存。所述存储器121也可以是所述终端设备12的外部存储设备,例如所述终端设备12上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD) 卡,闪存卡(Flash Card)等。进一步地,所述存储器121还可以既包括所述终端设备12的内部存储单元也包括外部存储设备。所述存储器121用于存储操作***、应用程序、引导装载程序(BootLoader)、数据以及其他程序等,例如所述计算机程序的程序代码等。所述存储器121还可以用于暂时地存储已经发送或者将要发送的数据。The memory 121 may be an internal storage unit of the terminal device 12 in some embodiments, such as a hard disk or a memory of the terminal device 12. The memory 121 may also be an external storage device of the terminal device 12, such as a plug-in hard disk equipped on the terminal device 12, a smart memory card (Smart Media Card, SMC), or a Secure Digital (SD). Card, Flash Card, etc. Further, the memory 121 may also include both an internal storage unit of the terminal device 12 and an external storage device. The memory 121 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of the computer program. The memory 121 may also be used to temporarily store data that has been sent or will be sent.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or software functional unit.
本申请实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行时实现可实现上述各个方法实施例中的步骤。The embodiments of the present application also provide a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in each of the foregoing method embodiments can be realized.
本申请实施例提供了一种计算机程序产品,当计算机程序产品在移动终端上运行时,使得移动终端执行时实现可实现上述各个方法实施例中的步骤。The embodiments of the present application provide a computer program product. When the computer program product runs on a mobile terminal, the steps in the foregoing method embodiments can be realized when the mobile terminal is executed.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实现上述实施例方法中的全部或部分流程,可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个方法实施例的步骤。其中,所述计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质至少可以包括:能够将计算机程序代码携带到拍照装置/终端设备的任何实体或装置、记录介质、计算机存储器、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、电载波信号、电信信号以及软件分发介质。例如U盘、移动硬盘、磁碟或者光盘等。在某些司法管辖区,根据立法和专利实践,计算机可读介质不可以是电载波信号和电信信号。If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on this understanding, the implementation of all or part of the processes in the above-mentioned embodiment methods in the present application can be accomplished by instructing relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. The computer program can be stored in a computer-readable storage medium. When executed by the processor, the steps of the foregoing method embodiments can be implemented. Wherein, the computer program includes computer program code, and the computer program code may be in the form of source code, object code, executable file, or some intermediate forms. The computer-readable medium may at least include: any entity or device capable of carrying the computer program code to the photographing device/terminal device, recording medium, computer memory, read-only memory (ROM, Read-Only Memory), and random access memory (RAM, Random Access Memory), electric carrier signal, telecommunications signal and software distribution medium. For example, U disk, mobile hard disk, floppy disk or CD-ROM, etc. In some jurisdictions, according to legislation and patent practices, computer-readable media cannot be electrical carrier signals and telecommunication signals.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述或记载的部分,可以参见其它实施例的相关描述。In the above-mentioned embodiments, the description of each embodiment has its own focus. For parts that are not described in detail or recorded in an embodiment, reference may be made to related descriptions of other embodiments.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。A person of ordinary skill in the art may realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be implemented by electronic hardware or a combination of computer software and electronic hardware. Whether these functions are executed by hardware or software depends on the specific application and design constraint conditions of the technical solution. Professionals and technicians can use different methods for each specific application to implement the described functions, but such implementation should not be considered beyond the scope of this application.
在本申请所提供的实施例中,应该理解到,所揭露的装置/终端设备和方法,可以通过其它的方式实现。例如,以上所描述的装置/终端设备实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个***,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通讯连接可以是通过一些接口,装置或单元的间接耦合或通讯连接,可以是电性,机械或其它的形式。In the embodiments provided in this application, it should be understood that the disclosed device/terminal device and method may be implemented in other ways. For example, the device/terminal device embodiments described above are merely illustrative. For example, the division of the modules or units is only a logical function division, and there may be other divisions in actual implementation, such as multiple units. Or components can be combined or integrated into another system, or some features can be omitted or not implemented. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技 术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。The above-mentioned embodiments are only used to illustrate the technical solutions of the present application, not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, a person of ordinary skill in the art should understand that it can still implement the foregoing The technical solutions recorded in the examples are modified, or some of the technical features are equivalently replaced; these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the application, and should be included in Within the scope of protection of this application.

Claims (18)

  1. 一种文件备份方法,其特征在于,包括:A file backup method, characterized in that it comprises:
    获取待备份文件的文件类型,并根据第一文件***的元数据区中元数据包含的类型标识,从所述第一文件***的元数据区中,筛选出所述文件类型对应的目标元数据;Obtain the file type of the file to be backed up, and filter out the target metadata corresponding to the file type from the metadata area of the first file system according to the type identifier contained in the metadata area of the first file system ;
    从所述第一文件***的文件数据区中,筛选出所述目标元数据对应的目标文件数据块;Filtering out target file data blocks corresponding to the target metadata from the file data area of the first file system;
    将所述目标元数据恢复至第二文件***的元数据区,以及将所述目标文件数据块恢复至所述第二文件***的文件数据区。The target metadata is restored to the metadata area of the second file system, and the target file data block is restored to the file data area of the second file system.
  2. 如权利要求1所述的文件备份方法,其特征在于,所述将所述目标元数据恢复至第二文件***的元数据区,以及将所述目标文件数据块恢复至所述第二文件***的文件数据区,包括:2. The file backup method of claim 1, wherein the target metadata is restored to the metadata area of the second file system, and the target file data block is restored to the second file system The file data area includes:
    将所述目标元数据和所述目标文件数据块拷贝至第一存储空间;Copy the target metadata and the target file data block to the first storage space;
    将所述第一存储空间中的所述目标元数据拷贝至所述第二文件***的元数据区,以及将所述第一存储空间中的所述目标文件数据块拷贝至所述第二文件***的文件数据区。Copy the target metadata in the first storage space to the metadata area of the second file system, and copy the target file data block in the first storage space to the second file The file data area of the system.
  3. 如权利要求1或2所述的文件备份方法,其特征在于,在所述将所述目标元数据恢复至第二文件***的元数据区,以及将所述目标文件数据块恢复至所述第二文件***的文件数据区之前,还包括:The file backup method according to claim 1 or 2, wherein in the step of restoring the target metadata to the metadata area of the second file system, and restoring the target file data block to the first file system Before the file data area of the second file system, it also includes:
    获取所述目标元数据在所述第一文件***中的第一存储地址;获取所述目标文件数据块在所述第一文件***中的第二存储地址;Acquiring a first storage address of the target metadata in the first file system; acquiring a second storage address of the target file data block in the first file system;
    所述将所述目标元数据恢复至第二文件***的元数据区,以及将所述目标文件数据块恢复至所述第二文件***的文件数据区,包括:The restoring the target metadata to the metadata area of the second file system and restoring the target file data block to the file data area of the second file system includes:
    若所述第一文件***与所述第二文件***的***类型和容量均相同,且所述第二文件***内未存储数据,按照所述第一存储地址将所述目标元数据拷贝至所述第二文件***的元数据区,并按照所述第二存储地址将所述目标文件数据块拷贝至所述第二文件***的文件数据区。If the system type and capacity of the first file system and the second file system are the same, and no data is stored in the second file system, the target metadata is copied to all the files according to the first storage address. The metadata area of the second file system, and copy the target file data block to the file data area of the second file system according to the second storage address.
  4. 如权利要求1或2所述的文件备份方法,其特征在于,在所述将所述目标元数据恢复至第二文件***的元数据区,以及将所述目标文件数据块恢复至所述第二文件***的文件数据区之前,还包括:The file backup method according to claim 1 or 2, wherein in the step of restoring the target metadata to the metadata area of the second file system, and restoring the target file data block to the first file system Before the file data area of the second file system, it also includes:
    获取所述目标元数据在所述第一文件***中的第一存储地址;获取所述目标文件数据块在所述第一文件***中的第二存储地址;Acquiring a first storage address of the target metadata in the first file system; acquiring a second storage address of the target file data block in the first file system;
    所述将所述目标元数据恢复至第二文件***的元数据区,以及将所述目标文件数据块恢复至所述第二文件***的文件数据区,包括:The restoring the target metadata to the metadata area of the second file system and restoring the target file data block to the file data area of the second file system includes:
    若所述第一文件***的***类型和第二文件***的***类型相同,且所述第二文件***和所述第一文件***的容量不相同,和/或,所述第二文件***内存储有数据,对所述第一存储地址进行地址转换得到第三存储地址,并对所述第二存储地址进行转换得到第四存储地址;If the system type of the first file system and the system type of the second file system are the same, and the capacities of the second file system and the first file system are not the same, and/or, in the second file system Data is stored, address conversion is performed on the first storage address to obtain a third storage address, and the second storage address is converted to obtain a fourth storage address;
    按照所述第三存储地址将所述目标元数据拷贝至所述第二文件***的元数据区,并按照所述第四存储地址将所述目标文件数据块拷贝至所述第二文件***的文件数据区。Copy the target metadata to the metadata area of the second file system according to the third storage address, and copy the target file data block to the second file system according to the fourth storage address File data area.
  5. 如权利要求1或2所述的文件备份方法,其特征在于,在所述将所述目标元数据恢复至第二文件***的元数据区,以及将所述目标文件数据块恢复至所述第二文件***的文件数据区之前,还包括:The file backup method according to claim 1 or 2, wherein in the step of restoring the target metadata to the metadata area of the second file system, and restoring the target file data block to the first file system Before the file data area of the second file system, it also includes:
    获取所述目标元数据在所述第一文件***中的第一存储地址;获取所述目标文件数据块在所述第一文件***中的第二存储地址;Acquiring a first storage address of the target metadata in the first file system; acquiring a second storage address of the target file data block in the first file system;
    所述将所述目标元数据恢复至第二文件***的元数据区,以及将所述目标文件数据块恢复至所述第二文件***的文件数据区,包括:The restoring the target metadata to the metadata area of the second file system and restoring the target file data block to the file data area of the second file system includes:
    若所述第一文件***的***类型和第二文件***的***类型不相同,对所述目标元数据和所述目标文件数据块进行格式转换;对所述第一存储地址进行地址转换得到第五存储地址,并对所述第二存储地址进行转换得到第六存储地址;If the system type of the first file system and the system type of the second file system are not the same, format the target metadata and the target file data block; perform address conversion on the first storage address to obtain the first 5. A storage address, and converting the second storage address to obtain a sixth storage address;
    按照所述第五存储地址,将格式转换后的所述目标元数据拷贝至所述第二文件***的元数据区,并按照所述第六存储地址,将格式转换后的所述目标文件数据块拷贝至所述第二文件***的文件数据区。Copy the target metadata after the format conversion to the metadata area of the second file system according to the fifth storage address, and convert the target file data after the format conversion according to the sixth storage address The block is copied to the file data area of the second file system.
  6. 如权利要求3或5所述的文件备份方法,其特征在于,还包括:The file backup method according to claim 3 or 5, further comprising:
    若所述第一文件***的***类型和第二文件***的***类型相同,且所述第二文件***和所述第一文件***的容量不相同,和/或,所述第二文件***内存储有数据,对所述第一存储地址进行地址转换得到第三存储地址,并对所述第二存储地址进行转换得到第四存储地址;If the system type of the first file system and the system type of the second file system are the same, and the capacities of the second file system and the first file system are not the same, and/or, in the second file system Data is stored, address conversion is performed on the first storage address to obtain a third storage address, and the second storage address is converted to obtain a fourth storage address;
    按照所述第三存储地址将所述目标元数据拷贝至所述第二文件***的元数据区,并按照所述第四存储地址将所述目标文件数据块拷贝至所述第二文件***的文件数据区。Copy the target metadata to the metadata area of the second file system according to the third storage address, and copy the target file data block to the second file system according to the fourth storage address File data area.
  7. 如权利要求3或6所述的文件备份方法,其特征在于,还包括:The file backup method according to claim 3 or 6, characterized in that it further comprises:
    若所述第一文件***的***类型和第二文件***的***类型不相同,对所述目标元数据和所述目标文件数据块进行格式转换;对所述第一存储地址进行地址转换得到第五存储地址,并对所述第二存储地址进行转换得到第六存储地址;If the system type of the first file system and the system type of the second file system are not the same, format the target metadata and the target file data block; perform address conversion on the first storage address to obtain the first 5. A storage address, and converting the second storage address to obtain a sixth storage address;
    按照所述第五存储地址,将格式转换后的所述目标元数据拷贝至所述第二文件***的元数据区,并按照所述第六存储地址,将格式转换后的所述目标文件数据块拷贝至所述第二文件***的文件数据区。Copy the target metadata after the format conversion to the metadata area of the second file system according to the fifth storage address, and convert the target file data after the format conversion according to the sixth storage address The block is copied to the file data area of the second file system.
  8. 如权利要求4或6所述的文件备份方法,其特征在于,所述按照所述第四存储地址将所述目标文件数据块拷贝至所述第二文件***的文件数据区,包括:The file backup method according to claim 4 or 6, wherein the copying the target file data block to the file data area of the second file system according to the fourth storage address comprises:
    若所述目标文件数据块中包含地址索引字段,根据所述第二储存地址和所述第四存储地址更新所述地址索引字段,并按照所述第四存储地址,将更新后的所述目标文件数据块拷贝至所述第二文件***的文件数据区,所述地址索引字段用于存储一个或多个目标文件数据块的存储地址。If the target file data block contains an address index field, the address index field is updated according to the second storage address and the fourth storage address, and the updated target is updated according to the fourth storage address. The file data block is copied to the file data area of the second file system, and the address index field is used to store the storage addresses of one or more target file data blocks.
  9. 如权利要求8所述的文件备份方法,其特征在于,所述若所述目标文件数据块中包含地址索引字段,根据所述第二储存地址和所述第四存储地址更新所述地址索引字段,包括:The file backup method according to claim 8, wherein if the target file data block contains an address index field, the address index field is updated according to the second storage address and the fourth storage address ,include:
    若所述目标文件数据块中包含地址索引字段且所述目标文件数据块被加密,对所述目标文件数据块进行解密,得到解密后的所述地址索引字段;If the target file data block contains an address index field and the target file data block is encrypted, decrypt the target file data block to obtain the decrypted address index field;
    根据所述第二存储地址和所述第四存储地址更新解密后的所述地址索引字段,并对更新后的所述目标文件数据块进行加密。Update the decrypted address index field according to the second storage address and the fourth storage address, and encrypt the updated target file data block.
  10. 一种文件备份装置,其特征在于,包括:A file backup device, characterized in that it comprises:
    元数据获取模块,用于获取待备份文件的文件类型,并根据第一文件***的元数据区中元数据包含的类型标识,从所述第一文件***的元数据区中,筛选出所述文件类型对应的目标元数据;The metadata obtaining module is used to obtain the file type of the file to be backed up, and filter out the file type from the metadata area of the first file system according to the type identifier contained in the metadata area of the first file system. Target metadata corresponding to the file type;
    数据块获取模块,用于从所述第一文件***的文件数据区中,筛选出所述目标元数据对应的目标文件数据块;A data block acquisition module, configured to filter out target file data blocks corresponding to the target metadata from the file data area of the first file system;
    数据恢复模块,用于将所述目标元数据恢复至第二文件***的元数据区,以及将所述目标文件数据块恢复至所述第二文件***的文件数据区。The data recovery module is used for recovering the target metadata to the metadata area of the second file system, and recovering the target file data block to the file data area of the second file system.
  11. 一种文件备份方法,其特征在于,应用于安装有第一文件***的第一终端设备,所述文件备份方法包括:A file backup method, characterized in that it is applied to a first terminal device with a first file system installed, and the file backup method includes:
    获取待备份文件的文件类型,并根据所述第一文件***的元数据区中元数据包含的类型标识,从所述第一文件***的元数据区中,筛选出所述文件类型对应的目标元数据;Obtain the file type of the file to be backed up, and filter out the target corresponding to the file type from the metadata area of the first file system according to the type identifier contained in the metadata in the metadata area of the first file system Metadata
    从所述第一文件***的文件数据区中,筛选出所述目标元数据对应的目标文件数据块;Filtering out target file data blocks corresponding to the target metadata from the file data area of the first file system;
    将所述目标元数据和所述目标文件数据块发送至安装有第二文件***的第二终端设备,以指示所述第二终端设备将所述目标元数据恢复至第二文件***的元数据区,以及将所述目标文件数据块恢复至所述第二文件***的文件数据区。Send the target metadata and the target file data block to a second terminal device installed with a second file system to instruct the second terminal device to restore the target metadata to the metadata of the second file system Area, and restore the target file data block to the file data area of the second file system.
  12. 一种文件备份***,其特征在于,包括:第一终端设备和第二终端设备,所述第一终端设备中安装有第一文件***,所述第二终端设备中安装有第二文件***;A file backup system, characterized by comprising: a first terminal device and a second terminal device, wherein a first file system is installed in the first terminal device, and a second file system is installed in the second terminal device;
    所述第一终端设备用于,获取待备份文件的文件类型,并根据所述第一文件***的元数据区中元数据包含的类型标识,从所述第一文件***的元数据区中,筛选出所述文件类型对应的目标元数据;The first terminal device is configured to obtain the file type of the file to be backed up, and from the metadata area of the first file system according to the type identifier included in the metadata in the metadata area of the first file system, Filter out the target metadata corresponding to the file type;
    所述第一终端设备还用于,从所述第一文件***的文件数据区中,筛选出所述目标元数据对应的目标文件数据块;The first terminal device is further configured to filter out target file data blocks corresponding to the target metadata from the file data area of the first file system;
    所述第一终端设备还用于,将所述目标元数据和所述目标文件数据块发送至所述第二终端设备;The first terminal device is further configured to send the target metadata and the target file data block to the second terminal device;
    所述第二终端设备用于,将所述目标元数据恢复至所述第二文件***的元数据区,以及将所述目标文件数据块恢复至所述第二文件***的文件数据区。The second terminal device is configured to restore the target metadata to the metadata area of the second file system, and restore the target file data block to the file data area of the second file system.
  13. 一种文件备份方法,其特征在于,应用于安装有第一文件***的第一终端设备,所述文件备份方法包括:A file backup method, characterized in that it is applied to a first terminal device with a first file system installed, and the file backup method includes:
    获取待备份文件的文件类型,并根据所述第一文件***的元数据区中元数据包含的类型标识,从所述第一文件***的元数据区中,筛选出所述文件类型对应的目标元数据;Obtain the file type of the file to be backed up, and filter out the target corresponding to the file type from the metadata area of the first file system according to the type identifier contained in the metadata in the metadata area of the first file system Metadata
    从所述第一文件***的文件数据区中,筛选出所述目标元数据对应的目标文件数据块;Filtering out target file data blocks corresponding to the target metadata from the file data area of the first file system;
    将所述目标元数据和所述目标文件数据块发送至存储设备,以指示所述存储设备,对所述目标元数据和所述目标文件数据块进行存储,并将所述目标元数据和所述目标文件数据块发送至安装有第二文件***的第二终端设备,通过所述第二终端设备将所述目标元数据恢复至第二文件***的元数据区,以及将所述目标文件数据块恢复至所述第二文件***的文件数据区。Send the target metadata and the target file data block to a storage device to instruct the storage device to store the target metadata and the target file data block, and combine the target metadata and the target file data block. The target file data block is sent to a second terminal device installed with a second file system, the target metadata is restored to the metadata area of the second file system through the second terminal device, and the target file data The block is restored to the file data area of the second file system.
  14. 一种文件备份***,其特征在于,包括:第一终端设备、第二终端设备和存储设备,所述第一终端设备中安装有第一文件***,所述第二终端设备中安装有第二文件***;A file backup system, characterized by comprising: a first terminal device, a second terminal device, and a storage device. A first file system is installed in the first terminal device, and a second terminal device is installed in the second terminal device. File system;
    所述第一终端设备用于,获取待备份文件的文件类型,并根据所述第一文件***的元数据区中元数据包含的类型标识,从所述第一文件***的元数据区中,筛选出所述文件类型对应的目标元数据;The first terminal device is configured to obtain the file type of the file to be backed up, and from the metadata area of the first file system according to the type identifier included in the metadata in the metadata area of the first file system, Filter out the target metadata corresponding to the file type;
    所述第一终端设备还用于,从所述第一文件***的文件数据区中,筛选出所述目标元数据对应的目标文件数据块;The first terminal device is further configured to filter out target file data blocks corresponding to the target metadata from the file data area of the first file system;
    所述第一终端设备还用于,将所述目标元数据和所述目标文件数据块发送至所述存储设备;The first terminal device is further configured to send the target metadata and the target file data block to the storage device;
    所述存储设备用于,对所述目标元数据和所述目标文件数据块进行存储,并将所述目标元数据和所述目标文件数据块发送至所述第二终端设备;The storage device is configured to store the target metadata and the target file data block, and send the target metadata and the target file data block to the second terminal device;
    所述第二终端设备用于,将所述目标元数据恢复至第二文件***的元数据区,以及将所述目 标文件数据块恢复至所述第二文件***的文件数据区。The second terminal device is configured to restore the target metadata to the metadata area of the second file system, and restore the target file data block to the file data area of the second file system.
  15. 一种文件备份方法,其特征在于,应用于安装有第一文件***的第一终端设备,包括:A file backup method, characterized in that it is applied to a first terminal device with a first file system installed, and includes:
    获取待备份文件的文件类型,并根据所述第一文件***的元数据区中元数据包含的类型标识,从所述第一文件***的元数据区中,筛选出所述文件类型对应的目标元数据;Obtain the file type of the file to be backed up, and filter out the target corresponding to the file type from the metadata area of the first file system according to the type identifier contained in the metadata in the metadata area of the first file system Metadata
    从所述第一文件***的文件数据区中,筛选出所述目标元数据对应的目标文件数据块;Filtering out target file data blocks corresponding to the target metadata from the file data area of the first file system;
    将所述目标元数据和所述目标文件数据块发送至存储设备,以指示所述存储设备对所述目标元数据和所述目标文件数据块进行存储,并将所述目标元数据恢复至第二文件***的元数据区,以及将所述目标文件数据块恢复至所述第二文件***的文件数据区,所述第二文件***安装于第二终端设备。Send the target metadata and the target file data block to a storage device to instruct the storage device to store the target metadata and the target file data block, and restore the target metadata to the first Two metadata areas of the file system, and the file data area of the second file system that restores the target file data block to the second file system, and the second file system is installed in a second terminal device.
  16. 一种文件备份***,其特征在于,包括:第一终端设备、第二终端设备和存储设备,所述第一终端设备中安装有第一文件***,所述第二终端设备中安装有第二文件***;A file backup system, characterized by comprising: a first terminal device, a second terminal device, and a storage device. A first file system is installed in the first terminal device, and a second terminal device is installed in the second terminal device. File system;
    所述第一终端设备用于,获取待备份文件的文件类型,并根据所述第一文件***的元数据区中元数据包含的类型标识,从所述第一文件***的元数据区中,筛选出所述文件类型对应的目标元数据;The first terminal device is configured to obtain the file type of the file to be backed up, and from the metadata area of the first file system according to the type identifier included in the metadata in the metadata area of the first file system, Filter out the target metadata corresponding to the file type;
    所述第一终端设备还用于,从所述第一文件***的文件数据区中,筛选出所述目标元数据对应的目标文件数据块;The first terminal device is further configured to filter out target file data blocks corresponding to the target metadata from the file data area of the first file system;
    所述第一终端设备还用于,将所述目标元数据和所述目标文件数据块发送至所述存储设备;The first terminal device is further configured to send the target metadata and the target file data block to the storage device;
    所述存储设备用于,对所述目标元数据和所述目标文件数据块进行存储,并将所述目标元数据恢复至第二文件***的元数据区,以及将所述目标文件数据块恢复至所述第二文件***的文件数据区。The storage device is configured to store the target metadata and the target file data block, restore the target metadata to the metadata area of the second file system, and restore the target file data block To the file data area of the second file system.
  17. 一种终端设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机程序,其特征在于,所述处理器执行所述计算机程序时实现如权利要求1至9任一项所述的方法。A terminal device, comprising a memory, a processor, and a computer program stored in the memory and capable of running on the processor, wherein the processor executes the computer program as claimed in claims 1 to 9. The method of any one of.
  18. 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现如权利要求1至9任一项所述的方法。A computer-readable storage medium storing a computer program, wherein the computer program implements the method according to any one of claims 1 to 9 when the computer program is executed by a processor.
PCT/CN2020/125521 2019-12-28 2020-10-30 File backup method and apparatus, and terminal device WO2021129151A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201911384164.8A CN111176896A (en) 2019-12-28 2019-12-28 File backup method and device and terminal equipment
CN201911384164.8 2019-12-28

Publications (1)

Publication Number Publication Date
WO2021129151A1 true WO2021129151A1 (en) 2021-07-01

Family

ID=70655874

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/125521 WO2021129151A1 (en) 2019-12-28 2020-10-30 File backup method and apparatus, and terminal device

Country Status (2)

Country Link
CN (1) CN111176896A (en)
WO (1) WO2021129151A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114328030A (en) * 2022-03-03 2022-04-12 成都云祺科技有限公司 File data backup method, system and storage medium

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111176896A (en) * 2019-12-28 2020-05-19 华为技术有限公司 File backup method and device and terminal equipment
CN112286879B (en) * 2020-07-15 2021-08-13 上海柯林布瑞信息技术有限公司 Metadata-based data asset construction method and device
CN117331486A (en) * 2022-06-27 2024-01-02 中兴通讯股份有限公司 Backup storage device, metadata management method, metadata management device and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102508740A (en) * 2011-10-26 2012-06-20 上海文广互动电视有限公司 Remote replication method of file system
CN103577528A (en) * 2012-08-07 2014-02-12 国际商业机器公司 A data migration system and method for migrating data objects
CN108897822A (en) * 2018-06-21 2018-11-27 郑州云海信息技术有限公司 A kind of data-updating method, device, equipment and readable storage medium storing program for executing
CN109491618A (en) * 2018-11-20 2019-03-19 上海科技大学 Data management system, method, terminal and medium based on mixing storage
US20190138386A1 (en) * 2017-11-03 2019-05-09 EMC IP Holding Company LLC Recovering log-structured filesystems from physical replicas
CN110008062A (en) * 2019-03-28 2019-07-12 维沃移动通信有限公司 A kind of data managing method and mobile terminal
CN111176896A (en) * 2019-12-28 2020-05-19 华为技术有限公司 File backup method and device and terminal equipment

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8126847B1 (en) * 2008-04-30 2012-02-28 Network Appliance, Inc. Single file restore from image backup by using an independent block list for each file
CN108733507B (en) * 2017-04-17 2021-10-08 伊姆西Ip控股有限责任公司 Method and device for file backup and recovery

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102508740A (en) * 2011-10-26 2012-06-20 上海文广互动电视有限公司 Remote replication method of file system
CN103577528A (en) * 2012-08-07 2014-02-12 国际商业机器公司 A data migration system and method for migrating data objects
US20190138386A1 (en) * 2017-11-03 2019-05-09 EMC IP Holding Company LLC Recovering log-structured filesystems from physical replicas
CN108897822A (en) * 2018-06-21 2018-11-27 郑州云海信息技术有限公司 A kind of data-updating method, device, equipment and readable storage medium storing program for executing
CN109491618A (en) * 2018-11-20 2019-03-19 上海科技大学 Data management system, method, terminal and medium based on mixing storage
CN110008062A (en) * 2019-03-28 2019-07-12 维沃移动通信有限公司 A kind of data managing method and mobile terminal
CN111176896A (en) * 2019-12-28 2020-05-19 华为技术有限公司 File backup method and device and terminal equipment

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114328030A (en) * 2022-03-03 2022-04-12 成都云祺科技有限公司 File data backup method, system and storage medium

Also Published As

Publication number Publication date
CN111176896A (en) 2020-05-19

Similar Documents

Publication Publication Date Title
WO2021129151A1 (en) File backup method and apparatus, and terminal device
US20200226100A1 (en) Metadata query method and apparatus
US9836244B2 (en) System and method for resource sharing across multi-cloud arrays
US10430398B2 (en) Data storage system having mutable objects incorporating time
US9792306B1 (en) Data transfer between dissimilar deduplication systems
US8250033B1 (en) Replication of a data set using differential snapshots
US8433863B1 (en) Hybrid method for incremental backup of structured and unstructured files
US12001452B2 (en) Search and analytics for storage systems
US9305049B2 (en) Addressing cross-allocated blocks in a file system
US20120278580A1 (en) Data storage reclamation systems and methods
US9921765B2 (en) Partial snapshots in virtualized environments
US8572338B1 (en) Systems and methods for creating space-saving snapshots
US9749193B1 (en) Rule-based systems for outcome-based data protection
CN113157487A (en) Data recovery method and apparatus thereof
US20220398220A1 (en) Systems and methods for physical capacity estimation of logical space units
US8850126B2 (en) Exclusive access during a critical sub-operation to enable simultaneous operations
US9830471B1 (en) Outcome-based data protection using multiple data protection systems
US8281096B1 (en) Systems and methods for creating snapshots
US11645333B1 (en) Garbage collection integrated with physical file verification
CN112380174B (en) XFS file system analysis method containing deleted files, terminal device and storage medium
US10592527B1 (en) Techniques for duplicating deduplicated data
US10614044B2 (en) Systems and methods for performing data object renaming operations
CN117951094A (en) Storage space recycling method, file system, medium and computing device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20908074

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20908074

Country of ref document: EP

Kind code of ref document: A1