Data backup method, electronic equipment, storage medium and chip
By generating and comparing the differential files of the file list, and uploading only newly added and modified files in the data backup, the problem of long backup time and low efficiency in the existing technology is solved, and a faster and more efficient backup process is achieved.
Patent Information
- Application Number
- CN202311582119.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-23
- Publication Date
- 2025-05-30
AI Technical Summary
During backup, existing data backup methods will upload all data to be backed up to the cloud server, resulting in long backup time and low efficiency.
By generating the difference files of the first file list and the second file list, only newly added and modified files are uploaded without repeatedly uploading the same files.
Reduces backup time, improves backup efficiency, and reduces the amount of uploaded data.
Smart Images

Figure CN120066848A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of data backup, and in particular, to a data backup method, an electronic device, a storage medium, and a chip. Background Art
[0002] Data backup is the process of backing up data in an electronic device to another electronic device, other storage media, or a server. Among them, the process of backing up data to a server can also be called cloud backup of data. Since the server has a larger storage space, current data backup mainly focuses on cloud backup. An electronic device can perform multiple backups on the data in the same electronic device. Currently, during each backup, all the data to be backed up in the electronic device is backed up to the cloud server. Therefore, the amount of data during the backup process is large and the backup time is long, which affects the backup efficiency. Summary of the Invention
[0003] This application provides a data backup method, an electronic device, a storage medium, and a chip, which can reduce the backup time and improve the backup efficiency.
[0004] To achieve the above object, the first aspect of this application provides a data backup method, which is characterized by including:
[0005] The electronic device generates a first file list according to the attribute information of the directory file of the current backup; the electronic device obtains a second file list during the previous backup, and the second file list includes the attribute information of the directory file during the previous backup; the electronic device obtains the synchronization types of the differential files in the directory file according to the first file list and the second file list, and the synchronization types include: new addition and / or modification; the electronic device sends the differential files to the cloud server.
[0006] During the current backup, this method obtains the file list during the previous backup, compares the local file list during the previous backup with the local file list during the current backup, finds the newly added files and modified files, uploads the newly added files and modified files to the cloud server for backup, and the same files are not uploaded to the cloud server for backup repeatedly, reducing the amount of data and improving the backup efficiency.
[0007] In combination with the method provided in the first aspect, in some embodiments, the attribute information includes a file type, and the file type includes a large file type; the electronic device obtains the synchronization type of the differential file in the directory file according to the first file list and the second file list. The method further includes: the electronic device searches for a first large file with a file type of large file type in the second file list; for each first large file, if the electronic device searches in the first file list for a second large file with the same first attribute information as the first large file and different second attribute information, the synchronization type of the second large file is determined to be modified; for each first large file, if the electronic device searches in the first file list for a third large file with the same first attribute information as the first large file and the same second attribute information, the synchronization type of the third large file is determined to be the same; the electronic device determines the synchronization type of a fourth large file in the first file list other than modified and the same as newly added; the differential file modifies the large file and newly adds a large file, the modified large file is a large file with a synchronization type of modified, and the newly added large file is a large file with a synchronization type of newly added.
[0008] In combination with the method provided in the first aspect, in some embodiments, the first attribute information includes a file ID and a file path; the second attribute information includes a hash value.
[0009] In combination with the method provided in the first aspect, in some embodiments, the differential file includes a newly added large file. The electronic device sending the differential file to the cloud server includes: the electronic device performs a splitting process on the newly added large file to obtain multiple data blocks of the newly added large file; the electronic device sends the multiple data blocks of the newly added large file to the cloud server.
[0010] In combination with the method provided in the first aspect, in some embodiments, the differential file includes a modified large file. The electronic device sending the differential file to the cloud server includes: the electronic device performs a splitting process on the modified large file to obtain a first set composed of multiple first data blocks; the electronic device obtains a fifth large file with the same first attribute information as the modified large file from the second file list, and the first large file includes the fifth large file; the electronic device obtains a second set composed of multiple second data blocks of the fifth large file from the second file list; the electronic device compares the first data blocks in the first set with the second data blocks in the second set to obtain the differential data blocks of the modified large file, and the differential data blocks include modified data blocks and newly added data blocks; the electronic device sends the differential data blocks of the modified large file to the cloud server.
[0011] In combination with the method provided in the first aspect, in some embodiments, the electronic device performing a splitting process on the modified large file to obtain a first set composed of multiple first data blocks includes: the electronic device searches for a specific character in the modified large file; the electronic device splits the modified large file from the position corresponding to the specific character to obtain a first set composed of multiple first data blocks.
[0012] In combination with the method provided in the first aspect, in some embodiments, the attribute information includes the file type, and the file type includes small file types; the attribute information further includes the tar package where each small file is located; the electronic device compares the first file list and the second file list to obtain the synchronization type of the differential files in the directory file, including: the electronic device compares the first file list and the second file list to obtain the changed tar package and the first newly added small file; the electronic device calculates the reuse rate of the small files in the changed tar package; for the first changed tar package with a reuse rate greater than the reuse threshold, the non-reused small files in the first changed tar package are used as the second newly added small files; for the second changed tar package with a reuse rate less than or equal to the reuse threshold, the reused small files and the modified small files in the second changed tar package are used as the third newly added small files; the differential files include the first newly added small files, the second newly added small files, and the third newly added small files.
[0013] In combination with the method provided in the first aspect, in some embodiments, the electronic device sending the differential files to the cloud server includes: the electronic device packs the first newly added small files, the second newly added small files, and the third newly added small files into at least one new tar package according to the packaging rules; the electronic device sends the new tar package to the cloud server, and the data volume of the new tar package is less than the data volume threshold.
[0014] In combination with the method provided in the first aspect, in some embodiments, the number of small files in the changed tar package in the second file list is the first number; the number of reused small files in the first file list is the second number; the reuse rate of the small files in the changed tar package is the ratio of the second number to the first number.
[0015] In combination with the method provided in the first aspect, in some embodiments, the data volume of the small files in the changed tar package in the second file list is the first data volume; the data volume of the first small file reused in the first file list is the second data volume; the reuse rate of the small files in the changed tar package is the ratio of the second data volume to the first data volume.
[0016] In combination with the method provided in the first aspect, in some embodiments, the first reused small file is a small file with the same first attribute information and second attribute information; the non-reused small file is a small file with the same first attribute information and different second attribute information, where the first attribute information includes: file name and file path, and the second attribute information includes the hash value.
[0017] In combination with the method provided in the first aspect, in some embodiments, the attribute information includes the file type, and the file type includes a general file type; the electronic device compares the first file list and the second file list to obtain the synchronization type of the differential files in the directory file, including: the electronic device searches for the first general file with the file type of the general file type from the second file list; for each first general file, if the electronic device finds a second general file in the first file list that has the same first attribute information as the first general file but different second attribute information, the second general file is determined as the modified general file; for each first general file, if the electronic device finds a third general file in the first file list that has the same first attribute information and the same second attribute information as the first general file, the third general file is determined as the same general file; the electronic device determines the synchronization type of the fourth general file in the first file list other than modified and the same as newly added; the differential files include modified general files and newly added general files, the modified general file is the general file with the synchronization type of modified, and the newly added general file is the general file with the synchronization type of newly added.
[0018] In combination with the method provided in the first aspect, in some embodiments, the electronic device sending the differential files to the cloud server includes: the electronic device sends a creation request for the first file to the cloud server, and the creation request for the first file is used to instruct the cloud server to return the unique identifier of the first file on the cloud side when the first file is stored, or return the information that there is no first file when the first file is not stored, and the first file is a modified general file or a newly added general file; if the electronic device receives the information that there is no first file sent by the cloud server, it sends the first file to the cloud server; if the electronic device receives the unique identifier of the first file on the cloud side sent by the cloud server, it does not send the first file to the cloud server.
[0019] In a second aspect, an electronic device is provided, including a processor, and the processor is used to call the computer program stored in the memory to implement the method according to any one of the first aspects of the present application.
[0020] In a third aspect, a chip is provided, including a processor, the processor is coupled with the memory, and the processor executes the computer program stored in the memory to implement the method according to any one of the first aspects of the present application.
[0021] In a fourth aspect, a computer-readable storage medium is provided, and the computer-readable storage medium stores a computer program. When the computer instruction runs on the electronic device, the electronic device is enabled to implement the method according to any one of the first aspects of the present application.
[0022] In a fifth aspect, an embodiment of the present application provides a computer program product. When the computer program product runs on a device, the device is enabled to execute the method according to any one of the first aspects of the present application.
[0023] It can be understood that the beneficial effects of the above second aspect to fifth aspect can be referred to the relevant descriptions in the first aspect above, and will not be elaborated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 It is a schematic diagram of a hardware structure of an electronic device provided by an embodiment of the present application;
[0025] Figure 2 It is a schematic diagram of an interface of a backup application for implementing a cloud backup solution provided by an embodiment of the present application;
[0026] Figure 3 It is a technical architecture diagram of a cloud backup method provided by an embodiment of the present application;
[0027] Figure 4 It is a schematic flowchart of a cloud backup method provided by an embodiment of the present application;
[0028] Figure 5 It is the relationship among application data, application resource files, data snapshots, application metadata, etc. provided by an embodiment of the present application;
[0029] Figure 6 It is a timing diagram of a backup preparation stage in a cloud backup solution provided by an embodiment of the present application;
[0030] Figure 7 It is a timing diagram of a data preparation stage in a cloud backup solution provided by an embodiment of the present application;
[0031] Figure 8 It is a timing diagram of a data uploading to cloud stage in a cloud backup solution provided by an embodiment of the present application;
[0032] Figure 9 It is a timing diagram of a backup completion stage in a cloud backup solution provided by an embodiment of the present application;
[0033] Figure 10 It is the backup methods of three types of files of ordinary files provided by an embodiment of the present application;
[0034] Figure 11 It is the backup methods of three types of files of large files provided by an embodiment of the present application;
[0035] Figure 12 It is the backup methods of three types of files of small files provided by an embodiment of the present application;
[0036] Figure 13 It is a timing diagram of a data preparation stage during re-backup provided by an embodiment of the present application;
[0037] Figure 14Schematic diagram of the process for determining various types of ordinary files provided by the embodiments of the present application;
[0038] Figure 15 Schematic diagram of a large file block provided by the embodiments of the present application;
[0039] Figure 16 Another schematic diagram of a large file block provided by the embodiments of the present application;
[0040] Figure 17 Schematic diagram of the process for determining the classification of small files provided by the embodiments of the present application;
[0041] Figure 18 Schematic diagram of determining the packaging of small files provided by the embodiments of the present application;
[0042] Figure 19 Timing diagram of uploading files to the cloud provided by the embodiments of the present application;
[0043] Figure 20 Process of backing up installation packages A and B provided by the embodiments of the present application.
[0044] Figure 21 Process of restoring the installation package provided by the embodiments of the present application. Detailed implementation manners
[0045] In the following description, for the purpose of illustration rather than limitation, specific details such as specific system architectures and technologies are presented to provide a thorough understanding of the embodiments of the present application. However, those skilled in the art should clearly understand that the present application can also be implemented in other embodiments without these specific details.
[0046] It should be understood that when used in the specification of the present application and the appended claims, the term "comprising" indicates the presence of the described features, wholes, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their combinations.
[0047] It should also be understood that in the embodiments of the present application, "one or more" means one, two, or more than two; "and / or" describes the association relationship of associated objects and indicates that three relationships can exist; for example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone, where A and B can be singular or plural. The character " / " generally represents an "or" relationship between the associated objects before and after.
[0048] In addition, in the description of the specification of the present application and the appended claims, the terms "first", "second", "third", "fourth", etc. are only used for distinguishing descriptions and cannot be understood as indicating or implying relative importance.
[0049] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that a particular feature, structure, or characteristic described in connection with that embodiment is included in one or more embodiments of this application. Thus, statements such as "in one embodiment", "in some embodiments", "in other some embodiments", "in still other embodiments", etc. that appear in different places in this specification do not necessarily all refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized. The terms "comprising", "including", "having" and their variants all mean "including but not limited to", unless otherwise specifically emphasized.
[0050] A data backup method provided by an embodiment of this application can be applied to an electronic device to back up the data in the electronic device to a cloud server. The electronic device can be an electronic device such as a tablet computer, a mobile phone, a wearable device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc. The embodiment of this application does not limit the specific type of the electronic device.
[0051] Figure 1 A schematic structural diagram of an electronic device is shown. The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone interface 170D, a sensor module 180, a key 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. Among them, the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0052] It can be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than those illustrated, or combine certain components, or split certain components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0053] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units may be independent devices or integrated in one or more processors. For example, the processor 110 is used to execute the cloud backup method in the embodiments of the present application.
[0054] A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store the instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to use the instruction or data again, it can directly call it from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0055] The internal memory 121 may be used to store computer-executable program code, and the executable program code includes instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area.
[0056] In addition, the internal memory 121 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The application data, application resource index files, etc. in the embodiments of the present application may all be stored in the internal memory.
[0057] The touch sensor 180K, also known as the "touch panel". The touch sensor 180K can be disposed on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also known as the "touch display screen". The touch sensor 180K is used to detect touch operations acting thereon or nearby. The touch sensor can transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In some other embodiments, the touch sensor 180K can also be disposed on the surface of the electronic device 100, at a different position from that of the display screen 194. For example, operations in the cloud backup interface provided in the embodiments of the present application, etc.
[0058] The electronic device 100 realizes the display function through the GPU, the display screen 194, and the application processor, etc. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to execute mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs, which execute program instructions to generate or change display information.
[0059] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can adopt a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a Miniled, a MicroLed, a Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include one or N display screens 194, where N is a positive integer greater than 1. For example, in the embodiments of the present application Figure 2 The interface shown is displayed by the display.
[0060] The embodiments of the present application do not particularly limit the specific structure of the execution subject of a data backup method, as long as it can communicate according to a data backup method provided in the embodiments of the present application by running the code recording a data backup method of the embodiments of the present application. For example, the execution subject of a data backup method provided in the embodiments of the present application can be a functional module in the electronic device that can call and execute a program, or a communication device applied to the electronic device, such as a chip.
[0061] Data backup is the process of backing up data in an electronic device to another electronic device, other storage media, or a server. The process of backing up data to a server can also be called cloud backup of data. Since the server has a larger storage space, cloud backup is currently the main method of data backup. An electronic device can perform multiple backups of the data in the same electronic device. Currently, during each backup, all the data to be backed up in the electronic device is backed up to the cloud server. Therefore, the amount of data during the backup process may be large and the backup time may be long, affecting the backup efficiency.
[0062] The embodiments of the present application provide a cloud backup solution. When the device performs the first backup or when there is no historical backup record of the device stored in the cloud server (for example, the backup record of the device is cleared and the backup data stored in the cloud server), all the data selected by the user is backed up to the cloud server. During subsequent backups, after generating the local file list of the current backup, some differential files are obtained by comparing the local file list of the current backup with the local file list of the previous backup. Differential files are files other than the same files. Exemplarily, differential files include: newly added files, modified files, and deleted files. Among them, the deleted files in the differential files do not need to be backed up; the newly added files in the differential files need to be backed up; the modified files in the differential files usually also need to be backed up, but the same files do not need to be backed up. In this way, a large number of the same files do not need to be backed up, thereby improving the backup efficiency.
[0063] To more easily understand the backup process during subsequent backups provided by the embodiments of the present application, first, the backup solution provided by the embodiments of the present application is described.
[0064] Refer to Figure 2 , which is a schematic diagram of the interface of a backup application for implementing the backup solution provided by the embodiments of the present application. Users can implement data backup and restoration through the backup application.
[0065] It should be noted that this schematic diagram of the interface is only used to illustrate the following content: This interface can be used to set the frequency of automatic backup of the electronic device, can be used to select the data to be backed up, and can also include an immediate backup control 11. The electronic device can start performing cloud backup after receiving the click operation of the user corresponding to the immediate backup control 11. In actual applications, different interfaces can be set, or the above content can be displayed through multiple interfaces. Figure 2 In specific implementation, the user can open the backup application through the account center in the electronic device to display the interface shown in (a) of
[0066] , and can also open the interface shown in (a) of Figure 2 through the application icon of the backup application displayed on the desktop of the electronic device system, and can also open it in other ways Figure 2 through Figure 2The interface shown in (a) therein.
[0067] The electronic device can automatically start data backup, and this process can be called automatic backup. In Figure 2 In the interface shown in (a) therein, the frequency of automatic backup can be set. For example, backup once every 7 days, backup once every 3 days, backup once a day, etc. The user can display multiple backup frequency options through the control 12 in the interface, and the user selects one of the options to set the frequency of automatic backup. For example, Figure 2 Set to perform automatic backup once every 7 days therein. Of course, in actual applications, the user can use the control 13 to turn on or turn off the automatic backup. The state of the control 13 shown in the figure is the on state of the automatic backup.
[0068] In Figure 2 In the interface described in (a) therein, the user can also select the backup data. The user clicks Figure 2 The backup data setting control 14 shown in (a) therein to enter Figure 2 The backup data setting interface shown in (b) therein.
[0069] Multiple data entries are displayed in the backup data setting interface: system data (such as system settings, alarm settings, input method settings, etc.), desktop layout, gallery, contacts, notes, instant messaging applications. The user can select specific backup data. For example, turning on the control 15 corresponding to the system data entry means that the system data needs to be backed up during the backup process; not turning on the control 16 corresponding to the notes entry means that the data of the notes application does not need to be backed up during the backup process. Refer to Figure 2 , the controls corresponding to the system data, desktop layout, gallery, contacts, and instant messaging applications are all in the on state, and the controls corresponding to the notes application are all in the off state. Then the electronic device can perform data backup on the data of the system data, desktop layout, gallery, contacts, and instant messaging applications, and does not perform data backup on the data of the notes application. In this example, the data of the system data, desktop layout, gallery, contacts, and instant messaging applications can also be called the backup data set by the user. After the user sets the backup data, the electronic device can be triggered to display Figure 2 The interface shown in (a) therein.
[0070] In Figure 2 In the interface shown in (a) therein, the user can trigger the electronic device to perform data backup by clicking the immediate backup control 11. This process can be called manual backup.
[0071] Of course, the electronic device can also automatically trigger the backup of the backup data set by the user based on the set frequency of automatic backup.
[0072] Refer to Figure 3, which is the technical architecture diagram of the backup method provided by the embodiments of this application. This technical architecture diagram involves cloud servers and electronic devices. The backup server and the file storage server can also be deployed on the same server.
[0073] The cloud server includes a backup server and a file storage server. The backup server and the file storage server can be two independent servers.
[0074] The backup server is used to store the backup records and application metadata of each device. Among them, the backup records record the backup ID, backup time, backup size, etc. of each device during cloud backup. A device can perform multiple data backups. Therefore, the backup server can also record the backup ID, backup time, and backup size of each backup when the same device performs multiple data backups. The application metadata records the relevant information of each application in the backup data set by the user (the specific content can refer to the description of the subsequent embodiments).
[0075] The file storage server is used to store the actual files of each application for backup, such as various files such as the database, installation package, audio, video, documents, and pictures of the application.
[0076] In actual applications, the backup server is used to communicate with the electronic device to execute the backup process, and the backup server can store the actual files uploaded by the electronic device in the file storage server. The subsequent embodiments of this application uniformly describe the backup process using the cloud server.
[0077] The electronic device includes a backup application and other applications. The backup application is an application used to implement the backup process, and the other applications are the applications in the backup data set by the user (for example, Figure 2 the gallery application, contact application, and instant messaging application shown in (b) of
[0078] The backup application includes a backup service and a recovery service, as well as some modules that support the backup service and the recovery service (such as a data replication and recovery module, a file upload and download module, and a status detection module);
[0079] Among them, the backup service is used to upload the data in the electronic device to the cloud server, and the recovery service is used to download the data from the cloud server and restore these data to the electronic device.
[0080] The data replication and recovery module includes a data replication module and a data recovery module; the file upload and download module includes a file upload module and a file download module; the status detection module is used to monitor the network status of the electronic device (for example, whether it is connected to a wireless local area network), storage status (for example, whether the local storage space is sufficient to cache the data to be backed up, and whether the cloud server has enough space to back up the data), screen status (for example, whether it is in the locked screen state), and charging status (for example, whether the battery power is sufficient and whether an external power source is connected), etc.
[0081] The backup service includes a data caching module, a data processing module, and a data uploading module. The data caching module is used to call the data replication module to cache the data to be backed up; the data processing module is used to process the cached data to be backed up, for example, assembling small files or fragmenting large files, generating data snapshots based on the data to be backed up, etc.; the data uploading module is used to call the file upload module to upload the processed data to the cloud server.
[0082] The recovery service includes a data download module, a data processing module, and a recovery execution module. The data download module is used to call the file download module to download data from the cloud server; the data processing module is used to decompress, assemble, delete, etc. the downloaded data; the recovery execution module is used to restore the processed data to the original directory.
[0083] Of course, the above cloud backup process can back up system data, system applications, and third-party applications. Among them, when backing up third-party applications, it needs to be implemented through PMS (package manager service) or BMS (backup manager service) in the Framework layer. PMS or BMS can provide the ability to read the data directory generated by the operation of third-party applications.
[0084] In addition, in specific implementation, file scanning rules corresponding to each application (excluding the backup application) can be stored in the electronic device. The file scanning rules of an application record the backup directory and the prohibited backup directory corresponding to the application. In actual applications, the backup service backs up the files in the backup directory to the cloud server; it no longer backs up the files in the prohibited backup directory. For example, when backing up the chat records of an instant messaging application, it does not back up the log files generated during the operation of the instant messaging application.
[0085] Refer to Figure 4 , which is a schematic flow diagram of the cloud backup method provided by the embodiment of the present application.
[0086] The cloud backup method includes three major stages: the backup preparation stage, the backup execution stage, and the backup completion stage. In the backup preparation stage: environmental detection is performed through a status detection module. For example, the status of the electronic device is detected to determine whether the electronic device meets the backup conditions; the remaining storage space of the electronic device and the remaining storage space of the personal account on the cloud server can also be detected to determine whether the remaining storage space of the electronic device is sufficient to cache the backup data and whether the remaining storage space of the personal account on the cloud server is sufficient to backup the data; when the device status detection meets the backup conditions and the storage space is sufficient, a backup ID for this cloud backup of the electronic device is applied for from the cloud server.
[0087] The backup execution stage includes a data preparation stage and a data uploading to the cloud stage. The data uploading to the cloud stage includes an application data (such as the directory file mentioned above) uploading stage, an application resource file uploading stage, and a backup completion stage (for uploading meta data).
[0088] First, it is necessary to cache the application data in the data preparation stage to generate data snapshots (i.e., data preparation), and then upload the application data to the cloud server (i.e., data uploading to the cloud). In practical applications, if the data to be backed up this time includes data of multiple applications (for example, applications A, B, and C), it is necessary to prepare data for one application first and upload the data of this application to the cloud server; after the data of the previous application is uploaded to the cloud server, prepare data for the next application and upload the data of the next application to the cloud server; execute in such a cycle until the data of multiple applications are all uploaded to the cloud server. Of course, in practical applications, it is also possible to complete the data preparation of multiple applications and then upload the data of each application to the cloud server in sequence.
[0089] In the embodiments of this application, taking one application A as an example, the data preparation process and the process of uploading data to the cloud are described. The electronic device reads the directory of the application selected by the user for backup through the PMS or BMS, and caches the application data (such as chat records, pictures, videos, audios, documents, etc.) read from the directory of the application in a temporary storage space; then, the cached application data is processed to generate a data snapshot (details are referred to the following explanations). After generating the data snapshot of application A, the electronic device can upload the application data of application A to the cloud server (i.e., the application data upload stage). After the electronic device uploads the application data, it also needs to upload the application resource files (such as the data snapshot of application A, the installation package, and the icon, etc.) to the cloud server (i.e., the application resource file upload stage). After the upload of the application resource files of application A is completed, the electronic device can upload the metadata (meta) of application A to the cloud server (i.e., the meta data upload stage, which is the backup completion stage). The metadata of this application A includes: information related to the data snapshot of application A, information related to the application installation package, information related to the application icon, etc. In practical applications, some application resource files can be uploaded, and correspondingly, the metadata can also be the information related to some application resource files.
[0090] In the backup completion stage: After confirming that the backup of all applications (such as application A, application B, and application C) in this backup is completed, the overall backup is completed.
[0091] To facilitate the understanding of the professional terms in the above backup execution stage, refer to Figure 5 , which describes the relationships among application data, application resource files, data snapshots, application metadata, etc.
[0092] Application data includes the files to be backed up obtained by scanning the application directory. Taking an instant messaging application as an example, the data of this instant messaging application includes data such as chat records, pictures, videos, audios, and documents.
[0093] The data snapshot is generated from the application data information and records some information of these application data (specifically refer to Table 1 and Table 2). The data snapshot of application A is constructed by two tables, one of which is the local file list (refer to Table 1), and the other is the file list for uploading to the cloud (refer to Table 2).
[0094] The local file list is used to record the information of the files in the application data (such as application ID, file size, hash value, modification time, whether there are changes, file type, etc.), and some information of these files in the electronic device (such as the local file path of the file in the local area and the unique identifier of the file in the local area).
[0095] Table 1 is the local file list app_data_detail provided by the embodiments of this application
[0096]
[0097]
[0098] The cloud upload file list is used to record information about files in the application data (such as application ID, file size, hash value, etc.), as well as some information about these files in the cloud server (such as the download path on the cloud side, the unique identifier on the cloud side).
[0099] Table 2 shows the cloud upload file list upload_app_data_detail provided in the embodiments of the present application
[0100] Field Name Type Description backup_id string Backup ID app_id string Application ID uuid string Local Unique Identifier cloud_name string File Name Rule path(hash)_filename cloud_path string Cloud-side Download Path cloud_fid string Cloud-side Unique Identifier of the File Uploaded to the Cloud fileid cloud_size long File Size cloud_hash string File hash value data1……data10 string Reserved 10 Extension Fields
[0101] The application resource files include: data snapshots, application installation packages, application icons, and application backup descriptions. The application backup description includes: information such as the version of the application installation package and the system version of the electronic device at the time of backup.
[0102] The application metadata records: relevant information about data snapshots, relevant information about application installation packages, relevant information about application icons, relevant information about application backup descriptions, etc.
[0103] As an example of application metadata.
[0104]
[0105]
[0106] It can be understood that the application metadata includes relevant information about snapshot (data snapshot), relevant information about apk (application installation package), relevant information about info.xml (application backup description), and relevant information about icon (application icon).
[0107] After describing the above professional terms, the cloud backup solution provided in the embodiments of the present application will be described in detail below.
[0108] As Figure 4 shown, the cloud backup solution includes: a backup preparation stage, a data preparation stage, a data cloud upload stage (including an application data upload stage and an application resource file upload stage), and a backup completion stage.
[0109] Below, through Figures 6 to 11 describe the above cloud backup solution, where Figure 6 is the timing diagram of the backup preparation stage in the cloud backup solution. Figure 7 And Figure 8 is Figure 6 the specific implementation manner of the environmental state detection in the backup preparation stage shown.Figure 9 It is a timing diagram of the data preparation stage in the cloud backup solution. Figure 10 It is a timing diagram of the data uploading to the cloud stage in the cloud backup solution. Figure 11 It is a timing diagram of the backup completion stage in the cloud backup solution.
[0110] First, describe Figure 6 the timing diagram of the backup preparation stage shown.
[0111] Referring to Figure 2 shown, the automatic cloud backup frequency can be set through the backup application, and it can be set which application data needs to be backed up. The backup application can generate an application list (excluding the note ID) according to the interface shown in (b) of Figure 2 . Therefore, the cloud backup frequency and the application list are recorded in the backup application, and the application ID to be backed up this time is recorded in the application list. When the time corresponding to the cloud backup frequency arrives, the electronic device will execute the subsequent cloud backup process; similarly, when the electronic device receives a click operation on the control 11, the electronic device will also execute the subsequent cloud backup process. In the embodiment of this application, the above cloud backup solution is described by taking the data backup of Application A this time as an example. In specific implementation, after Application A is backed up, the next application is backed up.
[0112] S101, after the backup service reaches the automatic backup time point or receives a manual backup operation, it sends an environment status acquisition request to the status detection module.
[0113] In the embodiment of this application, whether it is manual backup or automatic backup, backup conditions are set, and the backup conditions include various states of the electronic device, such as network status (connected to a wireless local area network), battery status (the battery of the electronic device is greater than 10%), storage space status (for example, the remaining storage space of the electronic device is greater than 5G), etc. Of course, in actual application, in order to make the backup process not easy to be interrupted, more backup conditions can be set. For example, the remaining storage space of the personal space in the cloud server can also be increased to be greater than 5G, etc.
[0114] It should be noted that the numbers such as 10% and 5G are only for illustration and do not impose any limitation on this application. The subsequent embodiments of this application will respectively describe in detail the backup conditions for automatic backup and the backup conditions for manual backup, and each state in the above backup conditions can be obtained through the status detection module.
[0115] S102, after the status detection module receives the device status acquisition request, it detects the device status.
[0116] The environment status is related to the pre-set backup conditions, such as the battery status, screen status, remaining storage space, and network status of the electronic device, etc.
[0117] In practical applications, during automatic backup, the status detection module detects multiple environmental statuses related to the backup conditions of automatic backup; during manual backup, the status detection module detects multiple environmental statuses related to the backup conditions of manual backup. For details, refer to the description of the following embodiments.
[0118] S103. The status detection module sends the detected environmental status to the backup service.
[0119] Exemplarily, the device status is: connected to the wireless local area network, connected to an external power source, the remaining storage space of the electronic device is greater than 5G (it can also be the specific remaining storage space of the electronic device), and the screen lock state.
[0120] S104. After receiving the environmental status sent by the status detection module, the backup service determines that the environmental status meets the backup conditions.
[0121] Exemplarily, the set conditions for automatic cloud backup include: connected to the wireless local area network, connected to an external power source, the remaining local storage space is greater than the threshold, and the screen is locked. It can be determined that the device status received in S103 meets the conditions for automatic cloud backup.
[0122] In practical applications, the backup service can send a request for obtaining the environmental status to the status detection module once to instruct the status detection module to detect the environmental status. In practical applications, the backup service can also send multiple different environmental status detection instructions to the status detection module. Different environmental status detection instructions correspond to different detection contents. For example, the power status detection instruction is used to detect the power status; the screen status detection instruction is used to detect the screen status.
[0123] S105. When the device status meets the backup conditions, the backup service sends a backup ID application request to the cloud server.
[0124] As mentioned above, the backup IDs of different devices are different. Therefore, each time a backup ID is applied for, the unique identifier of this device needs to be carried. For example, the MAC address of the device can be used as the unique identifier.
[0125] S106. After receiving the backup ID application request, the cloud server generates the backup ID for this cloud backup according to the device unique identifier.
[0126] In practical applications, when generating the backup ID, the backup ID and the historical backup ID of the same device each time a backup is performed are also different. Therefore, other parameters can also be combined when generating the backup ID, such as the current backup time, etc.
[0127] S107. The cloud server sends the generated backup ID to the backup service.
[0128] S108. When the backup service determines that the device status meets the backup conditions, it can also send an environmental monitoring request to the status detection module.
[0129] Only when the current status meets the condition of automatic backup, send a device status monitoring instruction to the status detection module to instruct the status detection module to continue monitoring the device status; similarly, the backup service can send a monitoring request to the status detection module, or can send multiple device status monitoring requests to the status detection module. Different environmental monitoring requests correspond to different monitoring contents.
[0130] S109. After receiving the device status monitoring request, the status detection module starts to monitor the device status.
[0131] In the embodiment of the present application, the status detection module detects the device status to obtain the current device status; the status detection module monitors the device status by detecting the device status in real time according to a certain time period.
[0132] S110. The backup service receives the information that the status detection module starts monitoring.
[0133] In the above embodiment, there is no strict sequence between the backup service executing step S105 and executing step S108. The backup service can also execute step S108 first and then execute step S105.
[0134] S111. After receiving the backup ID, the backup service establishes a corresponding relationship between the application list and the backup ID.
[0135] S112. The backup service updates the backup stage of each application in the backup data table to the initial state.
[0136] The cloud backup solution provided by the embodiment of the present application performs backups from the application dimension. The backup service backs up the applications in the backup list in sequence, that is, only after one application is backed up will the next application be backed up. The embodiment of the present application sets up a backup data table for each application, and the backup stage of the application is recorded in the backup data table; therefore, in the case of backup interruption, the backup service can view the backup data tables of each application in the backup list to determine which applications have been backed up (for example, the backup stage is backup completed), and which applications have not been backed up (for example, the backup stage is the initial state).
[0137] In addition, in practical applications, it is possible that a backup interruption occurs during the backup process of a certain application. In order to resume the interrupted application backup process, the backup execution process of a single application can also be divided into several more detailed backup stages: data preparation stage, application data upload stage, application resource file upload stage, and application backup completed. At the same time, corresponding status identifiers are set for multiple backup stages. For example, when the data preparation stage is completed: 10; when the application data upload is completed: 20; when the application resource file upload is completed: 30; when the backup is completed: 200. Of course, before backing up an application, the backup stage needs to be initialized to the initial state, and the initial state can be represented by the character "0".
[0138] After each backup stage is completed, update the status identifier in the application's backup data table. In the case of a backup interruption, it is possible to determine which stages of the current application backup process have been completed based on the status identifier recorded in the application's backup data table, and continue the subsequent backup process from which stage. Among them, the application's backup data table can refer to Table 3 shown below.
[0139] Table 3 Application's Backup Data Table cbk_backup_app_info
[0140]
[0141] After step S111, the status identifier corresponding to the initial state is recorded in the stage of each application in the backup data table. Subsequently, the backup service can sequentially back up the data related to each application to the cloud server according to the recorded application list.
[0142] In practical applications, a backup data table can be set for each application, or the information of multiple applications can be recorded in the form of entries in a single backup data table.
[0143] In Figure 6 In the example shown, during the backup preparation stage, the backup service needs to determine whether the current backup conditions are met through the status detection module. Similarly, during the backup process, the backup service also needs to monitor the device status through the status detection module to interrupt the backup when the device status is not suitable for continued backup.
[0144] The embodiments of the present application set the backup conditions that the device status needs to meet during automatic backup; the backup conditions that the device status needs to meet during manual backup are also set.
[0145] For example, the conditions for automatic cloud backup include: connecting to an external power source, screen lock, accessing a wireless local area network, local remaining storage space being greater than a threshold; the remaining storage space of the personal account being greater than a threshold, etc. The backup conditions for manual backup include: accessing a wireless local area network, battery power being greater than 10%, local remaining storage space being greater than a threshold; the remaining storage space of the personal account being greater than a threshold, etc. Of course, the above examples are only for illustration.
[0146] As Figure 6 shown, after the backup preparation stage ends, the backup stage of each application in the data table is in the initial state. The subsequent backup service will, according to the application list of this backup, sequentially back up the data of each application to the cloud server. The data preparation stage in the process of backing up one of the applications (for example, Application A) is described below.
[0147] Referring to Figure 7 , it is the timing diagram of the data preparation stage in the data backup process of Application A provided by the embodiment of the present application.
[0148] S401, the backup service reads the file scanning rules of Application A.
[0149] In the embodiment of the present application, this configuration file (json file) can record the file scanning rules of one or more applications. The file scanning rules record the backup directory and the prohibited backup directory of the application. The backup service can upload the files in the backup directory to the cloud server and will not upload the files in the prohibited backup directory to the cloud server.
[0150] In practical applications, different file scanning rules can be set for different applications, the same file scanning rules can be set for the same type of applications, or the same file scanning rules can be set for all applications.
[0151] S402, the backup service sends a scanning instruction for the directory files of Application A to the data replication and recovery module, and this scanning instruction carries the file scanning rules of Application A.
[0152] Exemplarily, the scanning instruction carried can be the backup directory and the prohibited backup directory of Application A.
[0153] In specific implementation, the backup service can call the data replication module in the data replication and recovery module to scan the directory of Application A through the data replication module.
[0154] As an example, sdcard / picture / xxx.xxx.xxx / is the backup directory, and / data / data / xxx.xxx.xxx / file / b3d74ae13647da4b7f8b259c376834 / attachment / .ref / d / eda84554-7892-4124-8f1d-7f69d38fcebd is the prohibited backup directory.
[0155] S403, after the data copy and recovery module receives the scan instruction of the directory file of Application A, it obtains the number of files and file information in the backup directory of Application A according to the file scan rule of Application A.
[0156] As an example of file information, the file information includes: file path, file name, file size, file hash value.
[0157] sdcard / picture / xxx.xxx.xxx, mmexport1699003060871.mp4, 15.32MB, ngreht8dhge47tgdtgh;
[0158] / android / data / xxx.xxx.xxx / file / e2b13889818aa6a711935f5481405139 / music, piecebc16b1ac66e102953d7397dccd0002e2, 3.35MB, ithdbght246bgdg.
[0159] In this process, the data copy module in the data copy and recovery module traverses the backup directory of Application A through BMS or PMS, thereby copying all files in the backup directory of Application A. These are obtained through the backup directory and can also be recorded as directory files.
[0160] S404, the data copy and recovery module obtains the file information of Application A.
[0161] S405, the data copy and recovery module sends the file information to the backup service.
[0162] S406, after the backup service receives the file information, it records the file information of Application A in the local file list of the data snapshot of Application A. In this step, the relevant information of the application data of Application A scanned is recorded in the local file list of the data snapshot.
[0163] As an example of the local file list (application ID, number of files, file path, file name, file size, file hash value):
[0164] dsgrbgfd, 1, sdcard / picture / xxx.xxx.xxx, mmexport1699003060871.mp4, 15.32MB, ngreht8dhge47tgdtgh;
[0165] dsgrbgfd, 1, / android / data / xxx.xxx.xxx / file / e2b13889818aa6a711935f5481405139 / music, piecebc16b1ac66e102953d7397dccd0002e2, 3.35MB, ithdbght246bgdg.
[0166] S407, The backup service sends a fetch instruction to the data replication and recovery module, and the fetch instruction carries the relevant information of each file.
[0167] The relevant information can be information such as the file path used to locate the file.
[0168] S408, After receiving the fetch instruction, the data replication and recovery module fetches the file from the directory of Application A according to the file information.
[0169] Among them, replication is only one way of fetching, and in practical applications, it can also be cutting. For example, in order to save storage space, some files in the gallery application can be cut and then uploaded to the cloud server. S409, The data replication and recovery module obtains the file from Application A.
[0170] S410, The data replication and recovery module sends the file of Application A to the backup service.
[0171] S411, After receiving the file from Application A, the backup service processes the file of Application A to obtain one or more cloud - uploaded files of Application A.
[0172] As an example of the processing, a file with a large amount of data can be split into small data blocks, and the small data blocks are cloud - uploaded files; or multiple files with a small amount of data can be packaged, and the packaged file is a cloud - uploaded file.
[0173] In practical applications, it is also possible to directly package or split these files when the data replication and recovery module copies them. The embodiments of the present application do not limit the specific modules for realizing packaging and splitting.
[0174] S412, The backup service updates some basic information in the cloud - uploaded file list of the data snapshot according to each cloud - uploaded file.
[0175] For example, write the application ID, local unique identifier, number of files, file size, hash value, etc.
[0176] S413. The backup service updates the backup stage in the backup data table of application A to indicate that data preparation is complete.
[0177] Exemplarily, the backup data table sequentially records: backup ID, application ID, backup stage; fenegfhhgdg, 5ffd64w9, 10; where fenegfhhgdg is the backup ID, 5ffd64w9 is the application ID, and 10 indicates that the data preparation stage is complete.
[0178] Refer to Figure 8 , which is a timing diagram of the data cloud - uploading stage in the backup process of application A provided by the embodiment of the present application. The data cloud - uploading stage includes an application data uploading stage, an application resource file uploading stage, and a backup completion stage.
[0179] In the embodiment of the present application, the basic information of the cloud - uploaded files has been stored in the cloud - uploaded file list. After any cloud - uploaded file is backed up to the cloud server, the cloud server will return the relevant information of the cloud - uploaded file on the cloud server. For example, the unique identifier of the cloud - uploaded file on the cloud side. The electronic device writes the unique identifier of the cloud - uploaded file on the cloud side in the cloud - uploaded file list. Therefore, by traversing the cloud - uploaded file list, the cloud - uploaded files without the unique identifier on the cloud side can be obtained, so as to upload each cloud - uploaded file in the cloud - uploaded file list to the cloud server.
[0180] S501. After the backup service updates the backup stage in the backup data table of data A to indicate that data preparation is complete, it traverses the cloud - uploaded file list in the data snapshot of application A to obtain the file ID of the cloud - uploaded file without the unique identifier on the cloud side.
[0181] S502. The backup service sends a file upload instruction to the file upload / download module. The file upload instruction carries the cloud - uploaded file without the unique identifier on the cloud side in the cloud - uploaded file list or the cache address of the cloud - uploaded file without the unique identifier on the cloud side in the cloud - uploaded file list. The file upload instruction can also carry the file ID of the cloud - uploaded file.
[0182] Alternatively, the file upload instruction can carry the file ID of the cloud - uploaded file without carrying the cloud - uploaded file itself.
[0183] The backup service can obtain the cloud - uploaded file from the cache space according to the file ID and send it to the file upload / download module.
[0184] This process can call the file upload module in the file upload / download module.
[0185] S503, after the file upload and download module receives a file upload instruction, it uploads the cloud-bound files without a cloud-side unique identifier in the cloud-bound file list to the cloud server.
[0186] S504, after the cloud server receives the cloud-bound files, it generates cloud-bound information.
[0187] This cloud-bound information is used to update various information in the cloud-bound file list, such as the unique identifier on the cloud server and / or the storage path on the cloud server, etc.
[0188] S505, the cloud server sends the cloud-bound information to the file upload and download module.
[0189] S506, after the file upload and download module receives the cloud-bound information, it sends the cloud-bound information to the backup service.
[0190] S507, after the backup service receives the cloud-bound information, it writes the cloud-bound information of the uploaded file (including the cloud-side unique identifier) into the cloud-bound file list.
[0191] In this step, it is also necessary to write the cloud-side unique identifier in the cloud-bound information into the reference of the local file list.
[0192] The process from step S501 to step S507 is looped until each cloud-bound file of application A recorded in the cloud-bound file list is uploaded to the cloud server. After each cloud-bound file of application A recorded in the cloud-bound file list is uploaded to the cloud server, each cloud-bound file of application A in the cloud-bound file list has a cloud-side unique identifier.
[0193] S508, after the backup service determines that all cloud-bound files in the cloud-bound file list have cloud-side unique identifiers, it updates the backup phase in the backup data table of application A to application data upload completed.
[0194] Exemplarily, the information of application A recorded in the backup data table is: xxx (backup ID).xxx (application ID).20.
[0195] S601, after the backup service updates the backup phase in the backup data table of application A to application data upload completed, it reads the application resource files of application A.
[0196] In the embodiment of the present application, the application resource files of application A include data snapshots, installation packages, icons, and application backup descriptions.
[0197] In specific implementation, it is also necessary to upload one application resource file and then upload the next application resource file.
[0198] S602, The backup service sends a file upload instruction to the file upload / download module. The file upload instruction carries an application resource file or the storage address of an application resource file.
[0199] S603, After receiving the file upload instruction, the file upload / download module sends the application resource file to the cloud server.
[0200] S604, After receiving the application resource file, the cloud server generates cloud upload information based on the application resource file. The cloud upload information also includes the unique identifier of the application resource file.
[0201] S605, The cloud server sends the cloud upload information of the application resource file to the file upload / download module.
[0202] S606, After receiving the cloud upload information, the file upload / download module sends the cloud upload information to the backup service.
[0203] The processes of steps S601 to S606 are looped until each application resource file is uploaded to the cloud server.
[0204] S606, After determining that the cloud-side unique identifier of each application resource file is received, the backup service updates the backup stage in the backup data table of Application A to "application resource file upload completed".
[0205] In the embodiment of the present application, the number of application resource files is small. After the cloud server receives an application resource file, it also sends the cloud-side unique identifier of the application resource file to the backup service. Therefore, the backup service can determine the uploaded application resource files and the un-uploaded application resource files based on the received cloud-side unique identifiers, so as to upload each application resource file to the cloud server.
[0206] S701, After updating the backup stage in the backup data table of Application A to "application resource file upload completed", the backup service generates metadata of Application A based on the cloud upload information of the application resource files of Application A.
[0207] S702, The backup service sends a backup completion confirmation request of Application A to the cloud server. The request carries the metadata of Application A.
[0208] S703, After receiving the request, the cloud server compares the stored application resource files and metadata of Application A to determine that the backup of Application A is completed.
[0209] S704, The cloud server sends information indicating that the backup of Application A is completed to the backup service.
[0210] After the backup service in S705 receives the information that the backup of Application A sent by the cloud server is completed, it updates the backup stage in the backup data table of Application A to backup completed.
[0211] After step S705, the backup of Application A in the application list is completed, and the data backup process of Application A can continue to backup the data of other applications in the application list. For example, execute Figure 9 and Figure 10 The process shown continues to backup the data of Application B. If this backup process includes more applications, loop to execute Figure 9 and Figure 10 Since other applications have also been backed up to the cloud server, the embodiments of this application will not elaborate further.
[0212] After each application in the application list is backed up, it is necessary to execute Figure 9 The timing diagram of the backup completed stage shown.
[0213] S801, the backup service checks that the backup stage in the data table of each application in the application list is backup completed.
[0214] S802, the backup service sends an overall backup completion confirmation request to the cloud server, and this request carries the application list.
[0215] S803, after the cloud server receives the overall backup completion confirmation request, it compares the received application list with the metadata of the stored applications to confirm the overall backup completion.
[0216] S804, the cloud server sends the information of overall backup completion to the backup service.
[0217] S805, the backup service deletes the cached data.
[0218] The cached data deleted by the backup service can be the application data of each cached application, etc. In practical applications, the cached data of one application can be deleted after each application is backed up to save the cache space; or all the cached data can be deleted after all applications are backed up. The embodiments of this application do not limit the specific implementation method.
[0219] S806, generate a mark for this backup completion. After S806, this backup process ends.
[0220] In the above backup process, the backed-up application data can be divided into three categories according to the file size: ordinary files, small files, and large files.
[0221] Ordinary files are data with a file size between 2 - 500M. For example, the database files of system applications, recordings, videos, etc.;
[0222] Small files are data with a file size less than 2M. For example, even though there is a large amount of data generated during the operation of a communication application.
[0223] Extra-large files are files with a file size greater than 500M. For example, the database file of an instant messaging application.
[0224] Of course, the above classification method is only for example. In actual applications, other data sizes can also be selected as the basis for distinguishing different types of files. For example, 5M and 1G are used to distinguish small files, ordinary files, and large files.
[0225] Among them, there are some differences in the backup methods for different types of files. The backup methods for ordinary files, small files, and large files will be described separately below.
[0226] Refer to Figure 10 This is the backup method for ordinary files provided by the embodiments of this application. Taking the data in an application as an example.
[0227] For ordinary files, by comparing the files in the local file list of the current backup with the files in the local file list of the previous backup, the files in the local file list of the current backup can be divided into identical ordinary files, identical ordinary files, identical ordinary files. And different types of files have different backup strategies.
[0228] Identical ordinary files: The information recorded in the local file list during the previous backup of a file is the same as the information recorded in the local file list during the current backup. For example, the file path, file size, file modification time, hash value, etc. are all the same. This type of identical ordinary file does not need to be backed up this time.
[0229] Newly added ordinary files: Ordinary files that did not exist in the local file list during the previous backup but exist in the local file list during the current backup.
[0230] Modified ordinary files: Among the information recorded in the local file list during the previous backup and the information recorded in the local file list during the current backup, some information is the same (for example, the application ID is the same, the file path is the same, the file name is the same), and some information is different (for example, the file modification time is different, the file size is different, the file hash value is different, etc.).
[0231] In practical applications, the addition and modification of ordinary files may also occur on the cloud server. For example, file A during the second backup is determined to be a newly added ordinary file. During the second backup, file A is uploaded to the cloud server. Then, the user deletes file A locally. During the third backup, file A is determined to be a deleted ordinary file and is not uploaded. Then, the user writes file A in the electronic device again. During the fourth backup, file A is determined to be a newly added ordinary file. However, during the fourth backup, file A may not need to be backed up again, but the file A can be reused through the cloud server.
[0232] Refer to Figure 11 , which is the backup method for large files provided by the embodiments of the present application.
[0233] For large files, by comparing the files in the local file list of the current backup with the files in the local file list of the previous backup, the files in the local file list of the current backup can be classified into identical large files, modified large files, and newly added large files, and different types of files have different backup strategies.
[0234] Identical large files: The information recorded in the local file list during the previous backup is consistent with the information recorded in the local file list during the current backup. For example, the file path, file size, file modification time, hash value, etc. are all consistent. This type of identical large files does not need to be backed up this time.
[0235] Newly added large files: Large files that do not exist in the local file list during the previous backup but exist in the local file list during the current backup.
[0236] Modified large files: Among the information recorded in the local file list during the previous backup and the information recorded in the local file list during the current backup, some information is consistent (for example, the application ID is consistent, the file path is consistent, the file name is consistent), and some information is inconsistent (for example, the file modification time is inconsistent, the file size is inconsistent, the file hash value is inconsistent, etc.).
[0237] The process of distinguishing identical large files, newly added large files, and modified large files can refer to the process of distinguishing identical ordinary files, newly added ordinary files, and modified ordinary files described in the above embodiments, and the present application will not elaborate.
[0238] For large files, it is relatively rare that newly added large files or modified large files have already been stored on the cloud server. Therefore, the situation of whether they already exist on the cloud server is not considered. However, the data volume of a single large file is large, the process of uploading to the cloud occupies a large amount of network bandwidth, and the backup efficiency is relatively low. Once an interruption occurs, it needs to be uploaded again. Therefore, in the embodiments of the present application, the large file is divided into multiple data blocks, and the multiple data blocks obtained by the division are respectively uploaded to the cloud server.
[0239] For the newly added large files in a large file, multiple data blocks can be obtained through splitting processing, and then multiple data blocks can be backed up.
[0240] For the modified large files in a large file, multiple data blocks can also be obtained through splitting processing. For the same large file, the multiple data blocks split during the previous backup are compared with the multiple data blocks split during this backup. The unchanged data blocks are not backed up but reused, and the changed data blocks are backed up, thereby improving the backup efficiency.
[0241] When comparing these split data blocks, the relevant information of these data blocks can be compared. For example, the relationship between multiple data blocks corresponding to a large file is recorded in the reference in the local file list of the large file; among them, each data block also has a local file list, and whether the file type is a DB shard file (i.e., a data block) is recorded in the node_taye in the local file list of each data block; since each data block also has its own corresponding local file list, the method for comparing whether the data blocks are exactly the same can also refer to the method for determining whether ordinary files are exactly the same described in the above embodiments. This application will not elaborate further.
[0242] Refer to Figure 12 , for small files, they are backed up in the form of tar packages. Therefore, it is necessary to determine whether they are the same tar package, a modified tar package, and a newly added small file in the form of tar packages. The tar packages and files in the local file list of this backup and the local file list of the previous backup have the following relationships:
[0243] Same tar package: The small files in the tar package during the previous backup all exist and are not modified during this backup. This type of tar package has been backed up to the cloud server during the previous backup, so there is no need to back it up this time.
[0244] Changed tar package: The small files in the tar during the previous backup all exist but are modified during this backup, or some of the small files in the tar during the previous backup exist during this backup.
[0245] Newly added small file: A small file that does not exist in the local file list during the previous backup but exists in the local file list during this backup.
[0246] For the same tar package, it has been backed up to the cloud server during the previous backup, so there is no need to repeat the backup this time;
[0247] For the changed tar package, the reuse rate of this changed tar package can be checked. The changed tar package involves three types of small files: the same small files, deleted small files (no need to back up), and modified small files.
[0248] Among them, the reuse rate is the percentage (quantity percentage or data volume percentage) of small files in the tar package during the previous backup that still exist during the current backup.
[0249] If the reuse rate is greater than 90%, the same small files are not backed up, and the tar package from the previous backup is reused; the modified small files are processed in the same way as newly added small files.
[0250] If the reuse rate is less than or equal to 90%, the same small files and modified small files in the tar are processed in the same way as newly added small files.
[0251] The newly added small files are packaged into a new tar package according to the packaging limit and then backed up.
[0252] After describing the processing methods for various types of files, the current backup process is described in detail.
[0253] Refer to Figure 13 , which is the timing diagram of the data preparation stage for the second backup based on the data preparation stage of the first backup shown in Figure 7 .
[0254] During non-first backups, after recording the scanned file information in the local file list of the data snapshot of Application A at S406, the local file list in the data snapshot corresponding to the current backup ID can be obtained.
[0255] S415, after the backup service obtains the local file list in the data snapshot corresponding to the current ID, it sends a request to the cloud server to obtain the previous backup record of this device, and this acquisition request can carry the unique identifier of this device.
[0256] S416, after the cloud server receives this acquisition request, it sends the previous backup record of this device to the backup service, and this backup record records the data snapshot during the previous backup.
[0257] For ordinary files, execute S417 to S421 to obtain the files to be uploaded to the cloud. For large files, execute S417 to S422 to obtain the files to be uploaded to the cloud. For small files, execute S417 to S422 to obtain the files to be uploaded to the cloud.
[0258] In practical applications, you can first obtain the files to be uploaded to the cloud for a certain type of file (for example, ordinary files), and then obtain the files to be uploaded to the cloud for the next type of file (for example, large files), until obtaining the files to be uploaded to the cloud for ordinary files, large files, and small files.
[0259] Taking the cloud-based files of a certain type of files as an example: S417. Compare the local file list of the previous time with the local file list of this time to obtain the differential files (for example, newly added, modified, etc.).
[0260] In the embodiments of the present application, according to the size of the files in the application data, the files are divided into: ordinary files, large files, and small files. Different files are processed differently. Therefore, it is necessary to determine the processing method of the differential files. Refer to the chunking process shown in Figure 15 and the packaging process shown in Figure 18 respectively.
[0261] S418. The backup service sends a fetch instruction (carrying the information of the differential files) to the file copy and recovery module.
[0262] S419. After receiving the fetch instruction, the file copy and recovery module obtains the files according to the differential file information.
[0263] S420. The file copy and recovery module obtains the differential files from a third-party application.
[0264] S421. The file copy and recovery module sends the differential files to the backup service.
[0265] S422. The backup service obtains the cloud-based files according to the file type and the processing methods of different differential files: re-packaging, sharding.
[0266] The subsequent steps are similar and can be referred to in detail in Figure 7 and will not be elaborated here.
[0267] Refer to Figure 14 , which is the schematic flow chart corresponding to step 417 when obtaining the cloud-based files of ordinary files in Figure 13 .
[0268] S901. The backup service obtains the ordinary file entries from the local file list of the previous backup according to the identifier of the ordinary files.
[0269] The backup service checks the files with node_type being 6 in the local file list of the previous backup, so as to filter out the ordinary file entries.
[0270] S902. The backup service filters out the file entries with the same file path and the same file ID (the file entries of the ordinary files in this backup) from the local file list at the time of this backup based on the file path and file ID of the obtained ordinary file entries;
[0271] S903, The backup service obtains the hash values and file sizes of these filtered files in the local file list of the previous backup; obtains the hash values and file sizes of these filtered files in the local file list of the current backup.
[0272] S905, Determine whether the hash values are consistent and whether the file sizes are all consistent.
[0273] S906, If they are all consistent, determine them as the same ordinary files;
[0274] S907, If one of the hash value and the file size is inconsistent, determine them as modified ordinary files.
[0275] In practical applications, after S902, it further includes:
[0276] S904, The backup service determines the files other than the files filtered out from the local file list of the current backup and with the file type of ordinary files as newly added ordinary files.
[0277] As mentioned above, for newly added ordinary files and modified ordinary files, in the case where they have been backed up to the cloud server in an earlier backup process, the electronic device does not need to perform repeated backups, thus reducing the situation of repeated backups.
[0278] To make the backup process of ordinary files clearer, the backup process of ordinary files is described below through a specific example.
[0279] Referring to Table 4, it is an example of the multiple backup processes of ordinary files provided by the embodiments of the present application.
[0280] Table 4 Multiple backup processes of ordinary files
[0281]
[0282] When the device performs the first backup or when there is no historical backup record of the device stored in the cloud server, the backup is performed according to the Figures 6 to 11 backup process shown. Among them, in step S407, the obtained processing method is not to process (i.e., not to split and not to package).
[0283] When performing the first backup, the backup ID of the first backup is obtained: backup_record_01. This backup ID corresponds to recording that the local file list 1 is A1, B1, C1, and the corresponding cloud-bound file list 1 is A1, B1, C1. Actually, the files transmitted from the electronic device to the cloud server are A1, B1, C1. It can be understood that the files in the current file list, the cloud-bound file list, and the transmitted file list during the first backup are the same.
[0284] During the second backup, the backup ID is backup_record_02, and the local file list 2 generated during the second backup is B1, C2, D1. By comparing the local file list 1 and the local file list 2, the differential files are obtained: A1, C2, and D1.
[0285] Among them, A1 is a deleted file and does not need to be backed up and uploaded this time;
[0286] C2 is a modified file and needs to be re-backed up and uploaded this time;
[0287] D1 is a newly added file and needs to be backed up and uploaded this time.
[0288] Therefore, during the second backup, the cloud upload file list 2 obtained is C2 and D1. Then, the local file list 2 recorded by the backup ID of the second backup is B1, C2, D1, but the recorded cloud upload file list 2 is C2, D1, and the transfer file list is: C2, D1.
[0289] During the third backup, the backup ID is backup_record_03, and the local file list 3 generated during the third backup is A1, B1, D1, E1. By comparing the local file list 3 and the local file list 2, the differential files are obtained: A1, C2, and E1.
[0290] Among them, A1 is a newly added file and is in the historical cloud upload file list. Therefore, it does not need to be backed up either, but the second transmission ability or reuse can be adopted;
[0291] C2 is a deleted file and does not need to be backed up and uploaded this time;
[0292] E1 is a newly added file and is not in the historical cloud upload file list. Therefore, it needs to be backed up and uploaded.
[0293] Therefore, during the third backup, the cloud upload file list 3 obtained is A1, E1, but the actual transfer file list is E1. Then, the local file list 3 recorded by the backup ID of the third backup is A1, B1, D1, E1, but the recorded cloud upload file list 3 is A1 and E1, and the actual transfer file list is E1.
[0294] The above process is only one implementation method for ordinary file backup. In actual applications, there can be other implementation methods.
[0295] Exemplary: Instead of comparing the local file list of the current backup with the local file list of the previous backup; each time a backup is performed, before each ordinary file in the local file list is uploaded to the cloud, a file pre-creation request is sent to the cloud server first to solve the problem of duplicate uploads of the same ordinary file through the instant upload function (or reuse). There is no need to obtain the local file list corresponding to the previous backup record; there is no need to compare the local file lists; the cloud server will not accidentally delete files when cleaning files; however, a lot of invalid file pre-creation requests will be generated, and the request pressure on the cloud server is relatively high; the cloud server generates a relatively large number of cloud-side unique identifiers using the instant upload function.
[0296] It is also possible to compare the local file list of the current backup with the local file lists of all previous backups to determine that the file to be uploaded to the cloud is E1. Duplicate file identification is more accurate; however, it is necessary to obtain the local file list corresponding to the backup record for each backup; the complexity of comparing local file lists is high and the efficiency is low.
[0297] Refer to Figure 15 , which is a method for splitting large files provided by an embodiment of the present application.
[0298] In order to have more identical data blocks during two splits, the large file can be segmented according to the characteristics of the file content itself. For example, specific content in the large file can be used as the end of each data block. Starting from the file header of the large file, when the specific content is traversed, the specific content is used as the end of the previous data block for splitting, so as to split the large file into multiple data blocks. As an example of the specific content, 4 consecutive 0 bytes can be used as the specific content, that is, when "0000" is traversed, "0000" is used as the end of the previous data block for splitting, and the next byte after "0000" is used as the start of the next data block, and the traversal continues backward.
[0299] If the newly added content falls within a certain data block and there is no specific content in the newly added content, the start and end of the data block remain unchanged, the content and size of the data block change, and other data blocks remain unchanged;
[0300] If the newly added content falls within a certain data block and there is specific content in the newly added content, the data block is split at the place of the specific content, and other data blocks remain unchanged.
[0301] If the deleted content is the content within a certain data block, the start and end of the data block remain unchanged, the content and size of the data block change, and other data blocks remain unchanged;
[0302] If the deleted content covers the split position of two data blocks, these two data blocks are merged into one data block, and other data blocks remain unchanged.
[0303] At the first backup, the following data blocks are divided according to the file content: C1, C2, C3, C4, C5, C6, C7.
[0304] At the second backup, new content is added to the file. The new content falls within the C4 data block and does not include specific characters. Therefore, the C4 data block becomes larger and is denoted as C8, while the other data blocks remain unchanged. Continuing to divide into blocks according to the second method: C1, C2, C3, C8 (larger than the original C4), C5, C6, C7.
[0305] At the third backup, new content is added to the file. The new content is within C5 and includes specific characters. Therefore, the original C5 is split into two data blocks, denoted as C9 and C10 respectively, while the other data blocks remain unchanged. Continuing to divide into blocks according to the second method: C1, C2, C3, C8, C5 (the new content with specific characters is split into C9 and C10), C6, C7.
[0306] At the fourth backup, content is deleted from the file. The deleted content covers the splitting position of two data blocks (C2 and C3), so these two data blocks (C2 and C3) are merged into one data block (C11), while the other data blocks remain unchanged. Continuing to divide into blocks according to the original method: C1, C11 (part of the content in the original C2 and part of the content in the original C3 are merged), C8, C9, C10, C6, C7, and the other data blocks remain unchanged.
[0307] At the fifth backup, content is deleted from the file. The deleted content is within the C1 data block, so the C1 data block becomes smaller and is denoted as C12, while the other data blocks remain unchanged. Continuing to divide into blocks according to the second method: C12 (smaller than C1), C11, C8, C9, C10, C6, C7.
[0308] Of course, after each split, the data blocks that are the same as those in the previous backup do not need to be backed up; the data blocks that are different from those in the previous backup need to be backed up.
[0309] Refer to Figure 16, which is another way to split large files provided by the embodiments of this application. The large file can be split into multiple data blocks according to a fixed length. For example, a 1G video is split into multiple data blocks: B1, B2, B3, B4, and B5 by splitting it every 200M in length, and then the multiple data blocks obtained by splitting are uploaded to the cloud server. However, this method is more suitable for the case without data insertion and deletion. Referring to the second backup, when there is data insertion and deletion, it will cause the data to be offset as a whole from the modified position. Therefore, if the splitting continues at a length of 200M, the multiple data blocks obtained by this splitting may be: B6, B7, B8, B9, B10, and B11. Since the position of the inserted data is relatively forward, although the data blocks obtained by this splitting and the previous splitting are of the same size, their contents are completely different. Therefore, during the second backup, the multiple data blocks obtained by the second splitting still need to be uploaded to the cloud server.
[0310] Refer to Figure 17 , which is the backup process of small files provided by the embodiments of this application.
[0311] S1001, The backup service obtains the ordinary file entry from the local file list of the previous backup according to the identifier of the ordinary file.
[0312] S1002, The backup service determines the small file set of each tar package based on the reference of these small files in the local file list during the previous backup.
[0313] S1003, The backup service searches for the small files in each tar package that are the same as those in the previous backup in the local file list of this backup.
[0314] S1004, The backup service determines whether the number of the same small files in these small file sets is greater than 90%.
[0315] S1005, When the number of the same small files in the tar package is greater than 90%, reuse the old tar package for the same small files without backup; pack the modified small files and the newly added small files into a new tar package.
[0316] S1006, When the number of the small files still existing in the tar package is less than or equal to 90%, pack these still existing small files and the newly added small files into a new tar package.
[0317] Refer to Figure 18 , which is the packaging process of small files provided by the embodiments of this application.
[0318] At the first backup, the small files in the local file list include: a, b, c1, d. Multiple small files can be packaged into one tar package. For example, a, b, c1, and d are packaged into tar package 1. In practical applications, the upper limit of each tar package can be set. For example, it can be 100M, 150M, 200M, etc.
[0319] At the second backup, the small files in the local file list include a, b, c2 (the file after modifying c1), d, e, f, g. Check the reuse rate of tar package 1 in the previous backup. If the reuse rate of tar package 1 is greater than 90%, then continue to reuse the previous tar package 1, that is, it is considered that tar package 1 in this backup is the same as tar package 1 in the previous backup, and tar package 1 is not backed up repeatedly. Only the tar package 1 used in the second backup has redundant file c1 compared with the small files in the local file list; c2 in tar package 1 and other newly added small files e, f, g can be packaged into tar package 2, and tar package 2 needs to be backed up to the cloud server. The reuse rate of tar package 1 is: T2 / T1, where T1 is the number (or data size) of a, b, c1, d in tar package 1 during the previous backup; T2 is the number (or data size) of a, b, d that are still in the local file list among a, b, c1, d in tar package 1 during the previous backup. It should be noted that the number of small files in tar package 1 during the previous backup is 4 and the number of small files during this backup is 3 in this example only for illustration, and it does not mean that this relationship is greater than the reuse rate of 90%. Of course, the reuse rate of 90% is also only for illustration.
[0320] At the second backup, tar package 1 is reused, but the small files in the local file list associated with tar package 1 during the second backup are a, b, d. The small files in tar package 1 in the cloud server are: a, b, c1, d. Therefore, when downloading the data of the second backup from the cloud server to restore the data corresponding to the time node of the second backup, the downloaded tar package 1 includes a, b, c1, and d. However, the small files in the local file list associated with tar package 1 during the second backup are a, b, d. In this case, when restoring the data, the downloaded file c1 can be deleted by comparing the local file list.
[0321] At the third backup, the small files include a, b, h, i, c2, e, f, g. Check the reuse rate of tar package 1 in the previous backup. If the reuse rate of tar package 1 is less than 90%, then a, b in tar package 1 and newly added h, i are packaged into a new tar package 3. Tar package 3 is uploaded for backup. If the reuse rate of tar package 2 in the previous backup is greater than 90% (actually 100%), then continue to reuse tar package 2 and do not back up tar package 2 repeatedly.
[0322] Reference Figure 19 For the process of the cloud server to reuse such ordinary files already existing on the cloud server, the implementation of this process requires the cloud server to have the ability to quickly transfer files (i.e., have a pre-creation interface for files), and the files are ordinary files.
[0323] This sequence diagram adds the step of pre-creating the file to be uploaded during the process of repeatedly executing steps S501 to S507 in the application data uploading phase shown in Figure 8 . The file to be uploaded in this step can be D1 during the second backup in the example of the above ordinary file. After traversing the data snapshot in S501 and obtaining the file to be uploaded without a unique cloud-side identifier in the list of files to be uploaded, it further includes:
[0324] S1001, The backup service sends a pre-creation request for the file to be uploaded to the cloud server, and this request carries the file ID, file size, local file path, and hash value of the file to be uploaded.
[0325] S1002, After receiving the pre-creation request for the file to be uploaded, the cloud server compares the received information with the information of the already stored files and determines that the file to be uploaded does not exist.
[0326] S1003, The backup server sends a response indicating that the file does not exist to the backup service.
[0327] S502, When the backup service determines that the cloud server does not have the file to be uploaded, it executes the subsequent steps S502 to S507.
[0328] As another example, the cloud server may store another file to be uploaded. The file to be uploaded in this step can be A1 during the third backup in the example of the above ordinary file. As a repeatedly executed step, after traversing the data snapshot in S5011 and obtaining the file to be uploaded without a unique cloud-side identifier in the list of files to be uploaded, it further includes:
[0329] S1004, The backup service sends a pre-creation request for the file to be uploaded to the cloud server, and this request carries the file ID, file size, local file path, and hash value of the file to be uploaded.
[0330] S1005, After receiving the pre-creation request for the file to be uploaded, the cloud server compares the received information with the information of the already stored files, determines that the file to be uploaded already exists, and generates a new unique cloud-side identifier for the file to be uploaded.
[0331] S1006, The backup server sends a response indicating that the file exists to the backup service, and this response carries the new unique cloud-side identifier.
[0332] When the backup service determines that the cloud server has the file to be uploaded to the cloud, it does not execute the file upload step, but executes step S5071 and subsequent steps.
[0333] In practical applications, the cloud server may not have the ability to directly upload files (i.e., does not have a file pre-creation interface). In this case, the backup service needs to send a file reuse request to the cloud server. The other steps are Figure 14 similar and will not be elaborated here.
[0334] It can be understood from the above description that in the embodiments of the present application, large files are split into multiple data blocks, and small files are packaged into tar packages, which can reduce the number of requests to the cloud server; files that are the same in two consecutive backups among these files (including data blocks and tar packages) are no longer backed up, which can improve the backup efficiency.
[0335] When backing up application installation packages, multiple electronic devices may back up the installation packages of the same application, and the same electronic device may also back up the installation package of the same application multiple times. To avoid wasting storage space in the cloud server and improve the backup efficiency and recovery efficiency, the installation packages that already exist in the application market or the cloud server can be no longer backed up.
[0336] Refer to Figure 20 for the process of backing up installation package A and installation package B.
[0337] During the process of backing up application A, the backup service sends a query request for the application installation package A in the application market to the cloud server. This query request carries a signature, package name, and version number.
[0338] After receiving this query request, the cloud server sends a query request for the application installation package A in the application market to the application server. This query request carries a signature, package name, and version number.
[0339] After receiving the query request, the application server checks if there is an installation package on the cloud server with a consistent signature, consistent package name, and a cloud-side version number not lower than the version number in the request;
[0340] The application server sends information indicating the existence of application installation package A to the cloud server.
[0341] After receiving the information indicating the existence of application installation package A, the cloud server sends the information indicating the existence of application installation package A to the backup service.
[0342] After receiving the information that application installation package A exists in the application market, the backup service no longer backs up application installation package A.
[0343] As another example, during the process of backing up Application B, the backup service executes up to step S**, and sends a query request for the application market of Application Installation Package B to the cloud server. This query request carries a signature, a package name, and a version number.
[0344] After receiving this query request, the cloud server sends a query request for the application market of Application Installation Package B to the application server. This query request carries a signature, a package name, and a version number.
[0345] After receiving the query request, the application server checks that there is no installation package on the cloud server with a consistent signature, a consistent package name, and a cloud-side version number not lower than the version number in the request;
[0346] The application server sends information indicating that Application Installation Package B does not exist to the cloud server.
[0347] After receiving the information indicating that Application Installation Package B does not exist, the cloud server sends the information indicating that Application Installation Package B does not exist to the backup service.
[0348] After receiving the information that Application Installation Package B does not exist in the application market, the backup service sends a pre-creation request for Application Installation Package B to the cloud server.
[0349] After receiving the pre-creation request for Application Installation Package B, the backup service queries for an installation package with consistent comparison signatures, package names, and version numbers.
[0350] The cloud server sends information indicating that Application Installation Package B exists to the backup service. This information carries the cloud-side address of Application Installation Package B.
[0351] Refer to Figure 21 , and the recovery process will be described below using the application market of Application Installation Package A as an example.
[0352] During the process of recovering Application A, if the recovery service queries that the backed-up application resource files do not include the installation package, it sends a download request for the application market of Application Installation Package A (signature, package name, and version number) to the cloud server.
[0353] After receiving the download request for the application market of Application Installation Package A (signature, package name, and version number), the cloud server sends a download request for the application market of Application Installation Package A (signature, package name, and version number) to the application server. After receiving this download request, the application server sends the download address of Application Installation Package A to the cloud server;
[0354] After receiving the download address of Application Installation Package A, the cloud server sends the download address of Application Installation Package A to the recovery service.
[0355] The recovery service sends a download request for Application Installation Package A to the application server based on the download address.
[0356] Based on the download request, the application server sends the installation package of Application A to the backup service.
[0357] In the recovery stage, if the application resource files backed up to the cloud server include the installation package, when restoring the installation package, each application resource file (including the application installation package) is downloaded from the cloud server in sequence. Therefore, this application will not elaborate further and please refer to the previous description for details.
[0358] It should be understood that the magnitudes of the sequence numbers of the steps in the above embodiments do not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of this application.
[0359] The embodiments of this application also provide a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program runs on an electronic device, it can implement the steps in each of the above method embodiments.
[0360] The embodiments of this application also provide a computer program product. When the computer program product runs on an electronic device or a wireless router, it enables the electronic device to implement the steps in each of the above method embodiments.
[0361] If the integrated unit 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, to implement all or part of the processes in the above embodiments of the method of this application, a computer program can be used to instruct relevant hardware to complete. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, it can implement the steps in each of the above method embodiments. Among them, the computer program includes computer program code, and the computer program code can be in the form of source code, object code, executable file, or some intermediate form, etc. The computer-readable medium can at least include: any entity or device that can carry the computer program code to a first device, a recording medium, a computer memory, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), an electrical carrier signal, a telecommunication signal, and a software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk, or an optical disc, etc. In some jurisdictions, according to legislation and patent practice, the computer-readable medium cannot be an electrical carrier signal and a telecommunication signal.
[0362] The embodiments of this application also provide a chip. The chip includes a processor, the processor is coupled to a memory, and the processor calls the computer program stored in the memory to implement the steps in any method embodiment of this application. The chip can be a single chip or a chip module composed of multiple chips.
[0363] In the above embodiments, the descriptions of the respective embodiments each have their own emphasis. For parts not detailed or recorded in a certain embodiment, reference may be made to the relevant descriptions of other embodiments.
[0364] Those of ordinary skill in the art can realize that the units and method steps of the examples described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. A professional technician can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.
[0365] The above embodiments are only used to illustrate the technical solutions of this application, rather than to limit them; although this application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A data backup method, characterized in that, it includes: The electronic device generates a first file list according to the attribute information of the directory file to be backed up this time; The electronic device obtains a second file list during the previous backup, and the second file list includes the attribute information of the directory file during the previous backup; The electronic device obtains the synchronization type of the differential files in the directory file according to the first file list and the second file list, and the synchronization type includes: new addition and / or modification; The electronic device sends the differential files to the cloud server.
2. The method according to claim 1, characterized in that, The attribute information includes file types, and the file types include large file types; the electronic device obtains the synchronization type of the differential files in the directory file according to the first file list and the second file list, including: The electronic device searches for the first large file with the file type of large file type from the second file list; For each first large file, if the electronic device finds a second large file in the first file list with the same first attribute information as the first large file and different second attribute information, then determine the synchronization type of the second large file as modification; For each first large file, if the electronic device finds a third large file in the first file list with the same first attribute information as the first large file and the same second attribute information, then determine the synchronization type of the third large file as the same; The electronic device determines the synchronization type of the fourth large file other than modification and the same in the first file list as new addition; the differential files include modified large files and newly added large files, the modified large files are large files with the synchronization type of modification, and the newly added large files are large files with the synchronization type of new addition.
3. The method according to claim 2, characterized in that, The first attribute information includes file ID and file path; the second attribute information includes hash value.
4. The method according to claim 2, characterized in that, The differential files include newly added large files, and the electronic device sending the differential files to the cloud server includes: The electronic device performs splitting processing on the newly added large file to obtain multiple data blocks of the newly added large file; The electronic device sends multiple data blocks of the newly added large file to the cloud server.
5. The method according to any one of claims 2 to 4, characterized in that, The differential files include modified large files, and the electronic device sending the differential files to the cloud server includes: The electronic device performs splitting processing on the modified large file to obtain a first set composed of multiple first data blocks; The electronic device obtains a fifth large file with the same first attribute information as the modified large file from the second file list, and the first large file includes the fifth large file; The electronic device obtains a second set composed of multiple second data blocks of the fifth large file from the second file list; The electronic device compares the first data block in the first set with the second data block in the second set to obtain the differential data blocks of the modified large file, where the differential data blocks include modified data blocks and newly added data blocks; The electronic device sends the differential data blocks of the modified large file to the cloud server.
6. The method according to claim 5, wherein, The electronic device performs a splitting process on the modified large file to obtain a first set composed of a plurality of first data blocks, including: The electronic device searches for specific characters in the modified large file; The electronic device splits the modified large file from the position corresponding to the specific characters to obtain a first set composed of a plurality of first data blocks.
7. The method according to any one of claims 1 to 6, wherein, The attribute information includes a file type, and the file type includes small file types; the attribute information further includes the tar package where each small file is located; The electronic device compares the first file list with the second file list to obtain the synchronization type of the differential files in the directory file, including: The electronic device compares the first file list with the second file list to obtain a changed tar package and a first newly added small file; The electronic device calculates the reuse rate of the small files in the changed tar package; For the first changed tar package with a reuse rate greater than the reuse threshold, the non-reused small files in the first changed tar package are used as second newly added small files; For the second changed tar package with a reuse rate less than or equal to the reuse threshold, the reused small files and the modified small files in the second changed tar package are used as third newly added small files; The differential files include the first newly added small file, the second newly added small file, and the third newly added small file.
8. The method according to claim 7, wherein, The electronic device sending the differential files to the cloud server includes: The electronic device packs the first newly added small file, the second newly added small file, and the third newly added small file into at least one new tar package according to a packing rule; The electronic device sends the new tar package to the cloud server, and the data volume of the new tar package is less than the data volume threshold.
9. The method according to claim 7, wherein, The number of small files in the changed tar package in the second file list is the first number; the number of reused small files in the first file list is the second number; The reuse rate of the small files in the changed tar package is the ratio of the second number to the first number.
10. The method according to claim 7, wherein, The data volume of the small files in the changed tar package in the second file list is the first data volume; the data volume of the first reused small file in the first file list is the second data volume; The reuse rate of the small files in the changed tar package is the ratio of the second data volume to the first data volume.
11. The method according to claim 9 or 10, wherein, The multiplexed first small file is a small file with the same first attribute information and second attribute information; the non-multiplexed small file is a small file with the same first attribute information and different second attribute information. The first attribute information includes: file name and file path, and the second attribute information includes hash value.
12. The method according to any one of claims 1 to 11, characterized in that the attribute information includes file type, and the file type includes ordinary file type; the electronic device compares the first file list and the second file list to obtain the synchronization type of the differential files in the directory file, including: the electronic device searches for a first ordinary file with an ordinary file type in the second file list; for each first ordinary file, if the electronic device finds a second ordinary file in the first file list with the same first attribute information as the first ordinary file but different second attribute information, the second ordinary file is determined as a modified ordinary file; for each first ordinary file, if the electronic device finds a third ordinary file in the first file list with the same first attribute information and the same second attribute information as the first ordinary file, the third ordinary file is determined as an identical ordinary file; the electronic device determines the synchronization type of a fourth ordinary file in the first file list other than modified and identical as newly added; the differential files include modified ordinary files and newly added ordinary files, the modified ordinary file is an ordinary file with a synchronization type of modified, and the newly added ordinary file is an ordinary file with a synchronization type of newly added.
13. The method according to claim 12, characterized in that the electronic device sending the differential files to the cloud server includes: the electronic device sends a creation request for a first file to the cloud server, and the creation request for the first file is used to instruct the cloud server to return the unique identifier of the first file on the cloud side when the first file is stored, or return information without the first file when the first file is not stored. The first file is the modified ordinary file or the newly added ordinary file; if the electronic device receives the information that the first file does not exist sent by the cloud server, it sends the first file to the cloud server; if the electronic device receives the unique identifier of the first file on the cloud side sent by the cloud server, it does not send the first file to the cloud server.
14. An electronic device, characterized in that the electronic device includes a processor, and the processor is used to call a computer program in a memory to execute the method according to any one of claims 1 to 13.
15. A computer-readable storage medium, characterized in that the computer-readable storage medium stores computer instructions, and when the computer instructions run on an electronic device, the electronic device is caused to execute the method according to any one of claims 1 to 13.
16. A chip, characterized in that The chip includes a processor, and the processor is configured to call a computer program in a memory to execute the method according to any one of claims 1-13.
Citation Information
Cited By
Data backup method, electronic device, storage medium, and chip
EP4749462A1
Data backup method, electronic device, storage medium, and chip
WO2025107737A1
Data backup method and electronic device
WO2025261284A1