Disk data backup method, device and equipment

By setting up update cycles in disk data backup and leveraging the advantages of solid-state drives and mechanical hard disks, efficient backup of disk data is achieved, and the problems of low effective storage capacity and low backup efficiency are solved, making full use of disk storage space.

CN119557142APending Publication Date: 2025-03-04BANK OF CHINA
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411603345.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-11
Publication Date
2025-03-04

AI Technical Summary

Technical Problem

Existing disk data backup methods based on disk mirroring lead to reduced effective utilization of disk storage space and low backup efficiency.

Method used

By setting up update cycles and performing backup tasks regularly, we can take advantage of the advantages of solid-state drives and mechanical hard disks to achieve efficient backup of disk data. The specific methods include obtaining the directory list record file and the file list record file, matching file information, updating the backup information, and loading the record file in memory to speed up the matching process.

Benefits of technology

While making full use of disk storage space, it improves the efficiency of disk data backup, solving the problems of low effective storage capacity and low backup efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119557142A_ABST
    Figure CN119557142A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a disk data backup method, device and equipment. The method can be used in the cloud computing field. The method comprises the steps of determining a current moment as an updating moment according to preset updating cycle setting, and obtaining a directory list recording file and a file list recording file; obtaining a plurality of catalogs needing to be synchronized from the source data disk, determining a target catalog needing to be synchronized currently by using the catalog list record file, and backing up the target catalog in the target data disk; obtaining respective second file information of a plurality of second files from a directory needing to be synchronized in the source data disk, for each second file, determining backup information of the second file to a target data disk by utilizing a file list recording file, and if the second file needs to be backed up, backing up the second file to the target data disk; and updating the directory list recording file and the file list recording file. The method is used for achieving the effect of efficiently backing up the disk data while fully utilizing the disk space.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of cloud computing, and in particular to a disk data backup method, device and equipment. Background Art

[0002] At work, people use the disk of the office computer to save data. Due to machine failure or operating errors, the disk data may be damaged or lost. In order to prevent various problems caused by disk data damage or loss, it is necessary to back up the disk data so that the data can be restored using the backup data after a problem occurs.

[0003] When using disk mirroring-based technologies to back up disk data, data backup is achieved through data mirroring. Specifically, when data is written, the data is written to two disks at the same time; when data is read, the data can be read from any of the two disks. Therefore, in actual applications, the storage space of the disk is divided into two parts of equal capacity, and the two parts of the storage space store the same data respectively.

[0004] Since the data is written to two disks at the same time and is completely consistent on the two disks, the effective storage capacity of the entire disk space is only half of the actual total disk storage capacity, resulting in part of the disk storage space not being fully utilized. Summary of the invention

[0005] The embodiments of the present application provide a disk data backup method, apparatus and device for achieving the effect of efficient backup of disk data while fully utilizing the disk storage space.

[0006] In a first aspect, an embodiment of the present application provides a method for backing up disk data, comprising: in response to determining that the current moment is an update moment according to a preset update cycle setting, obtaining a directory list record file and a file list record file; wherein the file list record file includes first file information of a plurality of first files that have been historically backed up from a source data disk to a target data disk, the first file information including a file name, an update time, and a directory where the file is located; the directory list record file includes a plurality of directories that have been historically backed up from the source data disk to the target data disk;

[0007] Acquire multiple directories to be synchronized from the source data disk, and if a target directory to be synchronized is currently determined from the multiple directories to be synchronized according to the directory list record file, back up the target directory in the target data disk;

[0008] Obtaining second file information of each of a plurality of second files from the directory to be synchronized in the source data disk, and for each second file, matching the second file information of the second file with the file list record file; if the matching result indicates that the second file is a newly added file, backing up the second file to the target data disk according to the directory of the second file information; if the matching result indicates that the second file is an updated file of a first file in the target data disk, replacing the first file with the second file;

[0009] The directory list record file and the file list record file are updated according to the information of backing up the target directory and the second file to the target data disk.

[0010] In a possible implementation manner, the acquiring of multiple directories to be synchronized from the source data disk, and determining a target directory to be synchronized currently from the multiple directories to be synchronized according to the directory list record file comprises:

[0011] The root directory of the source data disk is taken as the first level, and the directories of each level are determined step by step from the first level. For each level of directories, the directories that need to be synchronized are determined based on a preset list of directories that do not need to be synchronized.

