Backup and recovery method and device of native storage volume, equipment and product
The snapshot function and chunking compression technology are called through the container storage interface, and the problem of low adaptability of storage volume backup in the prior art is solved, and the adaptation of multiple storage systems and efficient data recovery are realized.
Patent Information
- Application Number
- CN202510058867.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-14
- Publication Date
- 2025-05-13
AI Technical Summary
Existing storage volume backup solutions are difficult to adapt to multiple storage types and scenarios, resulting in low adaptability to backup and recovery.
The snapshot function is called through the container storage interface, and snapshots of the native storage volume are captured, a new storage volume is generated, and chunked and compressed to obtain compressed data blocks. Key data blocks are extracted according to the demand information, decompression is performed, and written to the newly created blank storage volume to realize data recovery and mount.
Improves the adaptability and flexibility of data backup and recovery, supports multiple storage systems, reduces storage space usage, reduces storage costs, and improves the efficiency and reliability of backup and recovery.
Smart Images

Figure CN119988093A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a method, device, equipment and product for backing up and restoring native storage volumes. Background Art
[0002] Most of the current storage volume backup solutions on the market rely on the backup functions of the storage system, which are often designed only for specific storage types and supported by the manufacturer. In scenarios where users need to be compatible with multiple storage types or already have storage resources without purchasing new equipment, they cannot meet the backup and recovery needs.
[0003] Therefore, how to improve the adaptability of data backup and recovery for different demand scenarios is a problem that needs to be solved urgently. Summary of the invention
[0004] The main purpose of this application is to provide a method, device, equipment and product for backing up and restoring a native storage volume, aiming to solve the technical problem of low adaptability of data backup and recovery under different demand scenarios.
[0005] To achieve the above objectives, the present application proposes a method for backing up and restoring a native storage volume, the method comprising:
[0006] Calling the snapshot function through the container storage interface to take a snapshot of the current native storage volume and generate a new storage volume, where the new storage volume is used to store the complete state of the current data;
[0007] The new storage volume is divided into blocks and compressed to obtain compressed data blocks, wherein the blocks are used for distributed processing of data, and the compression is used to reduce the use of storage space;
[0008] extracting key data blocks from the compressed data blocks according to demand information, wherein the demand information is used to guide a data recovery process;
[0009] Decompressing the key data block using a decompression algorithm to obtain a decompressed file block;
[0010] The decompressed file block is written into a newly created blank storage volume to obtain a restored storage volume, and the restored storage volume is remounted to the target system. The restored storage volume has the same data information as the new storage volume.
[0011] In one embodiment, the step of dividing and compressing the new storage volume to obtain compressed data blocks includes:
[0012] Dividing the new storage volume into blocks according to a preset block size, and obtaining data of each data block;
[0013] Calculating a hash value of each data block according to the data of each data block, and determining a storage path of each data block;
[0014] Based on the storage path of each data block, each data block is compressed by a compression algorithm to obtain a compressed data block.
[0015] In one embodiment, the step of calculating the hash value of each data block according to the data of each data block and determining the storage path of each data block includes:
[0016] Based on the data of each data block, a hash value of each data block is calculated according to a hash algorithm;
[0017] Determine the second-to-last directory of the corresponding data block storage path according to the first and second values of the hash value;
[0018] Determine the last level directory of the corresponding data block storage path according to the third and fourth digits of the hash value;
[0019] The storage path of each data block is determined according to the second-to-last level directory of the storage path of each data block and the first-to-last level directory of the storage path.
[0020] In one embodiment, the demand information includes storage volume information, and the step of extracting the key data block from the compressed data block according to the demand information includes:
[0021] Storing each of the compressed data blocks in a backup storage according to the storage path of each of the data blocks;
[0022] Read the metadata in the backup storage and identify the storage volume information that needs to be restored;
[0023] Based on the storage volume information, key data blocks are extracted from the backup storage.
[0024] In one embodiment, the step of writing the decompressed file blocks into a newly created blank storage volume to obtain a restored storage volume, and remounting the restored storage volume to the target system includes:
[0025] Create a blank storage volume in the target system with the same size and attributes as the original storage volume;
[0026] According to the storage path of each data block, the decompressed file block is written into the newly created blank storage volume to obtain a restored storage volume;
[0027] The restored storage volume is remounted to a specified path or device of the target system through a container storage interface.
[0028] In one embodiment, the compressed data blocks are identified by hash values, and before the step of writing the decompressed file blocks into the newly created blank storage volume according to the storage paths of the data blocks, the following steps are included:
[0029] Recalculate the hash value of each decompressed file block according to the hash algorithm;
[0030] Comparing the hash value of each decompressed file block with the original hash value of each compressed data block to obtain a comparison result;
[0031] If the comparison result is the same, the decompressed file block is written into the newly created blank storage volume;
[0032] If the comparison result is different, the decompressed file blocks are retrieved from the redundant position of the backup storage, and the process returns to the step of recalculating the hash value of each decompressed file block according to the hash algorithm.
[0033] In addition, to achieve the above-mentioned purpose, the present application also proposes a native storage volume backup and recovery device, the native storage volume backup and recovery device comprising:
[0034] A snapshot capture module is used to call the snapshot function through the container storage interface, capture a snapshot of the current native storage volume, and generate a new storage volume, where the new storage volume is used to store the complete state of the current data;
[0035] A block compression module, used for dividing and compressing the new storage volume to obtain compressed data blocks, wherein the blocks are used for distributed processing of data, and the compression is used to reduce the use of storage space;
[0036] A data extraction module, used to extract key data blocks from the compressed data blocks according to demand information, wherein the demand information is used to guide the data recovery process;
[0037] A data decompression module, used for decompressing the key data block by using a decompression algorithm to obtain a decompressed file block;
[0038] The data recovery module is used to write the decompressed file block into the newly created blank storage volume to obtain a recovered storage volume, and remount the recovered storage volume to the target system. The data information in the recovered storage volume is the same as that in the new storage volume.
[0039] In addition, to achieve the above-mentioned purpose, the present application also proposes a native storage volume backup and recovery device, the device comprising: a memory, a processor, and a computer program stored on the memory and executable on the processor, the computer program being configured to implement the steps of the native storage volume backup and recovery method as described above.
[0040] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the native storage volume backup and recovery method described above are implemented.
[0041] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the steps of the native storage volume backup and recovery method as described above are implemented.
[0042] One or more technical solutions proposed in this application have at least the following technical effects:
[0043] The snapshot function is called through the container storage interface to take a snapshot of the current native storage volume and generate a new storage volume. The new storage volume is used to store the complete state of the current data. The new storage volume is divided and compressed to obtain compressed data blocks. The blocks are used for distributed processing of data, and the compression is used to reduce the use of storage space; the key data blocks are extracted from the compressed data blocks according to the demand information, and the demand information is used to guide the data recovery process; the key data blocks are decompressed by the decompression algorithm to obtain decompressed file blocks; the decompressed file blocks are written into the newly created blank storage volume to obtain the restored storage volume, and the restored storage volume is remounted to the target system. The restored storage volume has the same data information as the new storage volume. The container storage interface enables the snapshot, backup and recovery process to adapt to various types of storage systems. The block division allows data to be processed in a fine-grained manner, while supporting distributed storage, improving storage flexibility, and the compression operation effectively reduces the storage space occupied and reduces storage costs. Therefore, while improving the efficiency and reliability of backup and recovery, the flexibility and adaptability of backup and recovery can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0045] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0046] Figure 1 This is a flow chart of a first embodiment of a method for backing up and restoring a native storage volume of the present application;
[0047] Figure 2This is a flow chart of a second embodiment of a method for backing up and restoring a native storage volume of the present application;
[0048] Figure 3 This is a flow chart of a third embodiment of a method for backing up and restoring a native storage volume of the present application;
[0049] Figure 4 This is a flow chart of a third embodiment of a method for backing up and restoring a native storage volume of the present application;
[0050] Figure 5 A flowchart of a storage volume backup process according to an embodiment of the present application;
[0051] Figure 6 A flowchart of a storage volume recovery process according to an embodiment of the present application;
[0052] Figure 7 This is a schematic diagram of the module structure of the native storage volume backup and recovery device according to an embodiment of the present application;
[0053] Figure 8 This is a schematic diagram of the device structure of the hardware operating environment involved in the native storage volume backup and recovery method in the embodiment of the present application.
[0054] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0055] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0056] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0057] Most of the current volume backup solutions only support a specific storage type and are bound by storage vendors. This results in users being unable to meet backup and recovery needs when using multiple storage types or when existing storage resources are available. In addition, due to technical differences and interface incompatibilities between different storage systems, traditional backup solutions often cannot achieve seamless data migration and backup between different storage systems. Especially in cloud-native environments, if data is lost or damaged (such as when backup data is stored in a remote location or needs to be transmitted across a network), traditional backup solutions may take a long time to restore data. Therefore, how to improve the adaptability of data backup and recovery for different demand scenarios is a problem that needs to be solved urgently.
[0058] The present application provides a solution, which calls the snapshot function through the container storage interface, takes a snapshot of the current native storage volume, generates a new storage volume, and the new storage volume is used to store the complete state of the current data. The new storage volume is divided into blocks and compressed to obtain compressed data blocks, which are used for distributed processing of data, and compression is used to reduce the use of storage space; key data blocks are extracted from the compressed data blocks according to the demand information, and the demand information is used to guide the data recovery process; the key data blocks are decompressed by the decompression algorithm to obtain decompressed file blocks; the decompressed file blocks are written into the newly created blank storage volume to obtain the restored storage volume, and the restored storage volume is remounted to the target system, and the restored storage volume has the same data information as the new storage volume. Through the container storage interface, the snapshot, backup and recovery process can be adapted to various types of storage systems, and the block division allows data to be processed in a fine-grained manner, while supporting distributed storage, improving storage flexibility, and the compression operation effectively reduces the storage space occupied and reduces storage costs. Therefore, while improving the efficiency and reliability of backup and recovery, the flexibility and adaptability of backup and recovery can be improved.
[0059] It should be noted that the method provided in this application can be used in a cloud-native environment and performed on a container management platform (Kubernetes). Kubernetes supports the management of persistent storage and allows containers to use external storage systems such as network attached storage (NAS), cloud storage, etc.
[0060] Based on this, the present application embodiment provides a method for backing up and restoring a native storage volume, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the method for backing up and restoring a native storage volume of the present application.
[0061] In this embodiment, the native storage volume backup and recovery method includes steps S10 to S50:
[0062] Step S10, calling the snapshot function through the container storage interface, taking a snapshot of the current native storage volume, and generating a new storage volume.
[0063] It should be noted that the container storage interface (such as CSI, Container Storage Interface) is a standard interface for managing storage resources, which is often used in containerized environments and can be integrated with the underlying storage system. CSI is a standardized interface. Different storage providers can develop their own plug-ins based on this interface to achieve seamless docking with Kubernetes. CSI can enable storage volume operations (such as creation, deletion, snapshots, etc.) to be performed in a standard manner. It can be understood that in this embodiment, third-party storage requires support for CSI. The snapshot function is used to record the state of the storage volume at a specific point in time. Snapshot capture can take a snapshot of the current state of the storage volume and generate a new storage volume. The current native storage volume is the original storage volume of the system at the time of capture. The new storage volume can be a newly created storage space for saving backup data, which is used to store the complete state of the data in the current native storage volume (i.e., at the moment of capture). Exemplarily, the newly generated volume can be mounted to the minimum operation unit (Pod) of the specified container orchestration engine, and the Pod can include one or more containers.
[0064] It is understandable that the new storage volume can ensure the stability of backup. During the backup process, the native storage volume maintains read and write operations, that is, no operations are performed on the native storage volume, thereby protecting the data of the native storage volume.
[0065] Step S20, dividing and compressing the new storage volume to obtain compressed data blocks.
[0066] It should be noted that block division can be understood as the process of dividing a large data set into multiple smaller data blocks for distributed data processing, and compression can encode data through a specific algorithm to reduce the use of storage space. A compressed data block can be a data unit that has been processed by block division and compression, including compressed storage volume data.
[0067] Step S30: extracting key data blocks from the compressed data blocks according to the demand information.
[0068] It should be noted that the key data block can be understood as the data block that needs to be restored. The demand information can be a set of instructions or parameters for guiding the data recovery process. For example, the demand information includes but is not limited to the data range that needs to be restored, the time point at which the data needs to be restored (indicating the data state at which time point needs to be restored), and the priority of the data that needs to be restored. The demand information can identify and extract parameters or metadata of key data (such as data range, time point, priority or storage location, etc.), and the data block that needs to be restored can be quickly located through the demand information.
[0069] Step S40, decompressing the key data block using a decompression algorithm to obtain a decompressed file block.
[0070] It should be noted that the decompression algorithm can be a process of restoring compressed data to original data. It can be understood that the decompressed file block is a file data block obtained after being processed by the decompression algorithm, which represents the original data restored from the compressed data block.
[0071] Step S50, writing the decompressed file blocks into the newly created blank storage volume to obtain a restored storage volume, and remounting the restored storage volume to the target system.
[0072] It should be noted that the newly created blank storage volume can provide target storage space for the data recovery process. It is understandable that the blank storage volume has not stored any data yet and is used in the data recovery phase. In step S10, the native storage volume and the new storage volume are used in the data backup phase. The native storage volume can be understood as the storage volume that already exists and is in use in the system before the snapshot is captured. The new storage volume, a new storage volume generated by taking a snapshot of the current native storage volume, can contain all the data in the native storage volume at the moment of snapshot capture, that is, a complete copy of the native storage volume at a certain point in time. Mounting can be understood as connecting the storage volume to the target system so that the target system can access the data in the storage volume. By mounting, the files and directories in the storage volume can be directly accessed and used by the operating system or application. The target system can be understood as the system that the user needs to use. For example, the storage category of the storage volume can be modified and converted to the storage category corresponding to the target system. By adding a backup recovery component (such as a storage-backup component), the target system can support the storage volume. It should be noted that the storage-backup component can be understood as a component used in the backup and recovery process, which requires the cooperation of other components, such as Harvester to create virtual machines and restore volumes. Among them, Harvester is built on Kubernetes. It can be understood that the data information in the restored storage volume is the same as the new storage volume.
[0073] In this embodiment, the snapshot function is called through the container storage interface to capture the snapshot of the current native storage volume and generate a new storage volume. The new storage volume is used to store the complete state of the current data. The new storage volume is divided and compressed to obtain compressed data blocks. The division is used for distributed processing of data, and the compression is used to reduce the use of storage space; the key data blocks are extracted from the compressed data blocks according to the demand information, and the demand information is used to guide the data recovery process; the key data blocks are decompressed by the decompression algorithm to obtain decompressed file blocks; the decompressed file blocks are written into the newly created blank storage volume to obtain the restored storage volume, and the restored storage volume is remounted to the target system. The restored storage volume has the same data information as the new storage volume. The container storage interface enables the snapshot, backup and recovery process to adapt to various types of storage systems, and the division enables data to be processed in a fine-grained manner. At the same time, it supports distributed storage and improves storage flexibility. The compression operation effectively reduces the storage space occupied and reduces storage costs. Therefore, while improving the efficiency and reliability of backup and recovery, the flexibility and adaptability of backup and recovery can be improved.
[0074] Reference Figure 2 , Figure 2 This is a flow chart of the second embodiment of the method for backing up and restoring a native storage volume of the present application. Figure 1 The first embodiment shown here proposes a second embodiment of the method for backing up and restoring a native storage volume of the present application.
[0075] In the second embodiment, the step S20 includes:
[0076] Step S201 , dividing the new storage volume into blocks according to a preset block size, and obtaining data from each data block.
[0077] It should be noted that the preset block size can be the size of the data block set in advance according to the system configuration or policy, and the specific setting value can depend on the characteristics of the data, processing efficiency and system requirements. Exemplarily, the preset block size can be 2MB, that is, the data is read block by block in units of 2MB. It should be noted that the value of 2MB comprehensively considers the efficiency of backup storage, deduplication, incremental backup and other related requirements.
[0078] Step S202, calculating the hash value of each data block according to the data of each data block, and determining the storage path of each data block.
[0079] It should be noted that the hash value can be calculated by a hash function on the data of each data block to obtain a unique identifier. The hash value can be a string of fixed length, which is used to identify the corresponding data block to verify the integrity of the data and determine the storage location of the data.
[0080] Step S203: Based on the storage path of each data block, each data block is compressed by a compression algorithm to obtain a compressed data block.
[0081] It should be noted that the storage path can be understood as the specific storage location of the data block in the storage system. The compression algorithm is a method of compressing data to reduce the storage space occupied by the data. It reduces redundancy and reduces the amount of data by encoding the data content. Common compression algorithms include Gzip, LZ4, etc. Gzip is suitable for scenarios with high space efficiency requirements, and LZ4 is suitable for scenarios with high compression speed requirements.
[0082] In this embodiment, the data of the storage volume is divided into multiple smaller data blocks by block division, so that the data can be processed in parallel, which improves the data access speed and processing efficiency. The hash value can generate a unique identifier for each data block to check the integrity of the data and ensure that no data loss or tampering occurs during data transmission or storage. By compressing each data block through a compression algorithm, the size of the data block can be effectively reduced, saving storage space.
[0083] In one implementation, based on the above-mentioned second embodiment, step S202 includes: based on the data of each data block, calculating the hash value of each data block according to a hash algorithm; determining the second-to-last level directory of the corresponding data block storage path according to the first value and the second value of the hash value; determining the first-to-last level directory of the corresponding data block storage path according to the third value and the fourth value of the hash value; determining the storage path of each data block according to the second-to-last level directory of the storage path of each data block and the first-to-last level directory of the storage path.
[0084] It should be noted that the hash algorithm may include MD5, SHA-256, etc. The penultimate directory of the storage path and the penultimate directory of the storage path may be understood as the structural hierarchy of the storage path. By using some characters of the hash value to determine the storage location of the data block, the storage path may be divided into multiple sub-directories, thereby evenly distributing the data blocks.
[0085] Exemplarily, the hash value of a data block is calculated by SHA-256, and the result of the calculation is "e4d7f1b4ed2e42d15898f4b27b019da4". According to the first and second values of the hash value (i.e., e4), the data block can be stored in the second-to-last directory of the path. Exemplarily, a subdirectory named e4 can be created in the path. According to the third and fourth values of the hash value (i.e., d7), a subdirectory named d7 can be further created under the e4 subdirectory, and the final storage path is: ... / e4 / d7 / , and the last directory and the second-to-last directory of the path are respectively determined by partial characters of the hash value.
[0086] In this implementation, by distributing data blocks to different directories according to the first few digits of the hash value, uniform distribution of data can be achieved. Each data block can be distributed to different nodes according to the hash value, which facilitates uniform distribution of data among multiple storage nodes and effectively improves the load balancing of storage. By using some characters of the hash value to determine the storage path of the data block, the storage location of the data can be quickly derived according to the hash value, thereby improving retrieval efficiency.
[0087] Reference Figure 3 , Figure 3 This is a flow chart of the third embodiment of the method for backing up and restoring a native storage volume of the present application. Figure 2 The second embodiment shown provides a third embodiment of the native storage volume backup and recovery method of the present application.
[0088] In the third embodiment, the step S30 includes:
[0089] Step S301: store each compressed data block in a backup storage according to the storage path of each data block.
[0090] It should be noted that backup storage can be understood as a storage space dedicated to storing backup data, which can be a local storage device, cloud storage service, network attached storage (NAS), etc.
[0091] Step S302: read metadata in the backup storage and identify storage volume information that needs to be restored.
[0092] It should be noted that metadata can be understood as "data" that describes data, and is used to record the status, attributes, and related information of the storage volume. Metadata can be stored together with the backup data, and metadata records the information of the original volume. By reading this data, the program that restores the volume can know which data to read, how to decompress, how to restore data, etc. Exemplarily, metadata can include information such as the identifier of the backup volume and the hash value of the data block, which is used to guide the data recovery process.
[0093] Step S303: extract key data blocks from the backup storage based on the storage volume information.
[0094] It should be noted that the key data block may be a data block that needs to be restored. Exemplarily, the data block that needs to be restored may be copied from the backup storage.
[0095] In this embodiment, each compressed data block is stored in the backup storage according to the storage path of each data block, which can effectively prevent data loss caused by equipment failure or human error and ensure the security of system data. Compressing the data block before storing it can not only reduce the size of the data block, but also significantly reduce the space occupied by the backup storage. While reducing the demand and cost of storage hardware, it also speeds up the data transmission speed during the recovery process. By extracting key data blocks from the backup storage through the storage volume information, targeted recovery operations are achieved, avoiding redundant operations caused by full volume recovery, thereby shortening the recovery time and improving the recovery efficiency.
[0096] Reference Figure 4 , Figure 4 This is a flow chart of a fourth embodiment of the method for backing up and restoring a native storage volume of the present application. Figure 3 The third embodiment shown provides a fourth embodiment of the native storage volume backup and recovery method of the present application.
[0097] In the fourth embodiment, the step S50 includes:
[0098] Step S501: Create a blank storage volume in the target system with the same size and attributes as the original storage volume.
[0099] It should be noted that the target system can be a place for receiving and using the restored storage volume, and can be a server, a virtual machine, or any computing device that needs to use the storage volume. The blank storage volume can be a new storage area created in the target system, whose size and attributes are consistent with the original storage volume, but there is no data inside. The blank storage volume is used to receive the data restored from the backup storage, so as to reconstruct the original storage state.
[0100] Step S502: write the decompressed file blocks into the newly created blank storage volume according to the storage path of each data block to obtain a restored storage volume.
[0101] It should be noted that the storage path of a data block refers to the location where each data block is saved in the backup storage, and is used to store or restore the data block to the corresponding storage volume. The decompressed file block can be a data block extracted from the backup storage and restored by a decompression algorithm. Common decompression algorithms include Gzip, LZ4, etc. Gzip is suitable for scenarios with high space efficiency requirements, and LZ4 is suitable for scenarios with high requirements for decompression speed.
[0102] Step S503: remount the restored storage volume to a specified path or device of the target system through a container storage interface.
[0103] It should be noted that the recovered storage volume can be understood as the storage volume obtained by writing the decompressed file blocks to the blank storage volume. The data content is the same as the original storage volume, and contains all the recovered data. By remounting the recovered storage volume to the specified path or device of the target system through the container storage interface, users can seamlessly access and use the recovered data.
[0104] In this embodiment, a blank storage volume is created with the same size and attributes as the original storage volume, ensuring that the restored volume has the same characteristics and capacity as the original volume and can adapt to the original application scenario. The decompressed data blocks are written to the newly created blank storage volume according to their storage paths, ensuring that the data is restored in the original structure and order, and ensuring the consistency of the restored data with the original data in content and structure, which not only improves the accuracy of the data, but also effectively avoids data redundancy or omissions. The restored storage volume is remounted to the target system through the container storage interface, allowing the target system to quickly access and use the restored data, increasing the flexibility of the system, and enabling efficient management and mounting in a variety of different storage devices and environments, solving the problems of limited storage types, lack of versatility, and lack of flexibility.
[0105] In order to make the above embodiments and implementation methods clearer, the present application provides flowcharts of the storage volume backup process and the recovery process, as shown in FIG. Figure 5 and Figure 6 shown.
[0106] In one embodiment, based on the fourth embodiment above, before the step of writing the decompressed file blocks into the newly created blank storage volume according to the storage path of each data block, the step includes: recalculating the hash value of each decompressed file block according to the hash algorithm; comparing the hash value of each decompressed file block with the original hash value of each compressed data block to obtain a comparison result; if the comparison result is the same, writing the decompressed file block into the newly created blank storage volume; if the comparison result is different, reacquiring the decompressed file block from the redundant location of the backup storage, and returning to the step of recalculating the hash value of each decompressed file block according to the hash algorithm.
[0107] Exemplarily, a compressed data block A is extracted from the backup storage, and a decompressed file block A is obtained through a decompression algorithm. The hash value of the decompressed file block A recalculated through the hash algorithm is: "e4d7f1b4ed2e42d15898f4b27b019da4". The hash value of the decompressed file block A can be compared with the hash value of the original compressed data block A. If the hash value of the original compressed data block A is also "e4d7f1b4ed2e42d15898f4b27b019da4", the comparison result is the same, indicating that the data is not damaged or lost, and the decompressed file block is written to the newly created blank storage volume. If the decompressed hash value becomes "f2a1d1e4ab2d47c32a9841f2a8b319d7", that is, the comparison result is different, indicating that an error occurred during the decompression or storage process. The backup storage may include multiple redundant backups. It is understandable that the hash value calculated in step S202 is also used for calibration during the backup process. The calculated hash value will be compared with the hash value of the previous backup. If the data is the same, no backup will be performed again. After retrieving the compressed version of data block A from the redundant location of the backup storage, it is decompressed again, and the hash value of the decompressed file block is recalculated. The comparison step is repeated until the decompressed hash value is consistent with the original hash value.
[0108] In this implementation, the hash value of each decompressed file block is recalculated and compared with the hash value of the original compressed data block, which can ensure that the data in the new volume is consistent with the original volume, improve the reliability of the recovery operation, ensure the correctness of the data written to the blank storage volume, and help prevent system problems and business failures caused by data errors.
[0109] It should be noted that the above examples are only used to understand the present application and do not constitute a limitation on the backup and recovery method of the native storage volume of the present application. More simple transformations based on this technical concept are all within the scope of protection of the present application.
[0110] This application also provides a native storage volume backup and recovery device, please refer to Figure 7 , the native storage volume backup and recovery device includes:
[0111] The snapshot capture module 10 is used to call the snapshot function through the container storage interface, capture the snapshot of the current native storage volume, and generate a new storage volume, where the new storage volume is used to store the complete state of the current data;
[0112] A block compression module 20, used for dividing and compressing the new storage volume to obtain compressed data blocks, wherein the blocks are used for distributed processing of data, and the compression is used to reduce the use of storage space;
[0113] A data extraction module 30, used to extract key data blocks from the compressed data blocks according to demand information, wherein the demand information is used to guide the data recovery process;
[0114] A data decompression module 40 is used to decompress the key data block by using a decompression algorithm to obtain a decompressed file block;
[0115] The data recovery module 50 is used to write the decompressed file block into the newly created blank storage volume to obtain a recovered storage volume, and remount the recovered storage volume to the target system. The data information in the recovered storage volume is the same as that in the new storage volume.
[0116] The native storage volume backup and recovery device provided by the present application adopts the native storage volume backup and recovery method in the above-mentioned embodiment, which can solve the technical problem of low adaptability of data backup and recovery in different demand scenarios. Compared with the prior art, the beneficial effects of the native storage volume backup and recovery device provided by the present application are the same as the beneficial effects of the native storage volume backup and recovery method provided by the above-mentioned embodiment, and other technical features in the native storage volume backup and recovery device are the same as the features disclosed in the above-mentioned embodiment method, which will not be repeated here.
[0117] The present application provides a native storage volume backup and recovery device, the native storage volume backup and recovery device includes: at least one processor; and a memory connected to the at least one processor in communication; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the native storage volume backup and recovery method in the above-mentioned embodiment 1.
[0118] Reference below Figure 8 , which shows a schematic diagram of the structure of a native storage volume backup and recovery device suitable for implementing the embodiment of the present application. The native storage volume backup and recovery device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 8 The backup and recovery device of the native storage volume shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0119] like Figure 8As shown, the backup and recovery device of the native storage volume may include a processing device 1001 (such as a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. Various programs and data required for the operation of the backup and recovery device of the native storage volume are also stored in the RAM 1004. The processing device 1001, the ROM 1002, and the RAM 1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Typically, the following systems can be connected to the I / O interface 1006: input devices 1007 including, for example, a touch screen, a touchpad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; storage devices 1003 including, for example, a magnetic tape, a hard disk, etc.; and communication devices 1009. The communication device 1009 can allow the backup and recovery device of the native storage volume to communicate with other devices wirelessly or by wire to exchange data. Although Figure 8 The backup and recovery device of the native storage volume with various systems is shown, but it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have instead.
[0120] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0121] The native storage volume backup and recovery device provided by the present application adopts the native storage volume backup and recovery method in the above embodiment, which can solve the technical problem of low adaptability of data backup and recovery in different demand scenarios. Compared with the prior art, the beneficial effects of the native storage volume backup and recovery device provided by the present application are the same as the beneficial effects of the native storage volume backup and recovery method provided by the above embodiment, and other technical features in the native storage volume backup and recovery device are the same as the features disclosed in the method of the previous embodiment, which will not be repeated here.
[0122] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0123] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0124] The present application provides a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, the computer-readable program instructions being used to execute the native storage volume backup and recovery method in the above-mentioned embodiment.
[0125] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.
[0126] The computer-readable storage medium may be included in the backup and recovery device of the native storage volume; or may exist independently without being installed in the backup and recovery device of the native storage volume.
[0127] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by the backup and recovery device of the native storage volume, the backup and recovery device of the native storage volume: calls the snapshot function through the container storage interface, captures a snapshot of the current native storage volume, and generates a new storage volume, wherein the new storage volume is used to store the complete state of the current data; divides and compresses the new storage volume to obtain compressed data blocks, wherein the division is used for distributed processing of data, and the compression is used to reduce the use of storage space; extracts key data blocks from the compressed data blocks according to demand information, wherein the demand information is used to guide the data recovery process; decompresses the key data blocks through a decompression algorithm to obtain decompressed file blocks; writes the decompressed file blocks into a newly created blank storage volume to obtain a restored storage volume, and remounts the restored storage volume to the target system, wherein the restored storage volume has the same data information as the new storage volume.
[0128] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0129] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0130] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0131] The readable storage medium provided by the present application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned method for backing up and restoring the native storage volume, and can solve the technical problem of low adaptability of data backup and recovery in different demand scenarios. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided by the present application are the same as the beneficial effects of the method for backing up and restoring the native storage volume provided by the above-mentioned embodiment, and will not be elaborated here.
[0132] The present application also provides a computer program product, including a computer program, which implements the steps of the native storage volume backup and recovery method as described above when the computer program is executed by a processor.
[0133] The computer program product provided by the present application can solve the technical problem of low adaptability of data backup and recovery in different demand scenarios. Compared with the prior art, the beneficial effects of the computer program product provided by the present application are the same as the beneficial effects of the native storage volume backup and recovery method provided by the above embodiment, which will not be repeated here.
[0134] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A method for backing up and restoring a native storage volume, characterized in that: The method includes: Calling the snapshot function through the container storage interface to take a snapshot of the current native storage volume and generate a new storage volume, where the new storage volume is used to store the complete state of the current data; Dividing and compressing the new storage volume to obtain compressed data blocks, wherein the dividing is used for distributed processing of data, and the compression is used to reduce the use of storage space; extracting a key data block from the compressed data block according to demand information, wherein the demand information is used to guide a data recovery process; Decompressing the key data block using a decompression algorithm to obtain a decompressed file block; The decompressed file block is written into a newly created blank storage volume to obtain a restored storage volume, and the restored storage volume is remounted to the target system. The restored storage volume has the same data information as the new storage volume.
2. The method according to claim 1, characterized in that The step of dividing and compressing the new storage volume to obtain compressed data blocks includes: Dividing the new storage volume into blocks according to a preset block size, and obtaining data of each data block; Calculating a hash value of each data block according to the data of each data block, and determining a storage path of each data block; Based on the storage path of each data block, each data block is compressed by a compression algorithm to obtain a compressed data block.
3. The method according to claim 2, characterized in that The step of calculating the hash value of each data block according to the data of each data block and determining the storage path of each data block includes: Based on the data of each data block, a hash value of each data block is calculated according to a hash algorithm; Determine the second-to-last directory of the corresponding data block storage path according to the first and second values of the hash value; Determine the last level directory of the corresponding data block storage path according to the third and fourth digits of the hash value; The storage path of each data block is determined according to the second-to-last level directory of the storage path of each data block and the first-to-last level directory of the storage path.
4. The method according to claim 2, characterized in that The demand information includes storage volume information, and the step of extracting key data blocks from the compressed data blocks according to the demand information includes: Storing each of the compressed data blocks in a backup storage according to the storage path of each of the data blocks; Read the metadata in the backup storage and identify the storage volume information that needs to be restored; Based on the storage volume information, key data blocks are extracted from the backup storage.
5. The method according to any one of claims 1 to 4, characterized in that The step of writing the decompressed file block into the newly created blank storage volume to obtain the restored storage volume, and remounting the restored storage volume to the target system includes: Create a blank storage volume in the target system with the same size and attributes as the original storage volume; According to the storage path of each data block, the decompressed file block is written into the newly created blank storage volume to obtain a restored storage volume; The restored storage volume is remounted to a specified path or device of the target system through a container storage interface.
6. The method according to claim 5, characterized in that The compressed data blocks are identified by hash values, and before the step of writing the decompressed file blocks into the newly created blank storage volume according to the storage paths of the data blocks, the method includes: Recalculate the hash value of each decompressed file block according to the hash algorithm; Comparing the hash value of each decompressed file block with the original hash value of each compressed data block to obtain a comparison result; If the comparison result is the same, the decompressed file block is written into the newly created blank storage volume; If the comparison result is different, the decompressed file blocks are retrieved from the redundant position of the backup storage, and the process returns to the step of recalculating the hash value of each decompressed file block according to the hash algorithm.
7. A native storage volume backup and recovery device, characterized in that: The device comprises: A snapshot capture module is used to call the snapshot function through the container storage interface, capture a snapshot of the current native storage volume, and generate a new storage volume, where the new storage volume is used to store the complete state of the current data; A block compression module, used for dividing and compressing the new storage volume to obtain compressed data blocks, wherein the blocks are used for distributed processing of data, and the compression is used to reduce the use of storage space; A data extraction module, used to extract key data blocks from the compressed data blocks according to demand information, wherein the demand information is used to guide the data recovery process; A data decompression module, used for decompressing the key data block by using a decompression algorithm to obtain a decompressed file block; The data recovery module is used to write the decompressed file block into the newly created blank storage volume to obtain a recovered storage volume, and remount the recovered storage volume to the target system. The data information in the recovered storage volume is the same as that in the new storage volume.
8. A native storage volume backup and recovery device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of the native storage volume backup and recovery method according to any one of claims 1 to 6.
9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the native storage volume backup and recovery method according to any one of claims 1 to 6 are implemented.
10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the steps of the method for backing up and restoring a native storage volume according to any one of claims 1 to 6 are implemented.
Citation Information
Patent Citations
Application processing method and device and related equipment
CN113656149A
Cloud hard disk data compression backup and recovery method and device, equipment and storage medium
CN113722150A
Cited By
Storage volume restoration method, electronic equipment, storage medium and program product
CN120670226A