Data backup and recovery method and device, electronic equipment and storage medium
By splitting files into file blocks and calculating hash values, and storing them in corresponding directories for incremental backup, the problem of low data backup efficiency in existing technologies is solved, the integrity and effectiveness of data recovery are achieved, the technical challenges of data recovery in existing technologies are resolved, and the technical application of data backup technology is realized.
Patent Information
- Application Number
- CN202511612733.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-06
- Publication Date
- 2025-12-05
AI Technical Summary
Existing data backup methods are inefficient and prone to data recovery errors. In particular, file backup based on file systems is time-consuming, while backup based on disk blocks is incomplete and prone to creating zombie blocks.
The file to be backed up is divided into multiple file blocks and the hash value of each file block is calculated. These blocks are stored in the corresponding storage directory for incremental backup. Incremental backup is performed on the file blocks in the storage directory based on the hash value filtering strategy. Data recovery is performed based on the hash value filtering measures for each file block.
It improves data backup efficiency, ensures the integrity of data recovery, avoids the occurrence of zombie blocks, and improves the accuracy and efficiency of data recovery.
Smart Images

Figure CN121070697A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of databases, and in particular to a data backup and recovery method and device, an electronic device, and a storage medium. BACKGROUND
[0002] A database is an important component of data-centric applications, which can store and process a large amount of data. In the current high-speed development of database technology, the security requirements for various data information saved in a database host are also increasingly high. In order to prevent data loss or damage caused by a failure of the database host, data backup is performed on the data information. Currently, the commonly used backup schemes for files mainly include the following two kinds: file backup based on a file system, in which, after full backup of specified files, each time an increment is determined by comparing metadata information such as the modification time of the files to determine whether there are modified or newly added files, and the newly added files are backed up. File backup based on a disk block, in which, disk physical blocks are directly read, and the physical block data is backed up by equally dividing the disk physical blocks, and each time an increment is backed up only the modified physical blocks.
[0003] The disadvantage of the file backup based on the file system is that each time the backup will scan all the files, and only when the scanning of all the files is completed, the backup is completed. Since the files are scattered in the disk in disorder in the file system, when the number of files is large and the number of files changes little, a lot of time will be wasted in searching for the files, which not only wastes time but also is inefficient and takes a long time to backup. The disadvantage of the file backup based on the disk block is that the backup is a separate disk block, i.e., a disk sector. Since the file is composed of many data blocks, the occupied space is relatively large, and each time only the modified blocks are backed up, the data is not complete and continuous, and if one of the blocks is lost, the data cannot be normally recovered, which is easy to form a zombie block. SUMMARY
[0004] The present application provides a data backup and recovery method and device, an electronic device, and a storage medium, which aims to solve the problem of low efficiency of the data backup method and abnormal data recovery in the prior art.
[0005] In a first aspect, the present application provides a data backup and recovery method, which comprises: cutting a file to be backed up into a plurality of file blocks, and calculating a hash value of each file block to obtain a plurality of hash values; storing the plurality of file blocks in a corresponding storage directory according to the hash value of each file block to obtain an index relationship between the storage directory and the plurality of file blocks; performing incremental backup on the plurality of file blocks in the storage directory; calculating a backup snapshot identifier corresponding to a current backup round based on the plurality of hash values; According to the backup snapshot identification, a storage directory corresponding to the data backup is determined, and data recovery is performed by using the storage directory.
[0006] In some possible embodiments, The splitting the to-be-backed-up file into a plurality of file blocks and calculating a hash value of each file block respectively to obtain a plurality of hash values comprises: Determining a file feature of the to-be-backed-up file; Bringing the file feature into a preset file chunking strategy model to determine a file chunking strategy; Splitting the to-be-backed-up file into a plurality of initial file blocks by using the file chunking strategy; De-duplicating and fusing the plurality of initial file blocks to obtain the plurality of file blocks; Calculating a hash value of each file block of the plurality of file blocks respectively to obtain a plurality of hash values.
[0007] In some possible embodiments, Before the bringing the file feature into the preset file chunking strategy model to determine the file chunking strategy, the splitting the to-be-backed-up file into a plurality of file blocks and calculating a hash value of each file block respectively to obtain a plurality of hash values further comprises: Obtaining a training backup file set, wherein the training backup file set comprises a plurality of training backup files and a file chunking strategy corresponding to each training backup file respectively; Obtaining a file feature corresponding to each training backup file respectively to obtain a plurality of file features; Training an initial file chunking strategy model by using the plurality of file features and the file chunking strategy corresponding to each training backup file respectively to obtain the file chunking strategy model.
[0008] In some possible embodiments, the storing the plurality of file blocks in corresponding storage directories according to the hash value of each file block respectively to obtain a storage directory comprising a plurality of file blocks comprises: Determining a hash value identifier at a fixed position in the plurality of hash values respectively; Storing the plurality of file blocks in corresponding storage directories according to the hash value identifier to obtain a storage directory comprising a plurality of file blocks.
[0009] In some possible embodiments, the performing incremental backup on the plurality of file blocks in the storage directory respectively comprises: Searching for a post-backup file corresponding to a previous backup round of a current backup round in a preset storage cache area; Judging whether there is same block data in the plurality of file blocks and the post-backup file respectively; If there is a first file block identical to the post-backup file in the plurality of file blocks, the other file blocks in the plurality of file blocks except the first file block are backed up to obtain a new post-backup file; The new post-backup file is added to the storage cache area, and the post-backup file corresponding to the previous backup round is stored in a preset storage area.
[0010] In some possible embodiments, The backup snapshot identifier corresponding to the current backup round is calculated based on the plurality of hash values, including: An identifier file block is determined in the plurality of file blocks, and an identifier hash value of the identifier file block is determined; A first number of hash values are screened from the plurality of hash values based on a preset hash value screening strategy; The identifier hash value and the first number of hash values are deduplicated, and the backup snapshot identifier corresponding to the current backup round is calculated based on the deduplicated plurality of hash values.
[0011] In some possible embodiments, the method further includes: The accuracy of the recovered data obtained by using the storage directory for data recovery is verified.
[0012] In a second aspect, an embodiment of the present application provides a data backup and recovery device, which includes: A file splitting module is configured to split a file to be backed up into a plurality of file blocks, and calculate a hash value of each file block to obtain a plurality of hash values; An index establishing module is configured to store the plurality of file blocks in corresponding storage directories according to the hash value of each file block to obtain an index relationship between the storage directories and the plurality of file blocks; A backup module is configured to respectively perform incremental backup on the plurality of file blocks in the storage directories; A backup snapshot identifier calculating module is configured to calculate a backup snapshot identifier corresponding to a current backup round based on the plurality of hash values; A data recovery module is configured to determine a storage directory corresponding to data backup according to the backup snapshot identifier, and perform data recovery by using the storage directory.
[0013] In a third aspect, the present application provides an electronic device including a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction is executed by the processor to implement the steps in the data backup and recovery method according to any one of the first aspect.
[0014] In a fourth aspect, the present application provides a computer readable storage medium, which stores a computer program. The computer program is loaded by a processor to perform the steps in the data backup and recovery method according to any one of the first aspect.
[0015] The present application provides a data backup and recovery method, device, electronic equipment and storage medium, including: cutting a file to be backed up into a plurality of file blocks, and calculating a hash value of each file block to obtain a plurality of hash values; storing the plurality of file blocks in a corresponding storage directory according to the hash value of each file block to obtain an index relationship between the storage directory and the plurality of file blocks; performing incremental backup on the plurality of file blocks in the storage directory; calculating a backup snapshot identifier corresponding to a current backup round based on the plurality of hash values; determining a storage directory corresponding to data backup according to the backup snapshot identifier, and performing data recovery using the storage directory. The present application improves the data backup efficiency by cutting the file to be backed up into a plurality of file blocks and performing incremental backup on the plurality of file blocks. The hash value of each file block is calculated to record the index relationship between the storage directory and the plurality of file blocks using the hash value. The backup snapshot identifier of the current backup round is calculated using the hash value of each file block. The storage directory requiring data recovery is found using the backup snapshot identifier. The data requiring data recovery is determined using the index relationship between the storage directory and the plurality of file blocks, so that the data can be completely recovered and the zombie block data can be avoided. BRIEF DESCRIPTION OF DRAWINGS
[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0017] Figure 1 is a schematic diagram of a data backup and recovery system provided by the embodiments of the present application; Figure 2 is a schematic diagram of an embodiment of a data backup and recovery method provided by the embodiments of the present application; Figure 3 is a schematic diagram of an embodiment of cutting a file to obtain a file block and calculating a hash value provided by the embodiments of the present application; Figure 4 is a schematic diagram of an embodiment of performing incremental backup on a plurality of file blocks provided by the embodiments of the present application; Figure 5 is a schematic diagram of an embodiment of calculating a backup snapshot identifier provided by the embodiments of the present application; Figure 6An embodiment flow diagram of a data backup and recovery method provided by the embodiment of the present application is shown in FIG. 1; Figure 7 An embodiment diagram of a data backup and recovery device provided by the embodiment of the present application is shown in FIG. 2; Figure 8 An embodiment structural diagram of an electronic device provided by the embodiment of the present application is shown in FIG. 3; Figure 9 An embodiment structural diagram of a terminal provided by the embodiment of the present application is shown in FIG. 4; Figure 10 An embodiment structural diagram of a server provided by the embodiment of the present application is shown in FIG. 5. DETAILED DESCRIPTION
[0018] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present application.
[0019] In the following description, specific embodiments of the present application will be described with reference to steps and symbols executed by one or more computers, unless otherwise specified. Therefore, these steps and operations will be mentioned several times by computers, and the computer execution referred to herein includes the operation of a computer processing unit represented by an electronic signal in a structured format. This operation transforms the data or maintains it at a location in the computer's memory system, which can reconfigure or otherwise change the operation of the computer in a manner known to those skilled in the art. The data structure maintained by the data is the physical location of the memory, which has specific characteristics defined by the data format. However, the principles of the present application are described in the above description, which does not represent a limitation, and those skilled in the art will understand that various steps and operations described below can also be implemented in hardware.
[0020] The term "module" or "unit" used herein can be regarded as a software object executed on the operating system. Different components, modules, engines and services described herein can be regarded as implementation objects on the operating system. The apparatus and method described herein are preferably implemented in software, and of course can also be implemented in hardware, all within the scope of protection of the present application.
[0021] As will be understood by one of skill in the art, the singular forms "a," "an," "said," and "the" include plural referents unless the context clearly dictates otherwise. It should be further understood that the terms "comprise," "comprises," "comprising," "include," "includes," "including," "contain," "contains," "containing," "have," "has," "having," or the like, are open-ended and do not exclude the presence of other features, integers, steps, operations, elements, and / or components. It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements can be present. Furthermore, "connected" or "coupled" as used herein can include wirelessly connected or wirelessly coupled. As used herein, the term "and / or" includes any and all combinations of one or more of the associated listed items.
[0022] Please refer to Figure 1 The present application also provides a data backup and recovery system, as shown in Figure 1 The data backup and recovery system includes a computing device 100, and the computing device 100 is integrated with the data backup and recovery apparatus provided by the present application. In the embodiments of the present application, the computing device 100 can be a terminal device or a server.
[0023] In the embodiments of the present application, when the computing device 100 is a server, the server can be a stand-alone server, or a server network or a server cluster composed of servers. For example, the server described in the embodiments of the present application includes but is not limited to a computer, a network host, a single network server, a plurality of network servers, or a cloud server composed of a plurality of servers. The cloud server is composed of a large number of computers or network servers based on cloud computing. In the embodiments of the present application, the server and the client can communicate through any communication mode, including but not limited to mobile communication based on the 3rd Generation Partnership Project (3GPP), Long Term Evolution (LTE), Worldwide Interoperability for Microwave Access (WiMAX), or computer network communication based on the TCP / IP Protocol Suite (TCP / IP) and User Datagram Protocol (UDP) protocol.
[0024] It can be understood that when the computing device 100 used in the embodiments of the present application is a terminal device, the terminal device can be a device that includes both receiving hardware and transmitting hardware, i.e., a device that has receiving and transmitting hardware capable of performing bidirectional communication on a bidirectional communication link. Such a terminal device can include a cellular or other communication device with a single-line display or a multi-line display or a cellular or other communication device without a multi-line display. The computing device 100 can specifically be a desktop terminal or a mobile terminal, and the computing device 100 can specifically be one of a mobile phone, a tablet computer, a notebook computer, and the like.
[0025] The terminal device involved in the embodiments of the present application can also refer to a device that provides voice and / or data connectivity to a user, a handheld device with wireless connection function, or other processing devices connected to a wireless modem. For example, a mobile phone (also called a "cellular" phone) and a computer with a mobile terminal, for example, can be a portable, pocket, handheld, built-in computer, or vehicle-mounted mobile device that exchanges voice and / or data with a wireless access network. For example, a personal communication service (English: Personal Communication Service, English: PCS) phone, a cordless phone, a session initiation protocol (SIP) phone, a wireless local loop (Wireless Local Loop, English: WLL) station, a personal digital assistant (English: Personal Digital Assistant, English: PDA), and the like.
[0026] Those skilled in the art can understand that Figure 1 The application environment shown in the above Figure 1 The application environment shown in the above Figure 1 The application environment shown in the above
[0027] In addition, as shown in the above Figure 1 The data backup and recovery system can further include a first storage 200 for storing backup data.
[0028] In the embodiment of the present application, the first memory 200 can be a cloud memory. Cloud storage is a new concept extended and developed on the basis of the concept of cloud computing. A distributed cloud storage system (hereinafter referred to as a storage system) refers to a storage system in which a large number of storage devices (storage devices are also referred to as storage nodes) of various types are collected and work cooperatively to provide data storage and business access functions by means of cluster application, grid technology, and distributed storage file system functions.
[0029] At present, the storage method of the storage system is as follows: a logical volume is created, and a physical storage space is allocated to each logical volume when the logical volume is created. The physical storage space can be a disk of a certain storage device or a disk group of several storage devices. The client stores data on a certain logical volume, that is, stores the data on a file system. The file system divides the data into many parts, each part being an object. The object contains not only data but also additional information such as data ID (ID entity). The file system writes each object to the physical storage space of the logical volume, and records the storage location information of each object. Thus, when the client requests to access the data, the file system can enable the client to access the data according to the storage location information of each object.
[0030] The process of allocating the physical storage space to the logical volume by the storage system is as follows: the physical storage space is divided into sections in advance according to the capacity estimation of the object stored in the logical volume (the estimation often has a large margin relative to the actual capacity of the object to be stored) and the group of RAID (Redundant Array of Independent Disk). A logical volume can be understood as a section, so that the logical volume is allocated with the physical storage space.
[0031] It should be noted that, Figure 1 The scenario diagram of the data backup and recovery system shown is only an example. The data backup and recovery system and the scenario described in the embodiment of the present application are used to more clearly illustrate the technical solutions of the present application, and do not limit the technical solutions provided by the present application. It can be known by those skilled in the art that, as the data backup and recovery system evolves and new business scenarios appear, the technical solutions provided by the present application are also applicable to similar technical problems.
[0032] The solutions provided in this application involve technologies such as Artificial Intelligence (AI), Computer Vision (CV), and Machine Learning (ML), which are specifically illustrated through the following embodiments: AI, or Artificial Intelligence, refers to the theories, methods, technologies, and application systems that utilize digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to achieve optimal results. In other words, Artificial Intelligence is a comprehensive technology within computer science that attempts to understand the essence of intelligence and produce a new kind of intelligent machine capable of reacting in a manner similar to human intelligence. Artificial Intelligence studies the design principles and implementation methods of various intelligent machines, enabling them to possess the functions of perception, reasoning, and decision-making.
[0033] AI technology is a comprehensive discipline encompassing a wide range of fields, including both hardware and software technologies. Fundamental AI technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies primarily include computer vision, speech processing, natural language processing, and machine learning / deep learning.
[0034] Computer vision (CV) is the science that studies how to enable machines to "see." More specifically, it refers to machine vision, which uses cameras and computers to replace human eyes for target recognition, tracking, and measurement, and then performs image processing to create images more suitable for human observation or transmission to instruments. As a scientific discipline, computer vision studies related theories and technologies, attempting to build artificial intelligence systems capable of extracting information from images or multidimensional data. Computer vision technologies typically include adversarial perturbation generation, image recognition, image semantic understanding, image retrieval, OCR, video processing, video semantic understanding, video content / behavior recognition, 3D object reconstruction, 3D technology, virtual reality, augmented reality, simultaneous localization and mapping (SLAM), and common biometric recognition technologies such as facial recognition and fingerprint recognition.
[0035] The data backup and recovery method, apparatus, server, and storage medium provided in the embodiments of this application will be described in detail below. It should be noted that the sequence numbers of the following embodiments are not intended to limit the preferred order of the embodiments.
[0036] like Figure 2 The diagram shown is a flowchart of an embodiment of the data backup and recovery method provided in this application. Specifically, the data backup and recovery method may include the following steps: 201. Divide the file to be backed up into multiple file blocks, and calculate the hash value of each file block to obtain multiple hash values.
[0037] The data backup and recovery method provided in this application requires splitting the file to be backed up into multiple file blocks, determining whether each file block needs to be backed up separately, and backing up only the necessary file blocks. By splitting the file into multiple file blocks, the method determines whether the data in each file block needs to be backed up separately, eliminating the need to wait for the entire backup file to be scanned before determining whether the file to be backed up needs to be backed up, thus reducing the time required for file scanning. Furthermore, by only backing up modified file blocks, while retaining unmodified file blocks, the integrity of the backup file can still be guaranteed, facilitating subsequent data recovery.
[0038] For this application, some methods can be used to divide the backup file into multiple different file blocks, and calculate the hash value of each file block to obtain multiple hash values. For example... Figure 3 As shown, in some embodiments, the file to be backed up is divided into multiple file blocks, and the hash value of each file block is calculated to obtain multiple hash values. This may include the following steps: 301. Determine the file characteristics of the file to be backed up.
[0039] 302. Input the file characteristics into the preset file slicing strategy model to determine the file slicing strategy.
[0040] 303. Use a file splitting strategy to split the file to be backed up into multiple initial file blocks.
[0041] When splitting files for backup, a specific splitting strategy is typically used to divide them into multiple file blocks. This includes determining the block size (e.g., 3kb or 5kb) and the splitting order (left-to-right or right-to-left). In this application, the file characteristics of the file to be backed up are first determined, and the file splitting strategy is then decided based on these characteristics. This approach ensures the splitting strategy better meets the actual file splitting needs. For example, if the file contains a large amount of important data, it's usually necessary to split it into numerous smaller blocks. This ensures that every piece of important data that has been modified is backed up, reducing the possibility of missing important data. Conversely, if the file is large, it means there is a lot of data. Splitting it into numerous smaller blocks and then determining whether each block needs to be backed up would take a long time, hindering fast and accurate backups and consuming significant backup resources.
[0042] Therefore, in the present application, the file chunking strategy for each to-be-backed-up file can be adaptively determined according to the file characteristics of the to-be-backed-up file itself, and the file chunking strategies corresponding to different to-be-backed-up files can be the same or different. In some embodiments, the file characteristics of the to-be-backed-up file include, but are not limited to, the file size of the to-be-backed-up file, the file type, the file importance, and other characteristics in different dimensions. The file chunking strategy corresponding to each to-be-backed-up file is determined according to the aforementioned characteristics in different dimensions. In other embodiments, the file characteristics can also be other dimensions of file characteristics. The various dimensions of file characteristics provided in the present application do not represent a limitation on the present application. When the file characteristics of the to-be-backed-up file are determined, the file characteristics can be brought into a preset file chunking strategy model to determine the specific file chunking strategy, including but not limited to determining the specific file block size, the chunking order, and other information.
[0043] In some embodiments, before the specific file chunking strategy is determined by using the preset file chunking strategy model, the file chunking strategy model needs to be trained. Specifically, a set of training backup files can be obtained, the set of training backup files including a plurality of training backup files and a file chunking strategy corresponding to each training backup file; the file characteristics corresponding to each training backup file are obtained respectively to obtain a plurality of file characteristics; and the initial file chunking strategy model is trained by using the plurality of file characteristics and the file chunking strategy corresponding to each training backup file to obtain the file chunking strategy model. Specifically, the plurality of training backup files and the file chunking strategy corresponding to each training backup file required for model training can be obtained, and the file characteristics corresponding to each training backup file are further obtained, so that the corresponding file characteristics and the file chunking strategy are used for model training to obtain the file chunking strategy model related to the file characteristics and the file chunking strategy. After the model is trained, only the file characteristics corresponding to each to-be-backed-up file need to be obtained when data backup is performed, and the file chunking strategy model can be used to determine the file chunking strategy corresponding to each different to-be-backed-up file. The specific process of training the file chunking strategy can refer to the prior art, which is not limited in the present application.
[0044] In the foregoing embodiments, the file chunking strategy corresponding to each file to be backed up is theoretically different; in other embodiments, a plurality of determined file chunking strategies can be provided, and one file chunking strategy is selected from the plurality of file chunking strategies for file chunking. Specifically, the file features of the file to be backed up can also be determined, and the file features in the present application generally include a plurality of different dimensions of file features; using a plurality of different dimensions of file features, a file fusion feature obtained by fusing a plurality of different dimensions of file features can be obtained. The file fusion feature can fuse a plurality of file features, and can more comprehensively represent the file features of the file to be backed up, avoiding the problem that the file chunking strategy determined from a single dimension is inaccurate and does not meet the actual needs. In some embodiments, the plurality of different dimensions of file features can be weighted to obtain the file fusion feature; for example, the fusion feature Q=A1B1+A2B2+A3B3+…+A n B n wherein A1-A n are respectively the weighted weights corresponding to each different dimension of file feature, and B1-Bn are respectively each different dimension of file feature. In other embodiments, other methods can also be used to fuse a plurality of different dimensions of file features, for example, a feature vector of each different dimension of file feature is obtained, and a plurality of feature vectors are used to determine the file fusion feature. In other embodiments, other methods can also be used to fuse a plurality of different dimensions of file features to obtain the file fusion feature, and the method provided by the present application for obtaining the file fusion feature does not represent a limitation of the present application.
[0045] When the file fusion feature is determined, the file chunking strategy corresponding to the file fusion feature corresponding to the current file to be backed up can be determined based on a mapping table between the preset file fusion feature and the file chunking strategy. For example, a file fusion feature corresponds to a file chunking strategy: the file block size is 5 kb, the chunking center point is the leftmost data in the file to be backed up, and the chunking order is from left to right; or another file fusion feature corresponds to a file chunking strategy: the file block size is 3 kb, the chunking center point is the centermost data in the file to be backed up, and the chunking order is from the center to the two sides. In the embodiments of the present application, a mapping table between a file fusion feature and a file chunking strategy can be set, which can include a plurality of file fusion features and a plurality of file chunking strategies, and one file fusion feature corresponds to one file chunking strategy. In some embodiments, the plurality of file chunking strategies in the mapping table can be artificially set and changed; in other embodiments, the plurality of file chunking strategies in the mapping table can also be obtained based on clustering of the existing plurality of file chunking strategies. The specific method of clustering a plurality of file chunking strategies can refer to the prior art, which is not limited in the present application. Regardless of the method used to obtain the file chunking strategy, the file chunking strategy can be used to split the file to be backed up, thereby obtaining a plurality of initial file blocks; generally, the file size of the plurality of initial file blocks is usually the same, except that the size of the last file block obtained by splitting may be smaller than the file block size set in the file chunking strategy.
[0046] 304, de-duplicate the plurality of initial file blocks to obtain a plurality of file blocks.
[0047] 305, calculate the hash values of the plurality of file blocks respectively to obtain a plurality of hash values.
[0048] In the foregoing embodiments, the file to be backed up is split into a plurality of initial file blocks using the file chunking strategy, and the plurality of initial file blocks can also be de-duplicated respectively to further reduce the amount of duplicate data and reduce the number of file blocks, thereby improving the subsequent backup efficiency. De-duplicating the plurality of initial file blocks mainly compares the content similarity or data similarity between the plurality of initial files, and mainly compares the similarity of adjacent initial file blocks of an initial file block. When de-duplicating, the similarity between the plurality of initial file blocks in a sliding window is usually determined in a fixed order from left to right or from right to left; if the plurality of initial file blocks in the sliding window have high similarity, de-duplication can be performed. In other embodiments, other methods can also be used to de-duplicate the plurality of initial file blocks, which are not limited in the present application.
[0049] It should be noted that the sizes of the plurality of file blocks obtained by deduplication may be different; for example, a file block is obtained by fusing a plurality of initial file blocks, and the size of the file block may be much larger than the size of the file block that is not fused. After obtaining the plurality of file blocks, the hash values of the plurality of file blocks can be calculated to obtain a plurality of hash values. In a specific embodiment, SHA-256 hash calculation can be performed on each file block to calculate the hash value; the specific calculation process can refer to the prior art, and will not be described here.
[0050] 202. Store the plurality of file blocks in the corresponding storage directory according to the hash value of each file block, to obtain an index relationship between the storage directory and the plurality of file blocks.
[0051] The purpose of calculating the hash value of each file block in the present application is to store the plurality of file blocks based on the hash value. Specifically, the hash value corresponding to each file block is unique, and there is no same hash value; however, since the hash value is 32-bit data in hexadecimal, there are similar data between different hash values, and based on the similar data in the hash value, the plurality of file blocks can be classified, and the file blocks belonging to the same class can be stored together. That is, the hash value identifier at a fixed position in the plurality of hash values can be determined, and according to the hash value identifier, the plurality of file blocks can be stored in the corresponding storage directory to obtain an index relationship between the storage directory and the plurality of file blocks; one storage directory includes a plurality of subdirectories, and the plurality of file blocks are stored in different subdirectories, and some of the plurality of file blocks can be stored in the same subdirectory; by using the index relationship between the storage directory and the plurality of file blocks, the corresponding file block can be determined by searching the storage directory, to determine the data that needs to be recovered. In a specific embodiment, the first two data in the 32-bit hash value can be used as the hash value identifier, and the file blocks corresponding to the hash values with the same hash value identifier can be stored in the same storage directory. In other embodiments, other bits of data can also be selected as the hash value identifier, which is not limited in the present application.
[0052] 203. Incrementally backup the plurality of file blocks in the storage directory.
[0053] When the plurality of file blocks are stored, the current backup can be performed, and the present application mainly performs incremental backup on the backup files, that is, only the changed data is backed up, including but not limited to adding, deleting, and modifying data. Figure 4 As shown in FIG. 7, an embodiment process schematic diagram for performing incremental backup on the plurality of file blocks provided by the present application can include: 401. Search the preset storage buffer area for the backup file corresponding to the previous backup round of the current backup round.
[0054] 402. Determine whether there are same block data in the plurality of file blocks and the backup file respectively.
[0055] 403. If there is a first file block same as the backup file in the plurality of file blocks, backup other file blocks in the plurality of file blocks except the first file block to obtain a new backup file.
[0056] 404. Add the new backup file to the storage cache area, and store the backup file corresponding to the previous backup round to the preset storage area.
[0057] For the present application, the file blocks that have changed need to be backed up, and the determination of whether the file blocks have changed is to compare the plurality of file blocks to be backed up with the backup file obtained by the previous backup round, rather than comparing the plurality of file blocks to be backed up with the stored initial data. At the same time, the backup file backed up by the previous backup round can be temporarily stored in the preset storage cache area in the present application, so that the backup file of the previous backup round can be directly found from the preset storage cache area, and the file blocks or data that need to be compared need to be found in the database or memory that stores a plurality of data, thereby improving the efficiency of data backup. When determining whether there are same block data in the plurality of file blocks and the backup file, the plurality of file blocks and the backup file can be compared in parallel, that is, the plurality of file blocks and the backup file of the previous backup round are compared at the same time. Parallel comparison can also improve the efficiency of data backup. If there are same block data in the plurality of file blocks and the backup file corresponding to the previous backup round, it means that the data in the file block has not changed, and it is not necessary to backup it. If the data in the plurality of file blocks is different from the backup file corresponding to the previous backup round, it means that the data has changed, and the changed data needs to be backed up. Similarly, the backup file obtained by the current backup round can be added to the storage cache area for comparison in the next backup, and the backup file corresponding to the previous backup round can be transferred to the preset storage area such as a database or a memory for storage.
[0058] In the above embodiments, when judging whether there is the same data block between the plurality of file blocks and the post-backup file corresponding to the previous backup round, it can be judged whether the data similarity between one file block and a plurality of file blocks in the post-backup file is not less than a preset similarity threshold, for example, whether it is not less than 98% similarity. In other embodiments, the data is divided into different storage directories by the hash value identification, and a directory can include a plurality of file blocks; therefore, different similarity thresholds can be set for the plurality of file blocks in different directories. For example, the file blocks in a certain directory are all data files generated during running, and the similarity threshold for the file blocks in this directory can be set to 98%; as long as the data similarity is not less than 98%, it is determined that the data has not changed, and backup can not be performed. For the file blocks in another directory, the file blocks in the directory are all configuration data files of the system or device, and such data files need to be backed up as long as any change occurs, that is, 100% data similarity needs to be ensured; if the data does not reach 100% similarity, backup is needed.
[0059] It should be noted that the index or mapping between the file block that has not changed and the same file block in the backup file of the previous round is stored in the post-backup file obtained by the current backup round; so as to ensure the integrity of the data. That is, the post-backup file obtained by the incremental backup in the present application includes the file block obtained by the backup of the changed file block, and the index or mapping corresponding to the unchanged file block, the index or mapping points to the file block in the previous backup round, and the pointed file block in the previous backup round is the unchanged file block.
[0060] 204, based on a plurality of hash values, a backup snapshot identifier corresponding to the current backup round is calculated.
[0061] 205, according to the backup snapshot identifier, a storage directory corresponding to the data backup is determined, and the storage directory is used for data recovery.
[0062] The foregoing embodiments describe how to perform incremental backup on the backup file, and an index relationship between a storage directory and a plurality of file blocks is obtained during the incremental backup, and the index relationship can be used for data recovery. Specifically, the storage directory generated each time the backup is performed also corresponds to a backup snapshot identifier, which records the backup time of this round of backup, the backup data and other information, the corresponding storage directory can be found by using the backup snapshot identifier, and then the plurality of file blocks in the storage directory are obtained to perform data recovery by using the plurality of file blocks. In some embodiments of the present application, the backup snapshot identifier can be calculated based on the hash values of the plurality of file blocks. As shown in the figure, an embodiment process schematic diagram for calculating the backup snapshot identifier provided by the present application can include: Figure 5 501、determining an identification file block from the plurality of file blocks, and determining an identification hash value of the identification file block.
[0063] 502、screening the first number of hash values from the plurality of hash values based on a preset hash value screening strategy.
[0064] 503、de-duplicating the identification hash value and the first number of hash values, and calculating a backup snapshot identification corresponding to the current backup round based on the de-duplicated plurality of hash values.
[0065] In embodiments of the present application, the backup snapshot identification corresponding to the current backup round is calculated using the hash values corresponding to the plurality of file blocks, and the plurality of or all hash values can be used for calculation. Specifically, an identification file block can be determined from the plurality of file blocks, and the hash values of these identification file blocks can be obtained; in some embodiments, the identification file block can be set according to actual needs, for example, the file block at the first or last position is set as the identification file block, and the corresponding hash value is the identification hash value. Then a certain number of hash values are selected according to a certain hash value screening strategy, such as interval screening or random screening; the hash values selected according to the hash value screening strategy can be duplicated with the hash values, so de-duplication processing is required for the selected hash values and the hash values. In other embodiments, a certain number of hash values can be screened from all hash values except the identification hash value based on a preset hash value screening strategy to calculate the backup snapshot identification. Since the hash values selected at this time are selected from the hash values other than the identification hash value, de-duplication processing with the identification hash value is not required. In other embodiments, all hash values can be directly selected for backup snapshot identification.
[0066] For the present application, the backup snapshot identification calculated each time is usually different, so the backup snapshot identification can be used as the unique identification of each backup; therefore, the data to be recovered can be determined by determining the backup snapshot identification. For example, when data backup is required, the backup snapshot identification corresponding to the data to be backed up can be obtained, and the corresponding storage directory can be determined based on the backup snapshot identification, and then the plurality of file blocks having an index relationship with the storage directory can be determined, so as to recover the data in the plurality of file blocks. In this way, the data to be recovered does not need to be searched from the plurality of data, which can effectively improve the efficiency of data recovery. After data recovery using the storage directory, the accuracy of the recovered data needs to be verified to ensure the reliability of data recovery.
[0067] As shown in FIG. 1, an embodiment of the data backup and recovery method provided by the present application is shown, in which a plurality of file blocks are stored in a storage directory, and each file block has a corresponding hash value. Figure 6 Figure 6 The backup process divides the file to be backed up into multiple file blocks, designated as file block A, file block B, file block C, and file block D. Then, it calculates the hash value for each file block and stores the four file blocks in the same storage directory based on their respective hash values. Specifically, file block A can be stored in a separate subdirectory, file blocks B and C in the same subdirectory, and file block D in a separate subdirectory; these three different subdirectories form a complete storage directory. Incremental backups are then performed on the four sub-file blocks, meaning that only the modified file blocks are backed up. For example, modified file blocks A, B, and C are backed up, while file block D, which remains unchanged, is not backed up but a mapping pointing to the same data in the backup file from the previous backup round is generated. The mappings corresponding to the backed-up file blocks A, B, C, and D are stored. At the same time, the backup snapshot identifier corresponding to this backup is calculated and stored based on the hash values corresponding to file blocks A, B, C, and D. File blocks A, B, C, and D can be identified and data recovery can be performed later using the backup snapshot identifier.
[0068] To facilitate better implementation of the data backup and recovery method provided in the embodiments of this application, the embodiments of this application also provide an apparatus based on the above-described data backup and recovery method. The meanings of the terms used are the same as in the above-described data backup and recovery method, and specific implementation details can be found in the descriptions in the method embodiments. Figure 7 The diagram shown is a schematic representation of an embodiment of the data backup and recovery device provided in this application, which may include: The file splitting module 701 is used to split the file to be backed up into multiple file blocks and calculate the hash value of each file block to obtain multiple hash values. The index building module 702 is used to store multiple file blocks in the corresponding storage directory according to the hash value of each file block, so as to obtain the index relationship between the storage directory and the multiple file blocks.
[0069] Backup module 703 is used to perform incremental backups of multiple file blocks in the storage directory.
[0070] The backup snapshot identifier calculation module 704 is used to calculate the backup snapshot identifier corresponding to the current backup round based on multiple hash values.
[0071] The data recovery module 705 is used to determine the storage directory corresponding to the data backup based on the backup snapshot identifier, and to perform data recovery using the storage directory.
[0072] In some embodiments, the file splitting module 701 may be specifically used to: determine the file characteristics of the file to be backed up; The file feature is brought into a preset file chunking strategy model to determine a file chunking strategy; the file chunking strategy is used to divide the file to be backed up into a plurality of initial file blocks; the plurality of initial file blocks are de-duplicated and fused to obtain a plurality of file blocks; and hash values of the plurality of file blocks are calculated respectively to obtain a plurality of hash values.
[0073] In some embodiments, the file splitting module 701 can be specifically configured to: obtain a training backup file set, the training backup file set including a plurality of training backup files and a file chunking strategy corresponding to each training backup file; obtain file features corresponding to the plurality of training backup files respectively to obtain a plurality of file features; and train an initial file chunking strategy model by using the plurality of file features and the file chunking strategy corresponding to each training backup file to obtain a file chunking strategy model.
[0074] In some embodiments, the index establishing module 702 can be specifically configured to: determine hash value identifiers at fixed positions in the plurality of hash values respectively; and store the plurality of file blocks in corresponding storage directories according to the hash value identifiers to obtain storage directories including the plurality of file blocks.
[0075] In some embodiments, the backup module 703 can be specifically configured to: find a post-backup file corresponding to a previous backup round of a current backup round in a preset storage cache area; determine whether there is same block data in the plurality of file blocks and the post-backup file respectively; if there is a first file block same as the post-backup file in the plurality of file blocks, backup other file blocks in the plurality of file blocks except the first file block to obtain a new post-backup file; add the new post-backup file to the storage cache area, and store the post-backup file corresponding to the previous backup round to a preset storage area.
[0076] In some embodiments, the backup snapshot identifier calculating module 704 can be specifically configured to: determine an identifier file block in the plurality of file blocks, and determine an identifier hash value of the identifier file block; filter a first number of hash values from the plurality of hash values based on a preset hash value filtering strategy; de-duplicate the identifier hash value and the first number of hash values, and calculate a backup snapshot identifier corresponding to the current backup round based on the de-duplicated plurality of hash values.
[0077] In some embodiments, the data backup and recovery apparatus can further include a verification module, which is mainly configured to verify an accuracy rate of recovery data obtained by data recovery using the storage directories.
[0078] The embodiments of the present application also provide an electronic device, as shown in Figure 8 The embodiments of the present application also provide an electronic device, as shown in The electronic device can include a first processor 801 having one or more processing cores, a second memory 802 having one or more computer readable storage media, a first power supply 803, and a first input unit 804, etc. Those skilled in the art can understand that Figure 8 The electronic device structure shown in the figure is not a limitation on the electronic device, and can include more or fewer components than shown, or combine certain components, or different component arrangements. Among them: The first processor 801 is the control center of the electronic device, which connects various parts of the entire electronic device through various interfaces and lines, and performs various functions of the electronic device and processes data by running or executing software programs and / or modules stored in the second memory 802, and calling data stored in the second memory 802, thereby overall monitoring the electronic device. Optionally, the first processor 801 can include one or more processing cores; preferably, the first processor 801 can integrate an application processor and a modem processor, wherein the application processor mainly processes operating storage media, user interfaces, and application programs, etc., and the modem processor mainly processes wireless communication. It can be understood that the above-mentioned modem processor can also not be integrated into the first processor 801.
[0079] The second memory 802 can be used to store software programs and modules, and the first processor 801 executes various functions and data processing by running the software programs and modules stored in the second memory 802. The second memory 802 can mainly include a program storage area and a data storage area, wherein the program storage area can store application programs required by at least one function (such as sound playing function, image playing function, etc.) and the like; the data storage area can store data created according to the use of the electronic device, etc. In addition, the second memory 802 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage device. Accordingly, the second memory 802 can also include a memory controller to provide access for the first processor 801 to the second memory 802.
[0080] The electronic device also includes a first power supply 803 for powering various components, and preferably the first power supply 803 can be logically connected to the first processor 801 through a power management storage medium, thereby realizing functions such as management of charging, discharging, and power consumption management through the power management storage medium. The first power supply 803 can also include one or more direct or alternating current power supplies, rechargeable storage media, power failure detection circuits, power converters or inverters, power status indicators, etc. any component.
[0081] The electronic device can further include a first input unit 804 which can be used to receive inputted digital or character information, and to generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function controls.
[0082] Although not shown, the electronic device can further include a display unit and the like, which will not be described here. In particular, in the present embodiment, the first processor 801 in the electronic device can load the executable file corresponding to the process of one or more application programs into the second memory 802 according to the following instructions, and run the application program stored in the second memory 802 by the first processor 801, thereby implementing the steps in the above-mentioned data backup and recovery method embodiments.
[0083] Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructions, or by related hardware controlled by the instructions, which can be stored in a computer readable storage medium and loaded and executed by a processor.
[0084] To this end, the embodiments of the present application provide a computer readable storage medium having a computer program stored thereon, which is loaded by a processor to execute the steps in any one of the data backup and recovery methods provided by the embodiments of the present application.
[0085] The specific implementation of each of the above operations can refer to the previous embodiments, which will not be described here.
[0086] The computer readable storage medium can include a read only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and the like. Since the computer program stored in the computer readable storage medium can execute the steps in any one of the data backup and recovery methods provided by the embodiments of the present application, the beneficial effects of any one of the data backup and recovery methods provided by the embodiments of the present application can be achieved, which will be described in detail in the previous embodiments, and will not be described here.
[0087] When the computing device in the embodiments of the present application is a terminal device, the embodiments of the present application further provide a terminal device, as shown in Figure 9 For ease of illustration, only parts related to the embodiments of the present application are shown, and specific technical details that are not disclosed will be described with reference to the method part of the embodiments of the present application. The terminal device can be any terminal device including a mobile phone, a tablet computer, a personal digital assistant (PDA), a point of sales (POS) terminal device, a vehicle-mounted computer, and the like. Taking the mobile phone as an example: Figure 9 This diagram illustrates a partial structure of a mobile phone related to the terminal device provided in the embodiments of this application. (Reference) Figure 9 The mobile phone includes components such as a radio frequency (RF) circuit 910, a third memory 920, a second input unit 930, a display unit 940, a sensor 950, an audio circuit 960, a wireless fidelity (WiFi) module 970, a second processor 980, and a second power supply 990. Those skilled in the art will understand that... Figure 8 The mobile phone structure shown does not constitute a limitation on the mobile phone and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0088] The following is combined with Figure 9 A detailed introduction to each component of a mobile phone: The RF circuit 910 can be used for receiving and transmitting signals during information transmission or calls. Specifically, it receives downlink information from the base station and processes it with the second processor 980; additionally, it transmits uplink data to the base station. Typically, the RF circuit 910 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low-noise amplifier (LNA), a duplexer, etc. Furthermore, the RF circuit 910 can also communicate wirelessly with networks and other devices. The aforementioned wireless communication can use any communication standard or protocol, including but not limited to Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Long Term Evolution (LTE), email, and Short Messaging Service (SMS).
[0089] The third memory 920 can be used to store software programs and modules, and the second processor 980 executes various function applications and data processing of the mobile phone by running the software programs and modules stored in the third memory 920. The third memory 920 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application program required by a function (such as a sound playing function, an image playing function, etc.), and the like; and the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), and the like. In addition, the third memory 920 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state memory device.
[0090] The second input unit 930 can be used to receive inputted digital or character information, and to generate key signal input related to the user settings and function control of the mobile phone. Specifically, the second input unit 930 can include a touch panel 931 and other input devices 932. The touch panel 931, also known as a touch screen, can collect the touch operation of a user thereon or adjacent thereto (such as the operation of the user using a finger, a stylus, or any suitable object or accessory on or adjacent to the touch panel 931), and drive the corresponding connection device according to the pre-set program. Optionally, the touch panel 931 can include two parts of a touch detection device and a touch controller. Among them, the touch detection device detects the touch position of the user and detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, and converts it into touch coordinates, and then sends it to the second processor 980, and can also receive the command sent by the second processor 980 and execute it. In addition, the touch panel 931 can be implemented in various types such as a resistive type, a capacitive type, an infrared type, and a surface acoustic wave type. In addition to the touch panel 931, the second input unit 930 can also include other input devices 932. Specifically, the other input devices 932 can include one or more of a physical keyboard, a function key (such as a volume control key, an on-off key, etc.), a trackball, a mouse, a joystick, and the like.
[0091] The display unit 940 can be used to display information input by a user or information provided to the user as well as various menus of the phone. The display unit 940 can include a display panel 941, which can be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like. Further, a touch panel 931 can cover the display panel 941, and when the touch panel 931 detects a touch operation thereon or nearby, it transmits to the second processor 980 to determine the type of touch event, and then the second processor 980 provides a corresponding visual output on the display panel 941 according to the type of touch event. Although in the above description, the touch panel 931 and the display panel 941 are implemented as two independent components to realize the input and output functions of the phone, in some embodiments, the touch panel 931 and the display panel 941 can be integrated to realize the input and output functions of the phone. Figure 8
[0092] The phone can also include at least one sensor 950, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor can include an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel 941 according to the brightness of ambient light, and the proximity sensor can turn off the display panel 941 and / or the backlight when the phone is moved to the ear. As one of the motion sensors, the accelerometer sensor can detect the magnitude of acceleration in each direction (generally three axes), and when at rest, it can detect the magnitude and direction of gravity, which can be used for applications that identify the posture of the phone (such as landscape / portrait screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), and the like. As for other sensors that the phone can also be configured, such as a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, and the like, they will not be described here.
[0093] The audio circuit 960, the speaker 961, and the microphone 962 can provide an audio interface between the user and the phone. The audio circuit 960 can convert received audio data into an electrical signal, which is transmitted to the speaker 961 to be converted into a sound signal for output. On the other hand, the microphone 962 converts the collected sound signal into an electrical signal, which is received by the audio circuit 960 to be converted into audio data. After being processed by the second processor 980, the audio data is output to the RF circuit 910 to be transmitted to, for example, another phone, or to the third memory 920 for further processing.
[0094] Wi-Fi belongs to a short-range wireless transmission technology, and the phone can help users send and receive emails, browse web pages, and access streaming media through the Wi-Fi module 970, which provides users with wireless broadband Internet access. AlthoughFigure 9 A Wi-Fi module 970 is shown, but it is understood that it is not an essential component of the mobile phone and can be omitted as needed without changing the nature of the application.
[0095] The second processor 980 is the control center of the mobile phone, which connects various parts of the mobile phone through various interfaces and lines, and performs various functions and processes data of the mobile phone by running or executing software programs and / or modules stored in the third memory 920 and calling data stored in the third memory 920, thereby monitoring the mobile phone as a whole. Optionally, the second processor 980 can include one or more processing units; optionally, the second processor 980 can integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface and application program, etc., and the modem processor mainly processes wireless communication. It is understood that the above-mentioned modem processor can also not be integrated into the second processor 980.
[0096] The mobile phone also includes a second power supply 990 (such as a battery) for powering various components. Optionally, the power supply can be logically connected to the second processor 980 through a power management system, so that the power management system can realize functions such as management of charging, discharging, and power consumption management. Although not shown, the mobile phone can also include a camera, a Bluetooth module, etc., which will not be described here. In the embodiments of the present application, the second processor 980 included in the mobile phone also has the function of controlling the execution of the data backup and recovery method flow performed by the data backup and recovery device.
[0097] The embodiments of the present application also provide a server, please refer to Figure 10 , Figure 10 is a server structure schematic diagram provided by the embodiments of the present application. The server 1000 can have great differences due to different configurations or performances, and can include one or more central processing units (English full name: central processing units, English abbreviation: CPU) 1022 (for example, one or more processors) and a fourth memory 1032, and one or more storage media 1030 (for example, one or more mass storage devices) storing application programs 1042 or data 1044. Among them, the fourth memory 1032 and the storage medium 1030 can be temporary storage or persistent storage. The programs stored in the storage medium 1030 can include one or more modules (not shown in the figure), each module can include a series of instruction operations in the server. Further, the central third processor 1022 can be configured to communicate with the storage medium 1030 and execute a series of instruction operations in the storage medium 1030 on the server 1000.
[0098] The server 1000 can also include one or more third power supplies 1026, one or more wired or wireless network interfaces 1050, one or more input / output interfaces 1058, and / or one or more operating systems 1041, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, etc.
[0099] The steps in the data backup and recovery method in the above embodiments can be based on the Figure 10 The structure of the server 1000 shown. For example, the central third processor 1022 performs the following operations by invoking instructions in the fourth memory 1032: The file to be backed up is divided into a plurality of file blocks, and the hash value of each file block is calculated to obtain a plurality of hash values; According to the hash value of each file block, the plurality of file blocks are stored in the corresponding storage directory to obtain the index relationship between the storage directory and the plurality of file blocks; the plurality of file blocks in the storage directory are respectively incrementally backed up; the backup snapshot identifier corresponding to the current backup round is calculated based on the plurality of hash values; the storage directory corresponding to the data backup is determined according to the backup snapshot identifier, and the data recovery is performed by using the storage directory.
[0100] In the above embodiments, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the related description of other embodiments.
[0101] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system, device and module described above can refer to the corresponding process in the foregoing method embodiments, which will not be repeated here.
[0102] In several embodiments provided in the embodiments of the present application, it should be understood that the disclosed system, device and method can be implemented by other ways. For example, the device embodiments described above are only schematic, for example, the division of the modules is only a logical function division, and actual implementation can have another division manner, for example, a plurality of modules or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the shown or discussed can be indirect coupling or communication connection through some interfaces, devices or modules, which can be electrical, mechanical or other forms.
[0103] The modules described as separate components may or may not be physically separate, and the components shown as modules may or may not be physical modules, i.e., may be located in one place, or may be distributed to multiple network modules. Some or all of the modules can be selected according to actual needs to achieve the purpose of the embodiment.
[0104] In addition, each functional module in each embodiment of the present application can be integrated into one processing module, or each module can be physically independent, or two or more modules can be integrated into one module. The integrated module can be realized in the form of hardware or in the form of a software functional module. When the integrated module is realized in the form of a software functional module and sold or used as an independent product, it can be stored in a computer readable storage medium.
[0105] In the above embodiments, all or part can be realized by software, hardware, firmware or any combination thereof. When realized by software, all or part can be realized in the form of a computer program product.
[0106] The computer program product includes one or more computer instructions. When the computer program is loaded and executed on the computer, all or part of the processes or functions described in the embodiments of the present application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer readable storage medium or transferred from one computer readable storage medium to another, for example, the computer instructions can be transferred from one website, computer, server or data center to another website, computer, server or data center through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.) mode. The computer readable storage medium can be any available medium that the computer can store or be integrated into a server, data center and other data storage devices containing one or more available media. The available medium can be a magnetic medium (for example, floppy disk, hard disk, magnetic tape), optical medium (for example, DVD), or semiconductor medium (for example, solid state disk (SSD)) and the like.
[0107] The technical solutions provided by the embodiments of the present application are described in detail above, and the principles and implementation manners of the embodiments of the present application are described by applying specific examples. The above descriptions of the embodiments are only used to help understand the method and the core idea of the embodiments of the present application. Meanwhile, for those skilled in the art, the specific implementation manners and application ranges will be changed according to the ideas of the embodiments of the present application. In conclusion, the content of the specification should not be understood as a limitation of the embodiments of the present application.
Claims
1. A data backup and recovery method characterized by, The method comprises: cutting the file to be backed up into a plurality of file blocks, and calculating the hash value of each file block to obtain a plurality of hash values; storing the plurality of file blocks in the corresponding storage directory according to the hash value of each file block to obtain the index relationship between the storage directory and the plurality of file blocks; incrementally backing up the plurality of file blocks in the storage directory; calculating the backup snapshot identifier corresponding to the current backup round based on the plurality of hash values; determining the storage directory corresponding to the data backup according to the backup snapshot identifier, and using the storage directory for data recovery.
2. The data backup and recovery method according to claim 1, characterized by, The cutting of the file to be backed up into a plurality of file blocks and the calculation of the hash value of each file block to obtain a plurality of hash values comprise: determining the file characteristics of the file to be backed up; bringing the file characteristics into a preset file chunking strategy model to determine a file chunking strategy; cutting the file to be backed up into a plurality of initial file blocks using the file chunking strategy; de-duplicating and merging the plurality of initial file blocks to obtain the plurality of file blocks; calculating the hash value of each file block to obtain a plurality of hash values.
3. The data backup and recovery method according to claim 2, characterized by, Before the file characteristics are brought into the preset file chunking strategy model to determine the file chunking strategy, the cutting of the file to be backed up into a plurality of file blocks and the calculation of the hash value of each file block to obtain a plurality of hash values further comprise: obtaining a set of training backup files, wherein the set of training backup files comprises a plurality of training backup files and a file chunking strategy corresponding to each training backup file; obtaining the file characteristics corresponding to each training backup file to obtain a plurality of file characteristics; training an initial file chunking strategy model using the plurality of file characteristics and the file chunking strategy corresponding to each training backup file to obtain the file chunking strategy model.
4. The data backup and recovery method according to claim 1, characterized by, The storing of the plurality of file blocks in the corresponding storage directory according to the hash value of each file block to obtain a storage directory comprising a plurality of file blocks comprises: determining the hash value identifier at a fixed position in the plurality of hash values; storing the plurality of file blocks in the corresponding storage directory according to the hash value identifier to obtain a storage directory comprising a plurality of file blocks.
5. The data backup and recovery method according to claim 1, characterized by, The incremental backup of the plurality of file blocks in the storage directory comprises: finding the backup file corresponding to the previous backup round in the current backup round in a preset storage cache area; determining whether there is the same block data in the plurality of file blocks and the backup file; if there is a first file block identical to the backup file in the plurality of file blocks, backing up the other file blocks in the plurality of file blocks except the first file block to obtain a new backup file; adding the new backup file to the storage cache area, and storing the backup file corresponding to the previous backup round to a preset storage area.
6. The data backup and recovery method according to claim 1, characterized by, The calculation of the backup snapshot identifier corresponding to the current backup round based on the plurality of hash values comprises: determining an identifier file block in the plurality of file blocks, and determining an identifier hash value of the identifier file block; filtering a first number of hash values from the plurality of hash values based on a preset hash value filtering strategy; de-duplicating the identification hash value and the first number of hash values, and calculating a backup snapshot identification corresponding to a current backup round based on the de-duplicated hash values.
7. The data backup and recovery method according to claim 6, characterized by, The method further comprises: verifying an accuracy rate of recovery data obtained by data recovery using the storage directory.
8. A data backup and recovery apparatus, characterized by comprising: The apparatus comprises: a file splitting module configured to split a file to be backed up into a plurality of file blocks, and calculate a hash value of each file block to obtain a plurality of hash values; an index establishing module configured to store the plurality of file blocks in corresponding storage directories according to the hash value of each file block to obtain an index relationship between the storage directories and the plurality of file blocks; a backup module configured to perform incremental backup on the plurality of file blocks in the storage directories; a backup snapshot identification calculating module configured to calculate a backup snapshot identification corresponding to a current backup round based on the plurality of hash values; a data recovery module configured to determine a storage directory corresponding to data backup according to the backup snapshot identification, and perform data recovery using the storage directory.
9. An electronic device, comprising: comprises a processor, a memory, and a program or instruction stored on the memory and executable on the processor, and the program or instruction, when executed by the processor, implements the steps in the data backup of any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer program is stored on the memory and loaded by the processor to execute the steps in the data backup and recovery method of any one of claims 1 to 7.
Citation Information
Patent Citations
Data deduplication method and device
CN105740266A
Data backup method and device, electronic equipment and storage medium
CN115437848A
Data splitting method and device, computer equipment and storage medium
CN117555487A
Cloud backup platform data deduplication method based on distributed storage
CN119938406A
Disk backup method and device, storage medium and electronic equipment
CN119938409A