[0012] For each directory to be synchronized at this level, determine whether the directory to be synchronized is a newly added directory according to the directory list record file. If so, the directory to be synchronized is the target directory; after traversing the directories to be synchronized at this level, enter the next level;

[0013] The acquiring the second file information of each of the plurality of second files from the directory to be synchronized in the source data disk comprises:

[0014] Starting from the root directory of the source data disk, the second file information of one or more second files under each directory to be synchronized at each level is obtained to obtain the second file information of each of the multiple second files.

[0015] In a possible implementation manner, for each second file, matching the second file information of the second file with the file list record file to obtain a matching result includes:

[0016] Matching the second file information of the second file with the plurality of first file information of the file list record file, if the file name and directory of the second file do not successfully match the file name and directory of each of the first file information, the matching result indicates that the second file is a newly added file;

[0017] If the file name and directory of the second file are the same as the file name and directory of the first file information, and the update time of the second file is different from the update time of the first file information, the matching result indicates that the second file is an updated file of the first file.

[0018] In a possible implementation manner, the obtaining of the directory list record file and the file list record file includes:

[0019] The directory list record file and the file list record file are acquired from the memory space, wherein the directory list record file and the file list record file are loaded into the memory space in response to the current time being an update time.

[0020] In one possible implementation, the method further includes:

[0021] In response to receiving a backup instruction to perform a first backup of the data of the source data disk to the target data disk, determining a plurality of directories to be synchronized of the source data disk, files under the directories to be synchronized, and a directory of the target data disk;

[0022] For each directory to be synchronized, if it is detected that there is no directory identical to the directory to be synchronized in the target data disk, the directory to be synchronized is backed up to the target data disk;

[0023] If a third file is stored in the directory to be synchronized, determine whether a file identical to the third file is stored in the target data disk based on the hash value of the file; if not, back up the third file to the directory to be synchronized;

[0024] Generate the directory list record file and the file list record file, wherein the directory list record file includes multiple directories to be synchronized in the source data disk during the first backup, and the file list record file includes third file information of multiple third files under the multiple directories to be synchronized in the source data disk during the first backup, wherein the third file and the third file information are used as the first file and the first file information during subsequent backup and update.

[0025] In one possible implementation, the source data disk includes one or more solid-state hard disks, and the target data disk includes one or more mechanical hard disks.

[0026] In a second aspect, an embodiment of the present application provides a disk data backup device, comprising:

[0027] A configuration module, configured to obtain a directory list record file and a file list record file in response to determining that the current moment is an update moment according to a preset update cycle setting; wherein the file list record file includes first file information of a plurality of first files that have been historically backed up from a source data disk to a target data disk, the first file information including a file name, an update time, and a directory where the file is located; and the directory list record file includes a plurality of directories that have been historically backed up from the source data disk to the target data disk;

[0028] A first synchronization module is used to obtain multiple directories to be synchronized from the source data disk, and if a target directory to be synchronized is currently determined from the multiple directories to be synchronized according to the directory list record file, back up the target directory in the target data disk;

[0029] A second synchronization module is used to obtain second file information of each of the plurality of second files from the directory to be synchronized in the source data disk, and for each second file, match the second file information of the second file with the file list record file; if the matching result indicates that the second file is a newly added file, back up the second file to the target data disk according to the directory of the second file information; if the matching result indicates that the second file is an updated file of a first file in the target data disk, replace the first file with the second file;

[0030] An update module is used to update the directory list record file and the file list record file according to the information of backing up the target directory and the second file to the target data disk.

[0031] In a third aspect, an embodiment of the present application provides a disk data backup device, including: a memory, a processor;

[0032] The memory stores computer-executable instructions;

[0033] The processor executes the computer-executable instructions stored in the memory, so that the processor executes the above first aspect and / or various possible implementations of the first aspect.

[0034] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the first aspect above and / or various possible implementations of the first aspect.

[0035] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the above first aspect and / or various possible implementation methods of the first aspect.

