Data recovery method of memory, terminal equipment and storage medium
By automatically monitoring the remaining erase cycle of the memory and backing up the data to the cloud server, the problem of low memory data recovery efficiency in the prior art is solved, and timely backup and efficient recovery of memory data are realized.
Patent Information
- Application Number
- CN202411986570.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-05-13
AI Technical Summary
Existing memory data recovery solutions are inefficient and rely on local storage media. Users need to manually back up and migrate data.
By monitoring the remaining erase cycle of the memory, when it is lower than the preset threshold, the target data (including file data, configuration item data and device identification information) is automatically backed up to the cloud server, and when the new memory is connected, the data is automatically obtained and restored from the cloud server.
It realizes timely backup and efficient recovery of memory data, reduces the user's manual operation needs and improves the efficiency of data recovery.
Smart Images

Figure CN119988090A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of data processing, and in particular relates to a data recovery method of a memory, a terminal device and a storage medium. Background Art
[0002] Storage devices have a limited erase and write lifespan, that is, the number of write and erase times for each storage block is limited. If this threshold is exceeded, data corruption, storage block failure, or even complete device failure may occur.
[0003] Traditional methods usually perform regular checks on storage devices to monitor their health status and remaining erase and write cycles. However, existing memory data recovery solutions often rely on local storage media, and users need to manually back up and migrate data. It can be seen that traditional methods of data recovery are inefficient. A new technical means is needed to solve the above technical problems. Summary of the invention
[0004] In view of this, an embodiment of the present invention provides a data recovery method of a memory, a terminal device and a storage medium, which can solve the problem of low efficiency of data recovery of the memory in the related art.
[0005] A first aspect of the present invention provides a method for recovering data from a memory, comprising:
[0006] If the remaining erase / write cycle of the first memory is less than the preset erase / write cycle, backing up the target data in the first memory to the cloud server, the target data including file data, configuration item data and device identification information;
[0007] When the second storage device is detected to be connected, the target data is obtained from the cloud server;
[0008] When the target data is received, a data recovery operation is performed on the second memory according to the target data.
[0009] Optionally, in a first implementation of the first aspect of the present invention, if the remaining erase / write cycle of the first memory is less than a preset erase / write cycle, before the step of backing up the target data in the first memory to the cloud server, the method further includes:
[0010] Obtaining a wear table in a first memory;
[0011] The remaining erase / write cycles of the first memory are calculated according to the erase / write times of each storage block in the wear table.
[0012] Optionally, in a second implementation of the first aspect of the present invention, the step of calculating the remaining erase / write cycle of the first memory according to the erase / write times of each storage block in the wear table includes:
[0013] According to the number of erase and write times of each storage block in the wear table, the average erase and write cycle is calculated;
[0014] The remaining erase / write cycle of the first memory is calculated according to the average erase / write cycle.
[0015] Optionally, in a third implementation of the first aspect of the present invention, the step of calculating the remaining erase / write cycle of the first memory according to the average erase / write cycle includes:
[0016] Obtaining a maximum erase / write cycle of the first memory;
[0017] The remaining erase / write cycle of the first memory is calculated according to the average erase / write cycle and the maximum erase / write cycle.
[0018] Optionally, in a fourth implementation of the first aspect of the present invention, the step of acquiring the wear table in the first memory includes:
[0019] The wear table in the first memory is periodically acquired.
[0020] Optionally, in a fifth implementation of the first aspect of the present invention, when it is detected that the second storage is accessed, the step of acquiring the target data on the cloud server includes:
[0021] When the second storage device is detected to be connected, local device identification information is obtained;
[0022] Generate a data acquisition request according to the device identification information;
[0023] Send a data acquisition request to the cloud server to obtain the target data carrying the device identification information on the cloud server.
[0024] Optionally, in a sixth implementation of the first aspect of the present invention, if the remaining erase / write cycle of the first memory is less than a preset erase / write cycle, the step of backing up the target data in the first memory to the cloud server includes:
[0025] If the remaining erase / write cycle of the first memory is lower than the preset erase / write cycle, obtaining the data to be encrypted;
[0026] Perform encryption operations on the data to be encrypted to obtain the target data.
[0027] Optionally, in a seventh implementation of the first aspect of the present invention, when it is detected that the second storage is accessed, before the step of the cloud server acquiring the target data, the method further includes:
[0028] The output can be directly taken out of the first memory and can be directly accessed into the prompt information of the second memory.
[0029] In a second aspect, an embodiment of the present invention provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the data recovery method of the above-mentioned memory when executing the computer program.
[0030] In a third aspect, an embodiment of the present invention provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps of the data recovery method of the above-mentioned memory are implemented.
[0031] In a fourth aspect, an embodiment of the present invention provides a computer program product, which, when executed on a terminal device, enables the terminal device to execute the above-mentioned memory data recovery method.
[0032] The beneficial effects of the embodiments of the present invention compared with the prior art are as follows: if the remaining erase and write cycles of the first memory are lower than the preset erase and write cycles, the target data in the first memory is backed up to the cloud server, and the target data includes file data, configuration item data, and device identification information; when the second memory is detected to be connected, the target data is obtained from the cloud server; when the target data is received, a data recovery operation is performed on the second memory according to the target data. By monitoring the memory status and performing backup operations, when the memory is about to fail, the backup can be actively performed, and the user does not need to pay attention to the memory status in advance and perform complex backup operations, and the data backup time is minimized. When a new memory is connected, the target data is automatically obtained and restored through the cloud, and the user does not need to manually find the backup or select the recovery point. While ensuring the timeliness of the memory data backup, the efficiency of the memory data recovery is also improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0034] Figure 1 A schematic diagram of an embodiment of a method for recovering data from a memory device according to an embodiment of the present invention;
[0035] Figure 2 It is a schematic diagram of a specific embodiment before step 101 of the method for recovering data from a memory in an embodiment of the present invention;
[0036] Figure 3 A schematic diagram of a specific embodiment of step 202 of the method for recovering data from a memory device according to an embodiment of the present invention;
[0037] Figure 4 A schematic diagram of a specific embodiment of step 2022 of the method for recovering data from a memory device according to an embodiment of the present invention;
[0038] Figure 5 The figure is a schematic diagram of an embodiment of a terminal device in an embodiment of the present invention. DETAILED DESCRIPTION
[0039] In order to make the purpose, technical scheme and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative work are protected by the present invention.
[0040] It should be noted that the terms "include", "comprises" and "have" and any variations thereof in the specification and claims of the present invention and the above-mentioned drawings are intended to cover non-exclusive inclusions. For example, a process, method, terminal, product or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units that are not listed, or may optionally include other steps or units that are inherent to these processes, methods, products or devices. In the claims, specifications and drawings of the present invention, relational terms such as "first" and "second" are merely used to distinguish one entity / operation / object from another entity / operation / object, and do not necessarily require or imply any such real-time relationship or order between these entities / operations / objects.
[0041] Reference to an "embodiment" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiment may be included in at least one embodiment of the present invention. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0042] Storage devices have a limited erase and write lifespan, that is, the number of write and erase times for each storage block is limited. If this threshold is exceeded, data corruption, storage block failure, or even complete device failure may occur.
[0043] Traditional methods usually perform regular checks on storage devices to monitor their health status and remaining erase and write cycles. However, existing memory data recovery solutions often rely on local storage media, and users need to manually back up and migrate data. It can be seen that traditional methods of data recovery are inefficient. A new technical means is needed to solve the above technical problems.
[0044] In view of this, an embodiment of the present invention provides a data recovery method, terminal device and storage medium for a storage device. By monitoring the storage status and performing backup operations, when the storage device is about to fail, the backup can be actively performed, and the user does not need to pay attention to the storage status in advance and perform complex backup operations, and the data backup time is minimized. When a new storage device is connected, the target data is automatically obtained and restored through the cloud, and the user does not need to manually search for backups or select recovery points. While ensuring the timeliness of storage device data backup, the efficiency of storage device data recovery is also improved.
[0045] In order to illustrate the technical solution of the present invention, specific embodiments are provided below for illustration.
[0046] The professional terms involved in the embodiments of the present invention include but are not limited to:
[0047] Memory: A hardware device used to store data and instructions, which can be internal (such as solid-state drives SSD, mechanical hard drives HDD, memory, etc.) or external (such as USB flash drives, SD cards, etc.).
[0048] Remaining erase / write cycles: refers to how many times the memory can be erased / written before its performance drops to an unacceptable level or fails completely. It is an indicator of the memory lifespan.
[0049] Preset erase / write cycle: a preset erase / write cycle threshold. When the remaining erase / write cycles of the memory are lower than this threshold, the memory is considered to be close to the end of its life and data protection measures need to be taken. Different memories may have different preset values.
[0050] Cloud server: A server based on cloud computing architecture that provides data storage, processing and other services through the network. In this claim, it is used to back up the data in the storage.
[0051] Wear table: A table that records the number of times each storage block in the memory is erased and written. It is used to evaluate the life and performance of the memory.
[0052] Data recovery operation: The process of restoring backed-up data to another storage to ensure data continuity and availability.
[0053] Figure 1 The present invention provides a method for recovering data from a memory device, which can be applied to a terminal device, such as a mobile phone, a tablet computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, etc.
[0054] Specifically, the data recovery method of the memory may include the following steps S101 to S103.
[0055] Step S101, if the remaining erase / write cycle of the first memory is lower than the preset erase / write cycle, the target data in the first memory is backed up to the cloud server, the target data including file data, configuration item data and device identification information.
[0056] In an embodiment of the present invention, the erase and write operation of the first memory is monitored in real time, and a counter is maintained to record the total erase and write times. The remaining erase and write cycles are calculated based on the erase and write life (e.g., 100,000 erase and write times) provided by the memory manufacturer and the current total erase and write times. When the remaining erase and write cycles are lower than a preset threshold (e.g., 20% of the remaining life, i.e., 20,000 erase and write times), the data backup process is triggered.
[0057] Optionally, an intelligent algorithm is called to predict the remaining erase / write cycles, such as predicting based on the historical erase / write rate and the current erase / write mode. When the prediction result shows that the remaining erase / write cycles will be lower than a preset threshold, the data backup process is triggered.
[0058] Optionally, the wear of the memory is checked periodically. The number of erase and write times of each memory block is obtained by reading the wear table or related status information inside the memory. The remaining erase and write cycles are calculated based on the read erase and write times and the total erase and write cycles of the memory. If the calculated remaining erase and write cycles are lower than a preset value, the data backup process is started.
[0059] Specifically, determine the target data that needs to be backed up, such as file data, configuration item data, and device identification information. Use a preset network protocol (such as HTTPS) to upload the target data to the cloud server. When storing data on the cloud server.
[0060] Optionally, before backing up, the target data is compressed to reduce transmission time and storage space usage.
[0061] Optionally, use breakpoint resume technology to resume transmission of target data even if an interruption occurs during the transmission process.
[0062] Step S102, when it is detected that the second storage is connected, the target data is obtained from the cloud server.
[0063] In an embodiment of the present invention, the access to the second storage is detected through a physical interface (such as a USB or SD card slot). When the access to the second storage is detected, the data recovery process is triggered.
[0064] Optionally, the mounting state of the external storage device is detected through an API. When a new storage device is detected to be mounted, the device type is identified to determine that it is the target second storage device.
[0065] Specifically, when the access of the second storage device (such as a newly inserted USB storage device) is detected, the data recovery process is triggered. According to the preset data recovery logic, a request message is constructed to request the target data from the cloud server. The request message contains the identification information of the current device (such as device ID, serial number or unique identifier) to ensure that the cloud server can accurately match and return the target data corresponding to the device.
[0066] The constructed request message is sent to the cloud server through a preset network connection (such as HTTPS). After receiving the request, the cloud server retrieves and packages the corresponding target data according to the device identification information in the request. The cloud server returns the target data to the requester as a response message.
[0067] After receiving the response message, parse and extract the target data to prepare for subsequent data recovery operations.
[0068] Step S103: when the target data is received, a data recovery operation is performed on the second memory according to the target data.
[0069] In an embodiment of the present invention, if the target data is successfully obtained from the cloud server, the target data is written into the second memory. The configuration item data includes the settings, parameters and configuration information of the device. During the data recovery process, the configuration item data records the various settings and parameters of the device. By restoring the configuration item data, the new memory can be restored to the previous working state.
[0070] Optionally, the configuration item data includes metadata associated with the file data (such as file name, path, permissions, etc.), and based on the metadata, the restored data has good accessibility.
[0071] Optionally, the configuration item data supports the operation of specific functions of the device or applications. If these configuration item data are missing, the device or application may not work properly. By restoring the configuration item data, you can effectively avoid manually reconfiguring the device after restoration, thereby improving the efficiency of data recovery.
[0072] According to the structure of the file system, the file data is written into the corresponding directory and file. Among them, the configuration file in the second memory can be updated or replaced according to the configuration item data in the target data.
[0073] If all data is successfully written and integrity checked, the data recovery operation is marked complete.
[0074] Optionally, before data recovery, the second memory is formatted or cleaned to ensure that there is enough space available, and then the file data is divided into multiple data blocks and written into the second memory in parallel using multiple threads.
[0075] The beneficial effects of the embodiments of the present invention compared with the prior art are as follows: if the remaining erase and write cycles of the first memory are lower than the preset erase and write cycles, the target data in the first memory is backed up to the cloud server, and the target data includes file data, configuration item data, and device identification information; when the second memory is detected to be connected, the target data is obtained from the cloud server; when the target data is received, a data recovery operation is performed on the second memory according to the target data. By monitoring the memory status and performing backup operations, when the memory is about to fail, the backup can be actively performed, and the user does not need to pay attention to the memory status in advance and perform complex backup operations, and the data backup time is minimized. When a new memory is connected, the target data is automatically obtained and restored through the cloud, and the user does not need to manually find the backup or select the recovery point. While ensuring the timeliness of the memory data backup, the efficiency of the memory data recovery is also improved.
[0076] The life of the memory is usually limited by the number of program / erase cycles (PE cycles). As the number of PE cycles increases, the performance of the memory will gradually decline until it can no longer reliably store data. The traditional approach is to perform data recovery or memory replacement only after the memory has completely failed, which often results in data loss or extended device downtime. Based on this, the present invention proposes an optional embodiment.
[0077] Reference Figure 2 , Figure 2 This is a schematic diagram of a specific embodiment before step 101 of the memory data recovery method in an embodiment of the present invention. Before step S101, the following specific implementation methods are also included.
[0078] Step S201, obtaining a wear table in a first memory.
[0079] In an embodiment of the present invention, the terminal device automatically starts the wear table acquisition program periodically.
[0080] Optionally, the user can manually trigger the wear table acquisition procedure.
[0081] Optionally, the program is automatically started when the device detects that memory usage has reached a certain threshold.
[0082] Optionally, directly read the wear table information built into the memory.
[0083] Step S202: Calculate the remaining erase / write cycles of the first memory according to the erase / write times of each storage block in the wear table.
[0084] In an embodiment of the present invention, if the wear table provides direct information of the cumulative erase and write times, read it directly. Add the erase and write times of each storage block and divide it by the total number of storage blocks. If the wear table provides the overall average erase and write cycle, read it directly. Get the maximum erase and write cycle value from the memory specification. If the memory supports it, get the maximum erase and write cycle value by sending a query command. Use (maximum erase and write cycle-average erase and write cycle) as an estimate of the remaining erase and write cycles.
[0085] In the embodiment of the present invention, by real-time monitoring of the wear of the memory, data can be backed up in advance before the memory approaches the end of its life to avoid data loss. In addition, key data (such as file data, configuration item data, and device identification information) are backed up to the cloud server, which can ensure data recoverability even if the memory is damaged.
[0086] The life of a memory is usually limited by the number of program / erase cycles (PE cycles). As the number of PE cycles increases, the performance of the memory gradually decreases until it can no longer reliably store data. The traditional approach is to roughly estimate the remaining life based on the total number of erase and write times of the memory and the number of erase and write times used, but this method is often not accurate enough. Based on this, the present invention proposes an optional embodiment.
[0087] Reference Figure 3 , Figure 3 2 is a schematic diagram of a specific embodiment of step 202 of the method for recovering data from a memory device in an embodiment of the present invention. Step S202 also includes the following specific implementation methods.
[0088] Step S2021: Calculate the average erase / write cycle according to the erase / write times of each storage block in the wear table.
[0089] In an embodiment of the present invention, the wear table data structure is parsed according to the specification of the first memory, the wear table is traversed, and the number of erasures and writes of each storage block is accumulated.
[0090] Optionally, the wear table is read from a built-in register or a dedicated interface of the first memory.
[0091] Optionally, the data structure of the wear table is parsed according to the specification of the first memory.
[0092] Optionally, the wear table is traversed to accumulate the number of erase and write times of each storage block. If the wear table directly provides the cumulative number of erase and write times, it is directly read.
[0093] Optionally, the number of erase / write cycles of each memory block is added up and then divided by the total number of memory blocks to obtain the average erase / write cycle. If the wear table or the device provides an estimate of the overall average erase / write cycle, this value is used directly.
[0094] Optionally, taking into account the usage of the first memory (eg, a frequently written portion may wear out faster), a weighted average is used to calculate the average erase / write cycle.
[0095] Step S2022: Calculate the remaining erase / write cycle of the first memory according to the average erase / write cycle.
[0096] In the embodiment of the present invention, by calculating the average erase / write cycle and estimating the remaining erase / write cycle, the remaining life of the memory can be predicted, so that data protection measures can be taken in advance. Furthermore, based on the accurate remaining life estimation, data can be backed up in time before the memory approaches the end of its life, avoiding the risk of data loss.
[0097] In traditional memory management, there is often a lack of an accurate evaluation mechanism for memory life. When the memory approaches its life limit, problems such as data loss and reduced read and write performance may occur. Based on this, the present invention proposes an optional embodiment.
[0098] Reference Figure 4 , Figure 4 2 is a schematic diagram of a specific implementation of step 2022 of the method for recovering data from a memory device in an embodiment of the present invention. Step S2022 also includes the following specific implementation methods.
[0099] Step S20221, obtaining the maximum erase / write cycle of the first memory.
[0100] In an embodiment of the present invention, the maximum erase / write cycle value is obtained from the memory specification, and then (maximum erase / write cycle - average erase / write cycle) is used to estimate the remaining erase / write cycle.
[0101] Step S20222: Calculate the remaining erase / write cycle of the first memory according to the average erase / write cycle and the maximum erase / write cycle.
[0102] In an embodiment of the present invention, optionally, different weights are assigned to storage blocks according to their importance or size, and the weights are considered when calculating the average erase / write cycle. For example:
[0103] There is a NAND flash memory that contains multiple storage blocks, which may vary in size and importance. For example, some storage blocks store system-critical data (such as operating systems, configuration files, etc.), while others store user data (such as documents, pictures, etc.).
[0104] A higher weight may be assigned to storage blocks that store critical system data, because the loss of this data may have a serious impact on the operation of the device.
[0105] A lower weight may be assigned to storage blocks storing user data because such data can usually be restored through backup or other means.
[0106] For storage blocks with larger capacity, weights can be assigned according to size, and larger storage blocks may contribute more erase and write times during wear.
[0107] Optionally, in this particular scenario, weights may be assigned based on importance rather than size, since even a small storage block should be considered important if it stores critical data.
[0108] Assume the following storage blocks and their erase / write counts and assigned weights:
[0109] Storage block A (system critical data): erase and write times = 1000 times, weight = 0.5;
[0110] Storage block B (user data): erase and write times = 2000 times, weight = 0.2;
[0111] Storage block C (system log): number of erase and write times = 500 times, weight = 0.3.
[0112] The weighted average erase cycle can be calculated as follows:
[0113] Calculate the erase and write cycles of each memory block (in this example, the erase and write count is directly used as an approximation of the erase and write cycles because the erase and write life of each memory block may be different).
[0114] Use the assigned weights to calculate the weighted average erase / write cycles:
[0115] Weighted average erase / write cycle = (erase / write cycle of storage block A * weight A) + (erase / write cycle of storage block B * weight B) + (erase / write cycle of storage block C * weight C);
[0116] Weighted average erase / write cycle = (1000*0.5)+(2000*0.2)+(500*0.3);
[0117] Weighted average erase and write cycle = 500 + 400 + 150 = 1050 times;
[0118] Calculation of remaining erase and write cycles;
[0119] With the weighted average erase and write cycle, the maximum erase and write cycle value of the memory can be used to calculate the remaining erase and write cycle. Assuming the maximum erase and write cycle value is 10,000 times, then:
[0120] Remaining erase cycle = (maximum erase cycle - weighted average erase cycle);
[0121] Remaining erase / write cycles = (10000-1050) = 8950 times.
[0122] In the embodiment of the present invention, by obtaining the maximum erase / write cycle value of the memory and calculating the remaining erase / write cycle in combination with the average erase / write cycle, an accurate evaluation of the memory life is achieved. The potential failure risk of the memory can be discovered in time, and measures can be taken in advance to back up and restore data.
[0123] In traditional memory management, there is often a lack of a continuous monitoring mechanism for memory wear. When the memory wears to a certain extent, problems such as data loss and reduced read and write performance may occur. Based on this, the present invention proposes an optional embodiment.
[0124] Step S104 also includes the following specific implementation methods.
[0125] Step S1041, calculate the average erase / write cycle according to the erase / write times of each storage block in the wear table.
[0126] In an embodiment of the present invention, a fixed time interval is set, such as daily, weekly or monthly. When the set time interval arrives, the wear table acquisition operation is triggered, and the current wear table data is read from the first memory.
[0127] Optionally, the usage of the first memory is monitored, such as the frequency of read and write operations, changes in data volume, etc. According to a preset threshold or algorithm, it is determined whether the wear table needs to be obtained at present. If necessary, the current wear table data is read from the first memory.
[0128] Optionally, a fixed time interval is set and the usage of the memory is monitored at the same time. When the fixed time interval arrives, or when the usage reaches a preset condition, the wear table acquisition operation is triggered. The current wear table data is read from the first memory, and additional data collection or processing may be performed according to the usage.
[0129] In the embodiment of the present invention, by periodically acquiring the wear table in the first memory, continuous monitoring of the memory wear is achieved, and potential problems of the memory, such as excessive wear or abnormal wear, can be discovered in time, so that corresponding measures can be taken to prevent data loss or damage.
[0130] Step S104 also includes the following specific implementation methods.
[0131] Step S1041: When it is detected that the second storage device is connected, local device identification information is obtained.
[0132] In an embodiment of the present invention, the physical access to the second memory is detected through a hardware interface, or the logical access to the second memory is detected through a software layer (such as a driver).
[0133] Optionally, the device identification information is read from a specific area of the memory (such as a system partition or a configuration area).
[0134] Optionally, the device identification information is obtained through an API (application programming interface) of the operating system.
[0135] Step S1041: Generate a data acquisition request according to the device identification information.
[0136] In an embodiment of the present invention, a data acquisition request is sent to a cloud server to acquire target data carrying device identification information from the cloud server. Specifically, the device identification information is used as part of the data acquisition request, or the device identification information is attached to the data acquisition request as a query parameter.
[0137] Step S1041: Send a data acquisition request to the cloud server to obtain target data carrying device identification information from the cloud server.
[0138] Specifically, the data acquisition request is sent via a wired network connection (such as Ethernet).
[0139] Optionally, the data acquisition request is sent via a wireless network connection (such as Wi-Fi, Bluetooth).
[0140] After receiving the data acquisition request, the cloud server retrieves the corresponding target data from the stored data according to the device identification information in the request and returns it to the requester (terminal device).
[0141] In an embodiment of the present invention, by obtaining local device identification information and generating a data acquisition request containing the information, the target data that can be obtained from the cloud server is data that matches the current device, which can effectively avoid confusion or errors in the data recovery process.
[0142] Data backup is usually achieved by storing the data in another physical storage device (such as a hard disk, a USB flash drive, etc.). However, this method has some problems, such as the risk of data leakage during data transmission and storage. Based on this, the present invention proposes an optional embodiment.
[0143] Step S104 also includes the following specific implementation methods.
[0144] Step S1041: If the remaining erase / write cycle of the first memory is lower than the preset erase / write cycle, the data to be encrypted is obtained.
[0145] In an embodiment of the present invention, all data that needs to be backed up in the first storage is selected as data to be encrypted, including file data, configuration item data, device identification information, and the like.
[0146] Optionally, the user is allowed to manually select data to be backed up as data to be encrypted.
[0147] Step S1041: Perform encryption operation on the data to be encrypted to obtain target data.
[0148] In the implementation manner of the present invention, a preset encryption algorithm (such as AES, RSA, etc.) is used to encrypt the data to be encrypted to obtain encrypted target data.
[0149] In the embodiment of the present invention, by encrypting the data to be backed up, it is possible to effectively prevent the data from being accessed or tampered with by unauthorized personnel during the transmission and storage process, thereby improving the security of the backup data.
[0150] Data recovery methods usually directly rely on automatic processing of hardware and software, but lack effective interaction with users, which may cause users to be confused during the data recovery process. Based on this, the present invention proposes an optional embodiment.
[0151] The following specific implementation is also included before step S102.
[0152] Step S201: outputting prompt information that the first memory can be directly taken out and the second memory can be directly accessed.
[0153] In an embodiment of the present invention, a standard prompt message is generated, such as “Access to the second storage has been detected, please prepare to recover data”. The prompt message may be output via a display screen, a speaker or other output device.
[0154] In the embodiment of the present invention, the prompt information can guide the user to perform the correct operation, thereby preventing the user from being confused or making an erroneous operation due to not understanding the operation steps.
[0155] like Figure 5 , which is a schematic diagram of a terminal device provided in an embodiment of the present invention. The terminal device 5 may include: a processor 501, a memory 502, and a computer program 503 stored in the memory 502 and executable on the processor 501, such as a memory data recovery program. When the processor 501 executes the computer program 503, the steps in the above-mentioned memory data recovery embodiments are implemented.
[0156] The computer program may be divided into one or more modules / units, one or more modules / units are stored in the memory 502 and executed by the processor 501 to complete the present invention. One or more modules / units may be a series of computer program instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer program in the terminal device.
[0157] The terminal device may include, but is not limited to, a processor 501 and a memory 502. Those skilled in the art will appreciate that Figure 5It is only an example of a terminal device and does not constitute a limitation of the terminal device. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the terminal device may also include input and output devices, network access devices, buses, etc.
[0158] The processor 501 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0159] The memory 502 may be an internal storage unit of the terminal device, such as a hard disk or memory of the terminal device. The memory 502 may also be an external storage device of the terminal device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the terminal device. Further, the memory 502 may also include both an internal storage unit of the terminal device and an external storage device. The memory 502 is used to store computer programs and other programs and data required by the terminal device. The memory 502 may also be used to temporarily store data that has been output or is to be output.
[0160] It should be noted that, for the convenience and brevity of description, the structure of the above-mentioned terminal device can also refer to the specific description of the structure in the method embodiment, which will not be repeated here.
[0161] An embodiment of the present invention further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps in the data recovery method of the above memory can be implemented.
[0162] An embodiment of the present invention provides a computer program product. When the computer program product is run on a mobile terminal, the mobile terminal can implement the steps in the above-mentioned memory data recovery method when executing the computer program product.
[0163] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0164] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0165] In the embodiments provided by the present invention, it should be understood that the disclosed terminal devices and methods can be implemented in other ways. For example, the terminal device embodiments described above are only exemplary. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.
[0166] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0167] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0168] If the integrated module / 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, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0169] The above-described embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them. Although the present invention has been described in detail with reference to the above-described embodiments, a person skilled in the art should understand that the technical solutions described in the above-described embodiments can still be modified, or some of the technical features can be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention.
Claims
1. A method for recovering data from a memory, characterized in that: include: If the remaining erase / write cycle of the first memory is less than the preset erase / write cycle, backing up the target data in the first memory to the cloud server, the target data including file data, configuration item data and device identification information; When access to the second storage is detected, acquiring the target data from the cloud server; When the target data is received, a data recovery operation is performed on the second memory according to the target data.
2. The method for recovering data from a memory according to claim 1, wherein: Before the step of backing up the target data in the first memory to the cloud server if the remaining erase / write cycle of the first memory is less than the preset erase / write cycle, the method further includes: Obtaining a wear table in the first memory; The remaining erase / write cycles of the first memory are calculated according to the erase / write times of each storage block in the wear table.
3. The data recovery method of the memory as claimed in claim 2, characterized in that: The step of calculating the remaining erase / write cycles of the first memory according to the erase / write times of each storage block in the wear table comprises: Calculate the average erase / write cycle according to the erase / write times of each storage block in the wear table; The remaining erase / write cycle of the first memory is calculated according to the average erase / write cycle.
4. The method for recovering data from a memory as claimed in claim 3, wherein: The step of calculating the remaining erase / write cycle of the first memory according to the average erase / write cycle comprises: Obtaining a maximum erase / write cycle of the first memory; The remaining erase / write cycle of the first memory is calculated according to the average erase / write cycle and the maximum erase / write cycle.
5. The method for recovering data from a memory as claimed in claim 2, wherein: The step of obtaining the wear table in the first memory comprises: The wear table in the first memory is periodically acquired.
6. The method for recovering data from a memory according to any one of claims 1 to 5, characterized in that: When the second storage device is detected to be connected, the step of acquiring the target data on the cloud server includes: When detecting access to the second storage device, obtaining the local device identification information; Generate a data acquisition request according to the device identification information; The data acquisition request is sent to the cloud server to acquire the target data carrying the device identification information in the cloud server.
7. The method for recovering data from a memory as claimed in claim 4, wherein: If the remaining erase / write cycle of the first memory is less than the preset erase / write cycle, the step of backing up the target data in the first memory to the cloud server includes: If the remaining erase / write cycle of the first memory is lower than the preset erase / write cycle, obtaining the data to be encrypted; An encryption operation is performed on the data to be encrypted to obtain the target data.
8. The method for recovering data from a memory as claimed in claim 1, wherein: When the second storage device is detected to be connected, before the cloud server acquires the target data, the method further includes: The output is a prompt message indicating that the first memory can be directly taken out and the second memory can be accessed, wherein the prompt message is used to prompt the user to replace the first memory with the second memory.
9. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the memory data recovery method according to any one of claims 1 to 8 when executing the computer program.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the memory data recovery method according to any one of claims 1 to 8 are implemented.