Disk volume backup method and system with readable and writable shadow
By creating volume snapshot points, intercepting write operations and generating virtual disk file system objects in Windows systems, the problems of insufficient space, poor performance and data redundancy in the backup process in the prior art are solved, and readable and writeable and data optimized backup of shadow copies are realized.
Patent Information
- Application Number
- CN202111642654.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-29
- Publication Date
- 2025-04-15
- Estimated Expiration
- 2041-12-29
AI Technical Summary
The existing Windows system shadow drivers have problems such as insufficient space, poor performance, and data redundancy during the backup process, and the user cannot control the processing of the original data and the backup data cannot be modified.
Provides a disk volume backup method that can be read and written by shadows. By creating volume snapshot points, intercepting write operations, cache old data, and generating virtual disk and file system objects, users can delete unnecessary files and optimize data storage during backup.
It realizes readable and writeable to the original read-only shadow copy, reduces the amount of backup data, saves storage space, and improves backup performance.
Smart Images

Figure CN114265726B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of disk backup, and in particular relates to a disk volume backup method with readable and writable shadow. Background Art
[0002] The existing disk backup technology mainly uses the Volume Shadow Copy Service (VSS) of Windows. Through the Volume Shadow Copy Service, a disk shadow snapshot can be made for the current physical host at a specified time point, and then the backup is completed after the shadow data is copied.
[0003] The Windows system shadow driver can maintain a snapshot at a certain point in time, but it does not meet the user's backup needs and cannot be started normally in many cases. The main problems with the Windows system shadow driver are:
[0004] 1. The current volume cannot be opened when there is not enough free space.
[0005] 2. Temporary storage files will be generated in the current volume, increasing the backup data.
[0006] 3. When modifying the volume shadow, the modified data will be stored in a temporary file, and the reading and writing of the volume will reduce the backup performance.
[0007] 4. Every time the system is updated, its functions may change, so our backup program needs to be modified synchronously.
[0008] 5. Users cannot control how the system shadow driver processes the original data.
[0009] What's more important is that the shadow copy generated by the Windows system shadow driver for backup cannot be modified, and it contains some data that users do not need to back up, resulting in huge data and excessive space occupation. Summary of the invention
[0010] In view of this, the present invention provides a disk volume backup method and system with readable and writable shadow copies, which delete unnecessary files in the shadow copy before backing up, thereby saving storage space.
[0011] In order to solve the above technical problems, the present invention provides a disk volume backup method with readable and writable shadow, comprising:
[0012] Create volume snapshot points for the volumes that need to be backed up;
[0013] Intercept the upper layer driver write operation to the volume, read out the old data in the storage space of the volume to be written, then perform the write operation, and cache the read old data;
[0014] Create a snapshot access object for providing snapshot data reading;
[0015] Generate a virtual disk, load a file system on the virtual disk, and generate a file system object based on the volume snapshot point in the file system;
[0016] Deleting files in the file system object based on the snapshot point according to user needs;
[0017] Back up the data in the file system object based on the snapshot point after the file is deleted.
[0018] As an improvement, the old data read out is cached in a temporary file at the application layer to avoid cache overflow.
[0019] As a further improvement, after generating a file system object based on the snapshot point in the virtual disk, the data to be written to the virtual disk is written to the file update cache, and when reading data in the virtual disk, the file update cache is read first, and if the data is not in the file update cache, the snapshot access object is called for reading. The file update cache is used to store the rewritten data, which is convenient for fast reading and writing.
[0020] As another further improvement, the virtual disk transmits the read and write operations to the read and write processing program of RamDisk through the shared memory, and the read and write processing program writes the data to be written to the virtual disk into the file update cache.
[0021] As an improvement, the step of creating a snapshot point for the volume to be backed up includes:
[0022] The backup application sends an instruction to the volume filter driver to create a volume snapshot point of the volume;
[0023] After receiving the instruction, the volume filter driver creates a volume snapshot point of the volume.
[0024] As an improvement, the method of intercepting the upper layer driver write operation to the volume, reading out the old data in the storage space of the volume to be written before performing the write operation, and caching the read old data includes:
[0025] The volume filter driver intercepts the upper-layer driver's write operations to the volume;
[0026] The volume filter driver reads out old data in the storage space of the volume to be written, and caches the old data in the memory or the unused storage space of the volume;
[0027] The upper layer driver writes new data into the volume storage space.
[0028] As an improvement, the creating of a snapshot access object for providing snapshot data reading includes:
[0029] The backup application creates a snapshot access object;
[0030] When the snapshot data is read, it is read from a temporary file created by the backup application or directly from a volume filter driver.
[0031] As an improvement, the generating of a virtual disk, loading a file system on the virtual disk, and generating a file system object based on the volume snapshot point in the file system includes:
[0032] The backup application passes the snapshot access object to the RamDisk read and write handlers;
[0033] The read-write processing program starts the RamDisk Driver to generate a virtual disk;
[0034] A file system is loaded in the virtual disk, and a file system object based on the volume snapshot point is generated in the file system.
[0035] As a preferred embodiment, the files in the file system object based on the snapshot point are deleted by the backup application, and the data in the file system object based on the snapshot point after the files are deleted are backed up by the backup application.
[0036] The present invention also provides a disk volume backup system with readable and writable volume shadows, comprising a backup application module located in the application layer and a volume filter driver module located in the system kernel;
[0037] The volume filter driver module includes:
[0038] A volume snapshot point creation unit, used to create a volume snapshot point;
[0039] A command interception unit is used to intercept the upper layer driver write command, read out the old data in the volume storage space where the data is to be written before performing the write operation, and cache the read old data;
[0040] The backup application module includes:
[0041] A snapshot access object creation unit, used for creating a snapshot access object;
[0042] A data cache unit, used for caching data into a temporary file;
[0043] A file deleting unit, used to delete files in the file system;
[0044] The data backup unit is used for performing data backup.
[0045] As an improvement, the backup application module further includes a data cache unit for caching data into a temporary file.
[0046] The invention is beneficial in that: the disk volume backup method with the above steps can arbitrarily modify the volume shadow copy that originally has a read-only attribute, and can filter out redundant files and data during backup, thereby reducing the backup data volume. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] Figure 1 It is a flow chart of the present invention.
[0048] Figure 2 It is a structural principle diagram of the present invention.
[0049] Figure 3 Framework flow chart for Windows system file access. DETAILED DESCRIPTION
[0050] In order to enable those skilled in the art to better understand the technical solution of the present invention, the present invention is further described in detail below in conjunction with specific implementation methods.
[0051] The general framework process of Windows system file access is as follows Figure 3 As shown, including:
[0052] 1. The application calls the system read and write API, generating a request and sending it to the file system driver.
[0053] 2. The file system parses the request content, locates the storage location of the file, converts it into a block read or write request for the volume and sends it to the volume driver.
[0054] 3. The volume driver can include filter drivers, which respond to requests layer by layer starting from the upper volume filter driver. Finally, the volume driver converts the request into a read or write request for the disk and sends it to the disk.
[0055] 4. The disk reads and writes data on the disk, and returns the results to the upper layer layer by layer.
[0056] The volume filter driver in the present invention refers to a driver that intercepts and filters the upper layer read and write requests of the volume, and can extend the function of the device or perform data encryption, etc.
[0057] like Figure 1 As shown, the present invention provides a disk volume backup method with readable and writable shadow, comprising:
[0058] S1 creates a volume snapshot point for the volume to be backed up;
[0059] S2 intercepts the write operation of the upper layer driver to the volume, reads out the old data in the storage space of the volume to be written, then performs the write operation, and caches the read old data;
[0060] S3 caches the old data read out into temporary files at the application layer;
[0061] S4 creates a snapshot access object for providing snapshot data reading;
[0062] S5 generates a virtual disk, loads a file system on the virtual disk, and generates a file system object based on the volume snapshot point in the file system;
[0063] S6 writes the data to be written to the virtual disk into the file update cache, and reads the file update cache first when reading the data in the virtual disk. If the data is not in the file update cache, the snapshot access object is called to read it.
[0064] S7: Deleting files in the file system based on the snapshot point according to user requirements;
[0065] S8 backs up the data in the file system based on the snapshot point after the file is deleted.
[0066] The following is a detailed description of each step.
[0067] Step S1 specifically includes:
[0068] S11 The backup application sends an instruction to the volume filter driver to create a volume snapshot point for the volume;
[0069] After receiving the instruction, the S12 volume filter driver creates a volume snapshot point of the volume.
[0070] The user sends a command to create a volume snapshot point of the volume to be backed up to the volume filter driver of the disk volume to be backed up through the backup application, and the volume filter driver creates a volume snapshot point of the volume after receiving the command. The so-called volume snapshot refers to a completely usable copy of a disk volume, which includes the image of the corresponding data at a certain point in time (the time when the copy starts). The volume snapshot point refers to the above point in time.
[0071] Step S2 specifically includes:
[0072] The S21 volume filter driver refreshes the cache and enters the working state. The purpose of refreshing the cache is to maintain the data consistency of the file system. If some data in the cache is not written to the disk, the data backed up at this point in time will be incomplete.
[0073] The S22 volume filter driver intercepts the upper-layer driver's write operation to the volume in order to prevent the new data from overwriting the old data.
[0074] S23 The volume filter driver reads out old data in the storage space of the volume to be written, and caches the old data; specifically, caches the old data in the memory or in the unused storage space of the volume.
[0075] Specifically, in step S3, the backup application starts a working thread to transmit old data in the volume filter driver cache to the application layer, and caches it in a temporary file to avoid driver cache overflow.
[0076] Specifically, in step S4, the backup application creates a snapshot access object; when reading the snapshot data, it is read from a temporary file created by the backup application or directly from the volume filter driver. The so-called snapshot access object is similar to an access interface to a volume snapshot, and the volume snapshot data can be accessed by calling the snapshot access object.
[0077] Step S5 specifically includes:
[0078] The S51 backup application passes the snapshot access object to the read and write handler of RamDisk; RamDisk is a device type in Windows, and Windows provides sample source code. The driver can create this virtual device.
[0079] S52: the read / write processing program starts the RamDisk Driver to generate a virtual disk;
[0080] S53 loads the file system in the virtual disk, and the operating system generates a file system object based on the volume snapshot point in the file system. At this time, the files in the file system object become modifiable, and the user can modify them arbitrarily.
[0081] Specifically in step S6, the virtual disk passes the read and write operations to the read and write handler of RamDisk through the shared memory, and the read and write handler writes the data to be written to the virtual disk into the file update cache. The virtual disk and the read and write handler share memory, so that data can be communicated between the two. The read and write handler obtains the read and write operation commands for the virtual disk through the shared memory. The so-called file update cache is a space used to store rewritten data. After the data is written into the file update cache, the read request for the virtual disk is read in the file update cache first, thereby improving the reading speed. If the data is not in the file update cache, the snapshot access object created by the previous backup application is called.
[0082] Specifically, in step S7, the user deletes the files in the file system object based on the snapshot point through the backup application.
[0083] Specifically, in step S8, the data in the file system object based on the snapshot point after the file is deleted is backed up by a backup application, and the backup data can be stored locally, on a network, or in the cloud.
[0084] like Figure 2 As shown, the present invention also provides a disk volume backup system in which volume shadow can be read and written, comprising a backup application module located in the application layer and a volume filter driver module located in the system kernel;
[0085] The volume filter driver module includes:
[0086] A volume snapshot point creation unit, used to create a volume snapshot point;
[0087] A command interception unit is used to intercept the upper layer driver write command, read out the old data in the volume storage space where the data is to be written before performing the write operation, and cache the read old data;
[0088] The backup application module includes:
[0089] A data cache unit, used for caching data into a temporary file;
[0090] A snapshot access object creation unit, used for creating a snapshot access object;
[0091] A file deletion unit, used to delete files in the file system object;
[0092] The data backup unit is used for performing data backup.
[0093] The above are only preferred embodiments of the present invention. It should be noted that the above preferred embodiments should not be regarded as limiting the present invention, and the protection scope of the present invention should be based on the scope defined by the claims. For ordinary technicians in this technical field, several improvements and modifications can be made without departing from the spirit and scope of the present invention, and these improvements and modifications should also be regarded as the protection scope of the present invention.
Claims
1. A disk volume backup method with readable and writable shadow, characterized in that include: Create volume snapshot points for the volumes that need to be backed up; Intercept the upper layer driver write operation to the volume, read out the old data in the storage space of the volume to be written, then perform the write operation, and cache the read old data; Create a snapshot access object for providing snapshot data reading; The snapshot access object is an access interface to the volume snapshot, and the volume snapshot data can be accessed by calling the snapshot access object; Generate a virtual disk, load a file system on the virtual disk, and generate a file system object based on the volume snapshot point in the file system; After generating a file system object based on the volume snapshot point in the virtual disk, writing the data to be written to the virtual disk into the file update cache, and reading the file update cache first when reading the data in the virtual disk, and calling the snapshot access object to read if the data is not in the file update cache; Deleting files in the file system object based on the volume snapshot point according to user needs; Back up the data in the file system object based on the volume snapshot point after the file is deleted.
2. The method for backing up a disk volume with readable and writable shadow according to claim 1, characterized in that: Cache the old data read out into a temporary file at the application layer.
3. The method for backing up a disk volume with readable and writable shadow according to claim 1, characterized in that: The virtual disk transmits the read and write operations to the read and write processing program of RamDisk through the shared memory, and the read and write processing program writes the data to be written into the virtual disk into the file update cache.
4. The method for backing up a disk volume with readable and writable shadow according to claim 1, characterized in that The step of creating a volume snapshot point for the volume to be backed up includes: The backup application sends an instruction to the volume filter driver to create a volume snapshot point of the volume; After receiving the instruction, the volume filter driver creates a volume snapshot point of the volume.
5. The method for backing up a disk volume with readable and writable shadow according to claim 1, characterized in that The intercepting of the upper layer driver write operation of the volume, reading out the old data in the storage space of the volume to be written and then performing the write operation, and caching the read old data comprises: The volume filter driver intercepts the upper-layer driver's write operations to the volume; The volume filter driver reads out old data in the storage space of the volume to be written, and caches the old data in the memory or the unused storage space of the volume; The upper layer driver writes new data into the volume storage space.
6. The method for backing up a disk volume with readable and writable shadow according to claim 1, characterized in that The step of creating a snapshot access object for providing snapshot data reading includes: The backup application creates a snapshot access object; When the snapshot data is read, it is read from a temporary file created by the backup application or directly from a volume filter driver.
7. The method for backing up a disk volume with readable and writable shadow according to claim 1, characterized in that The generating of a virtual disk, loading a file system on the virtual disk, and generating a file system object based on the volume snapshot point in the file system comprises: The backup application passes the snapshot access object to the RamDisk read and write handlers; The read-write processing program starts the RamDisk Driver to generate a virtual disk; A file system is loaded in the virtual disk, and a file system object based on the volume snapshot point is generated in the file system.
8. The method for backing up a disk volume with readable and writable shadow according to claim 1, characterized in that The files in the file system object based on the volume snapshot point are deleted by the backup application; and the data in the file system object based on the volume snapshot point after the files are deleted are backed up by the backup application.
9. A disk volume backup system with readable and writable shadows, applied to the disk volume backup method with readable and writable shadows as claimed in any one of claims 1 to 8; characterized in that: It includes a backup application module located in the application layer and a volume filter driver module located in the system kernel; The volume filter driver module includes: A volume snapshot point creation unit, used to create a volume snapshot point; A command interception unit is used to intercept the upper layer driver write command, read out the old data in the volume storage space where the data is to be written before performing the write operation, and cache the read old data; The backup application module includes: A snapshot access object creation unit, used for creating a snapshot access object; A data cache unit, used for caching data into a temporary file; A file deletion unit, used to delete files in a file system object; The data backup unit is used for performing data backup.
Citation Information
Patent Citations
Method and system for backing up data in real time based on snapshot function of memory array
CN102402471A
Redundant data deletion method and system of virtual disks
CN102999433A