[0036] The disk data storage method, device, electronic device, storage medium and program product provided in the embodiments of the present application perform backup tasks regularly by setting an update cycle; and perform disk data backup by comparing the file directory in the source data disk with the records in the directory list record file, and comparing multiple files under the file directory in the source data disk with the records in the file list record file. The present application performs the task of data backup when the office machine is idle by setting an update cycle, does not set equal conditional restrictions on the storage capacity of the source data disk and the target data disk, and speeds up the efficiency of disk data backup by comparing with the list record file, so as to achieve the effect of efficient backup of disk data while making full use of the disk storage space. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] 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.

[0038] Figure 1 A flowchart of the disk data backup method provided by this application;

[0039] Figure 2 A schematic diagram of the process of first disk data backup provided for this application;

[0040] Figure 3 A schematic diagram of the structure of the disk data backup device provided by this application;

[0041] Figure 4 A schematic diagram of the structure of the disk data backup device provided in this application.

[0042] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0043] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0044] First, the terms involved in this application are explained:

[0045] MD5: Message-Digest Algorithm 5, the fifth version of the message digest algorithm, is a widely used cryptographic hash function that can generate a 128-bit (16-byte) hash value.

[0046] At work, people use the disk of the office computer to save data. Due to machine failure or operating errors, the disk data may be damaged or lost. In order to prevent various problems caused by data damage or loss, it is necessary to back up the disk data so that the backup data can be used to restore the data after the data has problems.

[0047] Generally, the disks of office computers include solid-state drives and mechanical hard drives. Among them, solid-state drives use flash memory technology to store data, so the read and write speeds are relatively fast. However, the storage capacity of solid-state drives is relatively small and the price is relatively high; while mechanical hard drives use magnetic disks and read-write heads to store and read data, so the read and write speeds are relatively slow. However, the storage capacity of mechanical hard drives is relatively large and the price is relatively low. The performance of solid-state drives is more outstanding, especially in terms of system startup, program loading and file transfer, which can greatly improve the user experience; while the performance of mechanical hard drives is relatively slow.

[0048] In the related art, disk data is backed up using disk mirroring technology. When disk data is backed up using disk mirroring technology, multiple physical disks are combined into a logical storage unit. When writing data, the data is written to two disks at the same time; when reading data, the data can be read from any of the two disks. In actual applications, the logical storage unit is divided into two parts with equal storage capacity, and the two storage spaces store the same data respectively.

[0049] Therefore, the effective storage capacity of the disk data backup method based on disk mirroring is only half of the actual total disk storage capacity, resulting in insufficient utilization of the disk storage space. And because multiple physical disks are combined into a logical storage unit, for office computers including solid-state drives and mechanical hard drives, the disk data backup method based on disk mirroring does not fully utilize the advantages of the fast speed of solid-state drives and the large capacity of mechanical hard drives, resulting in low efficiency of disk data backup.

[0050] The disk data backup method provided by the present application uses a solid-state drive as a source data disk and a mechanical hard disk as a target data disk, and does not set equal conditional restrictions on the storage capacity of the source data disk and the target data disk. By setting an update cycle and executing backup tasks regularly, the disk space of the office computer can be fully utilized, and the advantages of fast reading and writing speeds of solid-state drives and large capacity of mechanical hard disks can be brought into play. By loading a directory list record file into memory, determining the file directory to be backed up according to the directory list record file, loading a file list record file into memory, and determining the files to be backed up according to the file list record file, the efficiency of disk data backup is improved. This solves the technical problems of wasting disk storage space and low efficiency of disk data backup in related technologies.

[0051] It should be noted that the method and device for disk data backup of the present application can be used in the field of cloud computing, and can also be used in any field except the field of cloud computing. The application field of the method and device for disk data backup of the present application is not limited.

[0052] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0053] Figure 1 A flowchart of the disk data backup method provided in this application is shown in FIG. Figure 1 As shown, the method includes:

[0054] S101: In response to determining that the current moment is an update moment according to a preset update cycle setting, a directory list record file and a file list record file are obtained; wherein the file list record file includes first file information of multiple first files historically backed up from a source data disk to a target data disk, the first file information includes a file name, an update time, and a directory where the file is located; the directory list record file includes multiple directories historically backed up from a source data disk to a target data disk.

[0055] In this step, in order to ensure that the normal work is not affected when the disk data is backed up, the computer program set in the office machine controls the timer to set the update cycle, and regularly executes the disk data backup method provided by this application. The above timer is set to start the disk data backup task during the non-working time period. It should be noted that the update cycle of the timer setting can also be modified according to the needs of different application scenarios, and the technical solution of this application does not limit this.

