A data backup method for reducing RPO
Through interactive simulation of snapshot devices between user-state applications and kernel-state drivers, the data loss problem caused by long snapshot generation time is solved, and efficient data backup is achieved.
Patent Information
- Application Number
- CN202210981402.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-16
- Publication Date
- 2025-07-18
- Estimated Expiration
- 2042-08-16
AI Technical Summary
During the data backup process, creating a snapshot device takes too long, resulting in inaccurate data changes and inaccurate data loss (RPO) cannot be accurately backed up.
User-state applications and kernel-state drivers are used to simulate snapshot devices, interact with kernel-state drivers through IOCTL, create hooks to take over request queues, monitor data changes at any time, and use bitmap information to determine backup data blocks, reducing snapshot generation time.
It greatly reduces snapshot generation time, minimizes data loss to ensure the accuracy and completeness of backup data.
Smart Images

Figure CN115328699B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer application technologies, and particularly to a data backup method for reducing RPO. Background Art
[0002] Data backup is the basis of disaster recovery. To prevent data loss caused by system failures and other reasons, it is an essential operation to back up the data on the host. When backing up data, using a snapshot device for data protection is a relatively common means. A snapshot records the usage situation on the host at a certain point in time. However, when the amount of data on the host is very large, creating a snapshot device takes a lot of time. During this process, if the data on the host changes, the data recorded by the snapshot device will be inaccurate and incomplete, and there will be a data loss volume (RPO), resulting in inaccurate data backup and incorrect data recovery;
[0003] Therefore, a data backup method for reducing RPO is proposed. Summary of the Invention
[0004] In view of this, the purpose of the present invention is not to use a traditional snapshot device, but to use an application program running in the user state and a driver running in the kernel state to simulate a snapshot device, reduce the time for creating a snapshot device, and can monitor the data changes during the backup process in real time, so as to ensure the minimum data loss volume (minimum RPO) of the backup data.
[0005] The technical solution of the embodiment of the present invention is implemented as follows: A data backup method for reducing RPO, which includes:
[0006] Step 1: The user-state application program reads the file / etc / mtab to obtain the devices existing on the system, and calls the system function to obtain the source data volume information to be backed up;
[0007] Step 2: The user-state application program uses IOCTL to interact with the kernel-state driver, and sends the source data volume information to the driver;
[0008] Step 3: After obtaining the source data volume information, the kernel-state driver adds a disk in the general layer according to the source data volume information;
[0009] Step 4: The kernel-state driver creates a hook according to the source data volume information and takes over the request queue of the source data volume;
[0010] Step 5: The user-state application program obtains the bitmap information on the source data volume by calling the interface function provided by the file system, and uses the bitmap information to determine the data blocks that need to be backed up;
[0011] Step 6: The user - mode application uses IOCTL to interact with the kernel - mode driver and notifies the driver of the bitmap information of the source data volume;
[0012] Step 7: The user - mode application starts to access the snapshot device and reads the backup data;
[0013] Step 8: The kernel - mode driver receives the I / O requests of the user - mode application for the snapshot device and determines whether the data block of the current request has undergone COW during the backup process according to the bitmap information;
[0014] Step 9: The user - mode application reads the backup data by accessing the snapshot device and stores the data in the storage medium.
[0015] Further preferably: In step 1, before the backup starts, a driver program is installed and run on the host. The driver program provides READ, WRITE, and IOCTL operations for enabling the user - mode application to interact with the kernel - mode driver;
[0016] READ and WRITE are computer read and write operations, and IOCTL is a function for managing the I / O channels of a device in the device driver. The so - called management of the I / O channel is to control some characteristics of the device, such as the transmission baud rate of the serial port, the rotation speed of the motor, etc. Its number of parameters is as follows: int ioctl(int fd, int cmd,...); where fd is the file identifier returned by the open function when the user program opens the device, cmd is the control command of the user program for the device, and as for the subsequent ellipsis, it is some supplementary parameters, generally at most one, and whether it has or not is related to the meaning of cmd. The ioctl function is an attribute component in the file structure, that is to say, if your driver program provides support for ioctl, the user can use the ioctl function in the user program to control the I / O channel of the device.
[0017] Further preferably: When the backup starts, a user - mode application is started and run on the host.
[0018] Further preferably: In step 3, disk is used to simulate the snapshot device, and during the subsequent backup operation process, this disk is accessed to read the backup data.
[0019] Further preferably: In step 8, the following operations are performed according to whether COW has occurred during the backup process:
[0020] If COW has occurred, the data to be backed up is taken out from the cache file and returned to the application;
[0021] Further preferably: If there is no COW, forward the I / O request to the source data volume, and the source data volume returns the data to the application.
[0022] Further preferably: In step eight, when another application makes an I / O request to the source data volume, the driver detects the I / O request, determines the type of the I / O request, and performs the following operations according to the type of the I / O request:
[0023] The I / O request is to read data: Then forward the I / O request to the source data volume as normal, and the source data volume processes the I / O request;
[0024] The I / O request is to write data: Then the driver determines whether the data block where the data is located has been backed up according to the bitmap information, and performs the following operations according to the backup situation:
[0025] If the data block has been backed up, forward the I / O request to the source data volume, and the source data volume processes the I / O request;
[0026] If the data block has not been backed up, perform COW on the data that needs to be backed up, and then forward the I / O request to the source data volume, and the source data volume continues to process the I / O request.
[0027] To solve the above technical problems, another technical solution adopted by this application is: Provide a data backup device for reducing RPO, which includes:
[0028] A reading module, used to read the file / etc / mtab to obtain the devices existing on the system, and call system functions to obtain the source data volume information to be backed up;
[0029] An interaction module, used for the user-mode application to interact with the kernel-mode driver using IOCTL and send the source data volume information to the driver;
[0030] A driver module, used to create a hook according to the source data volume information and take over the request queue of the source data volume;
[0031] A generation module, used for the kernel-mode driver to add a disk in the general layer according to the source data volume information after obtaining the source data volume information;
[0032] A backup module, used for the user-mode application to read the backup data by accessing the snapshot device and store the data in the storage medium.
[0033] To solve the above technical problems, another technical solution adopted by this application is: to provide a computer device, which includes a processor and a memory coupled to the processor. Program instructions are stored in the memory. When the program instructions are executed by the processor, the processor executes the steps of the data backup method for reducing RPO described in any one of the above claims;
[0034] The processor can also be referred to as the CPU (Central Processing Unit). The processor may be an integrated circuit chip with signal processing capabilities. The processor can also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc.
[0035] To solve the above technical problems, another technical solution adopted by this application is: a storage medium stores program instructions that can implement the data backup method for reducing RPO described in any one of the above steps. Among them, the program instructions can be stored in the above storage medium in the form of a software product, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to execute all or part of the steps of the methods described in various embodiments of this application. The foregoing storage medium includes: various media that can store program codes such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs, or computer devices such as computers, servers, mobile phones, and tablets. The server can be an independent server or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), and big data and artificial intelligence platforms.
[0036] Since the embodiments of the present invention adopt the above technical solutions, they have the following advantages:
[0037] First, the snapshot generation time is reduced: Instead of using the traditional method of creating a snapshot device, a driver is used to add a device at the general level to simulate a snapshot device, greatly reducing the time for using the snapshot device to be generated;
[0038] II. Reducing RPO: It can track and monitor data changes on the source data volume in real time, ensuring that during the backup process, the amount of data loss is minimized to the greatest extent.
[0039] The above summary is only for the purpose of the specification and is not intended to be limiting in any way. In addition to the illustrative aspects, embodiments, and features described above, further aspects, embodiments, and features of the present invention will become apparent by reference to the accompanying drawings and the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the accompanying drawings required for use in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0041] Figure 1 It is a structural diagram of a schematic diagram of the operation of a user-mode application program in an embodiment of the present invention;
[0042] Figure 2 It is a schematic diagram of the preparation before the driver program reads the backup data in an embodiment of the present invention;
[0043] Figure 3 It is a schematic diagram of the driver processing a user-mode application program in an embodiment of the present invention;
[0044] Figure 4 It is a schematic diagram of the driver program processing I / O requests of other application programs in an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0045] The following will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present application.
[0046] The terms "including" and "having" in the present application and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but optionally further includes steps or units not listed, or optionally further includes other steps or units inherent to these processes, methods, products, or devices.
[0047] Reference to "embodiment" in this document means that the specific features, structures, or characteristics described in connection with the embodiment may be included in at least one embodiment of the present application. The phrase appears in various places in the specification and does not necessarily refer to the same embodiment each time, nor is it an independent or alternative embodiment mutually exclusive with other embodiments. Those skilled in the art will explicitly and implicitly understand that the embodiments described herein may be combined with other embodiments.
[0048] Embodiment 1
[0049] As Figures 1-4 shown, an embodiment of the present invention provides a data backup method for reducing RPO, including the following steps:
[0050] S1. Before the backup starts, install and run a driver program on the host. In the driver program, operations such as READ, WRITE, and IOCTL are provided;
[0051] In this embodiment: The driver program provides operations such as READ, WRITE, and IOCTL, facilitating the interaction between user-space application programs and kernel-space driver programs;
[0052] In this embodiment: READ and WRITE are computer read and write operations, and IOCTL is a function for managing the I / O channels of devices in device driver programs. The so-called management of I / O channels means controlling some characteristics of the device, such as the transmission baud rate of the serial port, the rotation speed of the motor, etc. The number of its parameters is as follows: int ioctl(int fd, int cmd,...); where fd is the file identifier returned by the open function when the user program opens the device, cmd is the control command of the user program for the device, and as for the subsequent ellipsis, it is some supplementary parameters, generally at most one, and whether there is or not is related to the meaning of cmd. The ioctl function is an attribute component in the file structure, that is to say, if your driver program provides support for ioctl, users can use the ioctl function in the user program to control the I / O channels of the device.
[0053] S2. Start and run a user-space application program on the host;
[0054] S3. The user-space application program obtains the devices existing on the system by reading the file / etc / mtab and calls the system function to obtain the source data volume information to be backed up;
[0055] S4. The user-space application program uses IOCTL to interact with the kernel-space driver program and sends the source data volume information to the driver program;
[0056] After the kernel-mode driver obtains the source data volume information, it adds a disk in the general layer according to the source data volume information.
[0057] In this embodiment: After the kernel-mode driver obtains the source data volume information, it adds a disk in the general layer according to the source data volume information. This disk is used to simulate a snapshot device. During subsequent backup operations, this disk is accessed to read backup data.
[0058] S6. The kernel-mode driver creates a hook according to the source data volume information and takes over the request queue of the source data volume.
[0059] In this embodiment: The kernel-mode driver creates a hook according to the source data volume information and takes over the request queue of the source data volume. All access operations to the source data volume will pass through the driver, so that the driver can always check the data change situation on the source data volume.
[0060] S7. The user-mode application can obtain the bitmap information on the source data volume by calling the interface function provided by the file system, and use the bitmap information to determine which blocks of data need to be backed up.
[0061] S8. The user-mode application uses IOCTL to interact with the kernel-mode driver and notifies the driver of the bitmap information of the source data volume.
[0062] S9. When the backup data starts, the user-mode application starts to access the snapshot device to read the backup data. At this time, the newly added disk device is accessed. By accessing this disk device, the operation of reading the backup data will first pass through the kernel-mode driver.
[0063] S10. The kernel-mode driver receives the I / O request of the user-mode application for the snapshot device, and judges whether the data block of the current request has undergone COW during the backup process according to the bitmap information. If COW has occurred, the data to be backed up is taken out from the cache file and returned to the application; if COW has not occurred, the I / O request is forwarded to the source data volume, and the source data volume returns the data to the application.
[0064] S101. When other application programs make I / O requests to the source data volume, the driver detects the I / O requests, determines the type of the I / O requests. If the I / O request is for reading data, the driver normally forwards the I / O request to the source data volume, and the source data volume processes the I / O request; if it is for writing data, the driver determines whether the data block where the data is located has been backed up according to the bitmap information. If the data block has been backed up, the driver forwards the I / O request to the source data volume, and the source data volume processes the I / O request; if the data block has not been backed up, the data to be backed up is COWed, and then the I / O request is forwarded to the source data volume, and the source data volume continues to process the I / O request.
[0065] S102. The application program reads the backup data by accessing the snapshot device and stores the data in the storage medium.
[0066] Since then, from the installation and operation of the driver, the operation of the user-mode application program, the generation of the simulated snapshot device, reading the backup data by accessing the snapshot device, and backing up the data to the storage medium, the entire data backup process is completed. In this process, the creation time of the snapshot device is only the time to add a disk at the general layer; during the backup process, the kernel-mode driver can detect and process any changes in the data of the source data volume.
[0067] To solve the above technical problems, another technical solution adopted by this application is: to provide a data backup device for reducing RPO, which includes:
[0068] A reading module, which is used to read the file / etc / mtab to obtain the devices existing on the system, and call the system function to obtain the information of the source data volume to be backed up;
[0069] An interaction module, which is used for the user-mode application program to interact with the kernel-mode driver using IOCTL and send the source data volume information to the driver;
[0070] A driver module, which is used to create a hook and take over the request queue of the source data volume according to the source data volume information;
[0071] A generation module, which is used for the kernel-mode driver to add a disk at the general layer according to the source data volume information after obtaining the source data volume information;
[0072] A backup module, which is used for the user-mode application program to read the backup data by accessing the snapshot device and store the data in the storage medium.
[0073] To solve the above technical problems, another technical solution adopted by this application is: to provide a computer device, which includes a processor and a memory coupled to the processor. Program instructions are stored in the memory. When the program instructions are executed by the processor, the processor executes the steps of the data backup method for reducing RPO as described in any one of the above claims.
[0074] The processor can also be referred to as the CPU (Central Processing Unit). The processor may be an integrated circuit chip with signal processing capabilities. The processor can also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc.
[0075] To solve the above technical problems, another technical solution adopted by this application is: a storage medium storing program instructions capable of implementing the data backup method for reducing RPO as described in any one of the above steps; wherein, the program instructions can be stored in the above storage medium in the form of a software product, including several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to execute all or part of the steps of the method described in various embodiments of this application. The foregoing storage medium includes: various media that can store program codes such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs, or computer devices such as computers, servers, mobile phones, and tablets. The server can be an independent server or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), and big data and artificial intelligence platforms.
[0076] Embodiment 2
[0077] The present invention also provides an embodiment of using the method of the present invention on a host (computer), as follows:
[0078] Install and run the backup driver program backupdriver.ko on the host that needs to perform data backup; (S1)
[0079] Start the backup application backup on the host that needs to back up data; (S2)
[0080] The backup application backup obtains the information of volume / dev / sda1 on the host; (S3)
[0081] The backup application backup sends the volume information to the backup driver backupdriver.ko; (S4)
[0082] After receiving the volume information, the backup driver backupdriver.ko creates a snapshot device / dev / snapshotdev1; takes over the request queue of volume / dev / sda1; (S5, S6)
[0083] The backup application backup obtains the bitmap information of volume / dev / sda1 through the file system and sends it to the backup driver backupdriver.ko; (S7, S8)
[0084] The backup application backup accesses the snapshot device / dev / snapshotdev1 to read the backup data; (S9)
[0085] After receiving the request from the backup application backup to read the snapshot data, the backup driver backupdriver.ko returns the data to the application backup according to the COW situation; (S10)
[0086] The backup driver backupdriver.ko constantly tracks and monitors the data changes on volume / dev / sda1 and performs COW; (S101)
[0087] The backup application backup stores the read data in the storage medium. (S102)
[0088] Since then, all the work of the backup data program has been completed.
[0089] The method can solve the RPO problem caused by the time-consuming creation of snapshot devices and frequent data changes.
[0090] The present invention reduces the snapshot generation time: Instead of using the traditional method of creating snapshot devices, a driver adds a device at the general layer to simulate a snapshot device, greatly reducing the time for using the created snapshot device;
[0091] The present invention reduces RPO: It can constantly track and monitor the data changes on the source data volume, ensuring that during the backup process, the data loss is minimized to the greatest extent.
[0092] When the present invention performs backup, instead of using a traditional snapshot device, a kernel-mode driver adds a disk emulation snapshot device at the general layer, thereby reducing the time used to create a snapshot. At the same time, the driver takes over the request queue of the source data volume, so as to be able to detect data changes in real time, minimizing the amount of data loss and reducing the RPO.
[0093] As described above, the above is only the specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art within the technical scope disclosed by the present invention can easily think of various changes or substitutions thereof, and these should all be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.
Claims
1. A data backup method for reducing RPO, characterized in that , which includes: Step 1: The user-mode application reads the file / etc / mtab to obtain the devices existing on the system, and calls the system function to obtain the source data volume information to be backed up; Step 2: The user-mode application uses IOCTL to interact with the kernel-mode driver and sends the source data volume information to the driver; Step 3: After obtaining the source data volume information, the kernel-mode driver adds a disk in the common layer according to the source data volume information; Step 4: The kernel-mode driver creates a hook according to the source data volume information and takes over the request queue of the source data volume; Step 5: The user-mode application obtains the bitmap information on the source data volume by calling the interface function provided by the file system, and uses the bitmap information to determine the data blocks that need to be backed up; Step 6: The user-mode application uses IOCTL to interact with the kernel-mode driver and notifies the driver of the bitmap information of the source data volume; Step 7: The user-mode application starts to access the snapshot device and reads the backup data; Step 8: The kernel-mode driver receives the I / O request of the user-mode application for the snapshot device, and judges whether the data block of the current request has undergone COW during the backup process according to the bitmap information; Step 9: The user-mode application reads the backup data by accessing the snapshot device and stores the data in the storage medium.
2. The data backup method for reducing RPO according to claim 1, wherein: In Step 1, before the backup starts, the driver is installed and run on the host. The driver provides READ, WRITE, and IOCTL operations for the user-mode application to interact with the kernel-mode driver.
3. A data backup method for reducing RPO according to claim 1, characterized in that: When the backup starts, the user-mode application is started and run on the host.
4. A data backup method for reducing RPO according to claim 1, characterized in that: In Step 3, the disk is used to simulate the snapshot device. During the subsequent backup operation process, this disk is accessed to read the backup data.
5. A data backup method for reducing RPO according to claim 1, characterized in that: In Step 8, the following operations are performed according to whether COW has occurred during the backup process: If COW has occurred, the data to be backed up is taken out from the cache file and returned to the application.
6. The data backup method for reducing RPO according to claim 5, characterized in that: If COW has not occurred, the I / O request is forwarded to the source data volume, and the source data volume returns the data to the application.
7. A data backup method for reducing RPO according to claim 5, characterized in that: In Step 8, when another application makes an I / O request for the source data volume, the driver detects the I / O request, judges the type of the I / O request, and performs the following operations according to the type of the I / O request: The I / O request is to read data: Then the I / O request is normally sent to the source data volume, and the source data volume processes the I / O request; The I / O request is to write data: Then the driver judges whether the data block where the data is located has been backed up according to the bitmap information, and performs the following operations according to the backup situation: If the data block has been backed up, the I / O request is sent to the source data volume, and the source data volume processes the I / O request; If the data block has not been backed up, the data to be backed up is COWed, and then the I / O request is sent to the source data volume, and the source data volume continues to process the I / O request.
8. A data backup device for reducing RPO, which adopts the method according to any one of claims 1-7, characterized in that The device includes: A reading module, configured to read the file / etc / mtab to obtain the devices existing on the system, and call system functions to obtain source data volume information to be backed up; An interaction module, configured to enable a user-space application to interact with a kernel-space driver using IOCTL and send the source data volume information to the driver; A driver module, configured to create a hook according to the source data volume information and take over the request queue of the source data volume; A generation module, configured to add a disk in the general layer according to the source data volume information after the kernel-space driver obtains the source data volume information; A backup module, configured to enable a user-space application to read backup data by accessing a snapshot device and store the data in a storage medium.
9. A computer device, characterized in that, The computer device includes a processor and a memory coupled to the processor. Program instructions are stored in the memory. When the program instructions are executed by the processor, the processor executes the steps of the data backup method for reducing RPO according to any one of claims 1-7.
10. A storage medium, characterized in that, Program instructions are stored, which can implement the data backup method for reducing RPO according to any one of claims 1-7.
Citation Information
Patent Citations
Data protection method and system capable of combining with snapshot function based on distributed block storage
CN105843704A
Data backup method and device
CN106095622A