[0056] The above-mentioned file list record file records the first file information of multiple first files that have been backed up from the source data disk to the target data disk in the past before executing this backup task. Among them, each backed up first file corresponds to a record in the record table, and each record records the first file information of a first file. The first file information includes the file name, update time, and the directory where the file is located. Among them, the update time corresponds to the time when the first file was last updated and saved, and the directory where the file is located is a complete path starting from the root directory and pointing to the directory of the first file step by step.

[0057] The above directory list record file records multiple directories that have been backed up from the source data disk to the target data disk before executing this backup task. Each backed up directory corresponds to a record in the record table, and each record corresponds to a complete path starting from the root directory and pointing to the backed up directory level by level.

[0058] S102: Acquire multiple directories to be synchronized from the source data disk, and if a target directory to be synchronized is currently determined from the multiple directories to be synchronized according to the directory list record file, back up the target directory in the target data disk.

[0059] In some application scenarios, there are some files stored in the disk. After these files are created, the content of the files remains unchanged and the directories corresponding to the files also remain unchanged, such as the files corresponding to the operating system stored in the office computer disk. Therefore, there is no need to back up such files and their directories. The directory to be synchronized in this application refers to the directory of some files in the source data disk, and these files are files that do not have the above characteristics.

[0060] S103: Obtain the second file information of each of the multiple second files in the directory to be synchronized in the source data disk. For each second file, match the second file information of the second file with the file list record file. If the matching result indicates that the second file is a newly added file, back up the second file to the target data disk according to the directory of the second file information; if the matching result indicates that the second file is an updated file of a first file in the target data disk, use the second file to replace the first file.

[0061] S104: Update the directory list record file and the file list record file according to the information of backing up the target directory and the second file to the target data disk.

[0062] Because the directory list record file records multiple directories that have been backed up from the source data disk to the target data disk in the past, and the file list record file records the first file information of multiple first files that have been backed up from the source data disk to the target data disk in the past. In order to use the directory list record file and the file list record file to perform disk data backup at the next update time, the data information of this backup needs to be updated to the directory list record file and the file list record file.

[0063] For each target directory backed up from the source data disk to the target data disk in this backup task, obtain the complete path of the target directory starting from the root directory in the source data disk and pointing to the target directory level by level, and update it to the directory list record file.

[0064] For each second file backed up from the source data disk to the target data disk in this backup task, the file information of the second file (also called second file information) is obtained in the source data disk, that is, the file name, update time, and file path of the second file. If the file information of the second file has been recorded in the file list record file, the file information obtained this time is used to update the record information in the file list record file; if the file information of the second file is not recorded in the file list, a new piece of file information of the second file is added to the file list record file.

[0065] The disk data backup method provided in the embodiment of the present application sets an update cycle to regularly execute the backup task; and realizes the disk data backup by comparing the file directory in the source data disk with the record in the directory list record file, and comparing the multiple files under the file directory in the source data disk with the record in the file list record file. The present application realizes the task of executing the data backup when the office machine is idle by setting an update cycle, does not set equal conditional restrictions on the storage capacity size of the source data disk and the target data disk, and speeds up the efficiency of the disk data backup by comparing with the list record file, so as to achieve the effect of efficient backup of the disk data while making full use of the disk storage space.

[0066] The following is a more detailed description of the disk data backup method of this application, taking an office computer that uses both a solid-state drive and a mechanical hard drive to store data as an example.

[0067] In order to fully utilize the advantages of fast storage speed of solid state hard disks and large storage capacity and low price of mechanical hard disks, the source data disk of this embodiment includes one or more solid state hard disks to perform complex computing tasks. The target data disk includes one or more mechanical hard disks to back up large amounts of data.

[0068] In a specific implementation manner, obtaining multiple directories to be synchronized from the source data disk in step S102, and determining the current target directory to be synchronized from the multiple directories to be synchronized according to the directory list record file includes the following sub-steps:

[0069] The root directory of the source data disk is taken as the first level, and the directories of each level are determined step by step from the first level. For each level of directory, the directories that need to be synchronized are determined based on the preset list of directories that do not need to be synchronized.

[0070] The above-mentioned list of directories that do not need to be synchronized is to record multiple directories that do not need to be synchronized in the source data disk into a list of directories that do not need to be synchronized before performing disk data backup. Each record in the list corresponds to a directory that does not need to be synchronized, and the directory that does not need to be synchronized can also include one or more nested subdirectories. One or more nested subdirectories under the directory that does not need to be synchronized also do not need to be backed up.

[0071] For each directory to be synchronized at this level, determine whether the directory to be synchronized is a newly added directory based on the directory list record file. If so, the directory to be synchronized is the target directory. After traversing the directories to be synchronized at this level, enter the next level.

[0072] The above method for determining whether the directory to be synchronized is a newly added directory is to match the directory to be synchronized with the directory list record file to determine whether the directory has been recorded in the directory list record file. If the match fails, it means that the directory has not been backed up in the target data disk, and thus the directory is determined to be a newly added directory; if the match succeeds, it means that the directory has been backed up in the target data disk, and thus the directory is determined not to be a newly added directory.

[0073] Acquiring the second file information of each of the multiple second files from the directory to be synchronized in the source data disk in step S103 means: starting from the root directory of the source data disk, acquiring the second file information of one or more second files in each level of the directory to be synchronized, and obtaining the second file information of each of the multiple second files.

[0074] In some implementations of this embodiment, in step S103, for each second file, matching the second file information of the second file with the file list record file to obtain a matching result includes the following sub-steps:

[0075] The second file information of the second file is matched with the multiple first file information of the file list record file. If the file name and directory of the second file do not match the file name and directory of each first file information successfully, it means that the second file is not backed up in the target data disk, and the matching result indicates that the second file is a newly added file.

[0076] If the file name and directory of the second file are the same as the file name and directory of a first file information, and the update time of the second file is different from the update time of the first file information, it means that the second file has been backed up in the target data disk, but the file content of the second file has been updated and saved, then the matching result indicates that the second file is an updated file of the first file.

[0077] The above steps improve the matching speed by comparing the second file information of the second file with the first file information in the file list record file instead of directly comparing the second file with the file in the target data disk, thereby improving the efficiency of disk data backup.

[0078] In some implementations of this embodiment, obtaining a directory list record file and a file list record file includes:

[0079] A directory list record file and a file list record file are obtained from the memory space, wherein the directory list record file and the file list record file are loaded into the memory space in response to the current time being an update time.

[0080] Because the speed of reading data from memory is much faster than that of reading data from disk, the directory list record file and the file list record file can be written from disk to memory. When judging whether a directory or file needs to be backed up, the comparison data can be directly obtained from the directory list record file and the file list record file loaded into memory, which can improve the comparison efficiency and thus improve the efficiency of disk data backup.

[0081] In some implementations of this embodiment, the first backup of disk data is distinguished from non-first backup. Figure 2 The flowchart of the first disk data backup provided for this application is as follows: Figure 2 As shown, the first disk data backup includes the following steps:

[0082] S201: In response to receiving a backup instruction for performing an initial backup of data of a source data disk to a target data disk, determining a plurality of directories to be synchronized of the source data disk, files under the directories to be synchronized, and directories of the target data disk.

[0083] Among them, during the first backup, multiple directories of the source data disk that need to be synchronized and the files under the directories that need to be synchronized are determined, which is consistent with the non-first backup and will not be repeated here.

[0084] S202: For each directory to be synchronized, if it is detected that there is no directory identical to the directory to be synchronized in the target data disk, the directory to be synchronized is backed up to the target data disk.

[0085] When performing the first backup of disk data, the same file may be saved multiple times in the office computer's disk. For directories or files in the source data disk, the same directory or file may have been saved in the target data disk. Therefore, in this step, for each directory to be synchronized, the directory to be synchronized is matched with the file directory in the target data disk to determine whether there is a directory with the same name and path in the target data disk, thereby detecting whether there is the same directory in the target data disk. If there is no same directory, the directory to be synchronized is backed up to the target data disk.

[0086] S203: If a third file is stored in the directory to be synchronized, determine whether a file identical to the third file is stored in the target data disk based on the hash value of the file; if not, back up the third file to the directory to be synchronized.

[0087] In an office environment, a file hash value is a numerical representation of a fixed length by converting the file content through a hash function. Use the MD5 algorithm to calculate the hash value of the file. By inputting different file contents, the MD5 algorithm can generate a unique hash value. The MD5 algorithm has the advantages of simplicity and fast calculation speed. Therefore, in this step, for each third file in the directory to be synchronized, first determine whether a file with the same name can be obtained in the corresponding directory in the target data disk. If there is no file with the same name, back up the third file to the corresponding directory in the target data disk; if there is a file with the same name, use the MD5 algorithm to calculate the hash value of the third file and the file with the same name in the target data disk, and compare whether the two are equal. If they are not equal, it means that there is no identical file in the target data disk, and the third file is backed up to the corresponding directory in the target data disk; if they are equal, it means that the target data disk already has a backup of the third file, and there is no need to back up the third file at this time.

[0088] S204: Generate a directory list record file and a file list record file, wherein the directory list record file includes multiple directories to be synchronized in the source data disk during the first backup. The file list record file includes third file information of multiple third files under multiple directories to be synchronized in the source data disk during the first backup, wherein the third file and the third file information are used as the first file and the first file information during subsequent backup and update.

[0089] The steps for generating the above directory list record file include:

[0090] Create a new directory list record file in the memory. For each directory to be synchronized in the source data disk in step S202, create a new record of the directory in the directory list record file. Then write the directory list record file in the memory to the disk for use in the next disk data backup.

[0091] The steps for generating the above file list record file include:

[0092] Create a new file list record file in the memory. For each third file in the directory to be synchronized in the source data disk in step S203, obtain the file name, update time, and file path of each third file, create a new record of the third file in the file list record file, and record the file name, update time, and file path of the third file. Then write the file list record file in the memory to the disk for use in the next disk data backup.

[0093] The directory list record file and file list record file generated above are used for: in non-first disk data backup, the file list record file generated by the first data backup can be used to determine whether the directory to be synchronized in the source data disk needs to be backed up; the directory list record file generated by the first data backup can be used to determine whether the files under the directory to be synchronized in the source data disk need to be backed up.

[0094] The disk data backup method provided in the embodiment of the present application uses a solid-state hard disk as the source data disk and a mechanical hard disk as the target data disk, making full use of the advantages of the fast read and write speed of the solid-state hard disk and the large capacity and low price of the mechanical hard disk, so that the memory space of the disk is fully utilized. After the first disk data backup, a directory list record file and a file list record file are generated, and they are saved to the disk for use in non-first disk data backup, which provides a basis for improving the backup efficiency of non-first disk data backup. During non-first disk data backup, the efficiency of non-first disk data backup is improved by loading the directory list record file and the file list record file into the memory.

[0095] Figure 3 A schematic diagram of the structure of the disk data backup device provided by this application, such as Figure 3 As shown, the disk data backup device 30 provided in this embodiment includes:

[0096] Configuration module 301, in response to determining that the current moment is an update moment according to a preset update cycle setting, obtains a directory list record file and a file list record file; wherein the file list record file includes first file information of a plurality of first files historically backed up from a source data disk to a target data disk, the first file information including a file name, an update time, and a directory where the file is located; the directory list record file includes a directory historically backed up from a source data disk to a target data disk;

[0097] The first synchronization module 302 is used to obtain multiple directories to be synchronized from the source data disk, and if a target directory to be synchronized is determined from the multiple directories to be synchronized according to the directory list record file, the target directory to be synchronized is backed up in the target data disk;

[0098] The second synchronization module 303 is used to obtain the second file information of each of the plurality of second files from the directory to be synchronized in the source data disk, and for each second file, match the second file information of the second file with the file list record file; if the matching result indicates that the second file is a newly added file, back up the second file to the target data disk according to the directory of the second file information; if the matching result indicates that the second file is an updated file of a first file in the target data disk, replace the first file with the second file;

[0099] The updating module 304 is used to update the directory list record file and the file list record file according to the information of backing up the target directory and the second file to the target data disk.

[0100] In a possible implementation, the first synchronization module 302 is further used to take the root directory of the source data disk as the first level, determine the directories of each level step by step starting from the first level, and for each level of directories, determine the directories that need to be synchronized at that level based on a preset list of directories that do not need to be synchronized.

[0101] For each directory to be synchronized at this level, determine whether the directory to be synchronized is a newly added directory based on the directory list record file. If so, the directory to be synchronized is the target directory; after traversing the directories to be synchronized at this level, enter the next level.

[0102] The second synchronization module 303 is further configured to obtain second file information of one or more second files under each directory to be synchronized at each level starting from the root directory of the source data disk, and obtain second file information of each of the multiple second files.

[0103] In one possible implementation, the second synchronization module 303 is also used to match the second file information of the second file with multiple first file information of the file list record file. If the file name and directory of the second file do not match the file name and directory of each first file information successfully, the matching result indicates that the second file is a newly added file; if the file name and directory of the second file are the same as the file name and directory of a first file information, and the update time of the second file is different from the update time of the first file information, the matching result indicates that the second file is an updated file of the first file.

[0104] In a possible implementation, the configuration module 301 is further used to obtain a directory list record file and a file list record file from the memory space, wherein the directory list record file and the file list record file are loaded into the memory space in response to the current time being an update time.

[0105] In one possible implementation, the configuration module 301 is also used to determine multiple directories to be synchronized on the source data disk, files under the directories to be synchronized, and directories on the target data disk in response to receiving a backup instruction to perform an initial backup of data on the source data disk to the target data disk.

[0106] The first synchronization module 302 is further configured to, for each directory to be synchronized, back up the directory to be synchronized to the target data disk if it is detected that no directory identical to the directory to be synchronized exists in the target data disk.

[0107] The second synchronization module 303 is also used to determine whether a file identical to the third file is stored in the target data disk based on the hash value of the file if a third file is stored in each directory to be synchronized. If not, the third file is backed up to the directory to be synchronized.

[0108] The update module 304 is also used to generate a directory list record file and a file list record file, wherein the directory list record file includes multiple directories to be synchronized in the first backup source data disk, and the file list record file includes third file information of multiple third files under multiple directories to be synchronized in the first backup source data disk, wherein the third file and the third file information are used as the first file and the first file information in the subsequent backup and update.

[0109] In a possible implementation, the configuration module 301 is further used to configure the source data disk as one or more solid-state hard disks and configure the target data disk as one or more mechanical hard disks.

[0110] The disk data backup device provided in this embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be described in detail here.

[0111] Figure 4 This is a schematic diagram of the structure of the disk data backup device provided by this application. Figure 4 As shown, the electronic device 40 provided in this embodiment includes: at least one processor 401 and a memory 402. Optionally, the device 40 also includes a communication component 403. The processor 401, the memory 402 and the communication component 403 are connected via a bus 404.

[0112] In a specific implementation process, at least one processor 401 executes the computer-executable instructions stored in the memory 402, so that at least one processor 401 executes the above method.

[0113] The specific implementation process of the processor 401 can be found in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.

[0114] In the above embodiments, it should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the invention may be directly implemented as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.

[0115] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include a non-volatile memory (Non-volatile Memory, NVM), such as at least one disk memory.

[0116] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present application is not limited to only one bus or one type of bus.

[0117] The present application also provides a computer program product, including a computer program, which implements the above method when executed by a processor.

[0118] The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the above method is implemented.

[0119] The above-mentioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.

[0120] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (Application Specific Integrated Circuits, referred to as: ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.

[0121] The division of units is only a logical function division, and there may be other divisions in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.

[0122] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0123] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0124] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0125] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0126] Finally, it should be noted that those skilled in the art will readily conceive of other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses or adaptations of the present invention, which follow the general principles of the present invention and include common knowledge or customary technical means in the art not disclosed by the present invention, are not limited to the precise structure described above and shown in the drawings, and may be modified and changed in various ways without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.

Claims

1. A method for backing up disk data, characterized in that: include: In response to determining that the current moment is an update moment according to a preset update cycle setting, a directory list record file and a file list record file are obtained; wherein the file list record file includes first file information of a plurality of first files that have been historically backed up from a source data disk to a target data disk, the first file information including a file name, an update time, and a directory where the file is located; the directory list record file includes a plurality of directories that have been historically backed up from the source data disk to the target data disk; Acquire multiple directories to be synchronized from the source data disk, and if a target directory to be synchronized is currently determined from the multiple directories to be synchronized according to the directory list record file, back up the target directory in the target data disk; Obtaining second file information of each of a plurality of second files from the directory to be synchronized in the source data disk, and for each second file, matching the second file information of the second file with the file list record file; if the matching result indicates that the second file is a newly added file, backing up the second file to the target data disk according to the directory of the second file information; if the matching result indicates that the second file is an updated file of a first file in the target data disk, replacing the first file with the second file; The directory list record file and the file list record file are updated according to the information of backing up the target directory and the second file to the target data disk.

2. The method according to claim 1, characterized in that The step of obtaining multiple directories to be synchronized from the source data disk, and determining a target directory to be synchronized from the multiple directories to be synchronized according to the directory list record file comprises: The root directory of the source data disk is taken as the first level, and the directories of each level are determined step by step from the first level. For each level of directories, the directories that need to be synchronized are determined based on a preset list of directories that do not need to be synchronized. For each directory to be synchronized at this level, determine whether the directory to be synchronized is a newly added directory according to the directory list record file. If so, the directory to be synchronized is the target directory; after traversing the directories to be synchronized at this level, enter the next level; The acquiring the second file information of each of the plurality of second files from the directory to be synchronized in the source data disk comprises: Starting from the root directory of the source data disk, the second file information of one or more second files under each directory to be synchronized at each level is obtained to obtain the second file information of each of the multiple second files.

3. The method according to claim 1, characterized in that For each second file, matching the second file information of the second file with the file list record file to obtain a matching result includes: Matching the second file information of the second file with the plurality of first file information of the file list record file, if the file name and directory of the second file do not successfully match the file name and directory of each of the first file information, the matching result indicates that the second file is a newly added file; If the file name and directory of the second file are the same as the file name and directory of the first file information, and the update time of the second file is different from the update time of the first file information, the matching result indicates that the second file is an updated file of the first file.

4. The method according to claim 1, characterized in that The step of obtaining a directory list record file and a file list record file includes: The directory list record file and the file list record file are acquired from the memory space, wherein the directory list record file and the file list record file are loaded into the memory space in response to the current time being an update time.

5. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: In response to receiving a backup instruction to perform a first backup of the data of the source data disk to the target data disk, determining a plurality of directories to be synchronized of the source data disk, files under the directories to be synchronized, and a directory of the target data disk; For each directory to be synchronized, if it is detected that there is no directory identical to the directory to be synchronized in the target data disk, the directory to be synchronized is backed up to the target data disk; If a third file is stored in the directory to be synchronized, determine whether a file identical to the third file is stored in the target data disk based on the hash value of the file; if not, back up the third file to the directory to be synchronized; Generate the directory list record file and the file list record file, wherein the directory list record file includes multiple directories to be synchronized in the source data disk during the first backup, and the file list record file includes third file information of multiple third files under the multiple directories to be synchronized in the source data disk during the first backup, wherein the third file and the third file information are used as the first file and the first file information during subsequent backup and update.

6. The method according to any one of claims 1 to 4, characterized in that: The source data disk includes one or more solid-state hard disks, and the target data disk includes one or more mechanical hard disks.

7. A disk data backup device, characterized in that: include: A configuration module, configured to obtain a directory list record file and a file list record file in response to determining that the current moment is an update moment according to a preset update cycle setting; wherein the file list record file includes first file information of a plurality of first files that have been historically backed up from a source data disk to a target data disk, the first file information including a file name, an update time, and a directory where the file is located; and the directory list record file includes a plurality of directories that have been historically backed up from the source data disk to the target data disk; A first synchronization module is used to obtain multiple directories to be synchronized from the source data disk, and if a target directory to be synchronized is currently determined from the multiple directories to be synchronized according to the directory list record file, back up the target directory in the target data disk; A second synchronization module is used to obtain second file information of each of the plurality of second files from the directory to be synchronized in the source data disk, and for each second file, match the second file information of the second file with the file list record file; if the matching result indicates that the second file is a newly added file, back up the second file to the target data disk according to the directory of the second file information; if the matching result indicates that the second file is an updated file of a first file in the target data disk, replace the first file with the second file; An update module is used to update the directory list record file and the file list record file according to the information of backing up the target directory and the second file to the target data disk.

8. A disk data backup device, characterized in that: include: Memory, processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 6 when executed by a processor.

10. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

Citation Information

Cited By

  • Data processing method and device and electronic equipment

    CN120973756A