Data retention method and device, storage medium and electronic equipment
By using the data list to back up and write the data to be retained to the target storage space when the system is upgraded and/or restored to factory settings, the problem of system partition data loss is solved, resource utilization is improved, and costs are saved.
Patent Information
- Application Number
- CN202310439000.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-20
- Publication Date
- 2024-08-23
AI Technical Summary
When the system is upgraded and/or restored to factory settings, the data in the original system partition is easily lost, causing the data you want to keep to be overwritten or erased, resulting in a waste of resources and increased costs.
By obtaining the identification information in the data list, the data to be retained is read and backed up to the target storage space, such as RAM or external memory, and after the preset conditions are met, the data is written to the corresponding partition to avoid additional occupation of system storage resources.
It achieves data retention when the system is upgraded and/or restored to factory settings, improves resource utilization, saves costs, and ensures the security and reliability of the data to be retained.
Smart Images

Figure CN118535077A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing, and in particular to a method, device, storage medium and electronic device for retaining data. Background Art
[0002] During the system upgrade process, such as the Android system, the original system partition will be overwritten, but there is data in the original system partition that you want to keep. Overwriting the original system partition will cause the data you want to keep to be lost. When the system is restored to factory settings, some of the data you want to keep in the original system partition will be erased. When the system is upgraded and / or restored to factory settings, there is a problem of losing the data you want to keep in the original system partition. Summary of the invention
[0003] The present invention aims to solve one of the technical problems in the related art to at least some extent. To this end, one object of the present invention is to provide a method for retaining data, which can save the data to be retained when the system is upgraded and / or restored to factory settings, without occupying additional system storage resources, thereby improving resource utilization and saving costs.
[0004] A second object of the present invention is to provide a device for retaining data.
[0005] A third object of the present invention is to provide a computer-readable storage medium.
[0006] A fourth objective of the present invention is to provide an electronic device.
[0007] To achieve the above-mentioned purpose, an embodiment of the first aspect of the present invention proposes a method for retaining data, which method includes: obtaining a data list, the data list including identification information of the data to be retained; reading the data to be retained in the target partition according to the identification information, and backing up the data to be retained to the target storage space; after meeting the preset conditions, writing the data to be retained in the target storage space into the corresponding partition.
[0008] According to the method for retaining data in an embodiment of the present invention, when performing data backup, by obtaining a data list, the data to be retained in the target partition is read according to the identification information of the data to be retained in the data list, and the data to be retained is backed up in the target storage space. After the preset conditions are met, the data to be retained stored in the target storage space is rewritten into the corresponding partition. The method for retaining data in an embodiment of the present invention does not occupy the system partition space when saving the data to be retained, improves resource utilization, and has the advantage of saving costs.
[0009] In addition, the method for retaining data proposed in the above embodiment of the present invention may also have the following additional technical features:
[0010] According to an embodiment of the present invention, the target storage space includes RAM or external memory.
[0011] According to one embodiment of the present invention, the data to be retained is backed up to the target storage space, including: when the RAM backup flag is in an enabled state and the data size of the data to be retained is less than or equal to the preset RAM space size, the data to be retained is backed up to the RAM; otherwise, the data to be retained is backed up to the external memory.
[0012] According to one embodiment of the present invention, backing up the data to be retained to a target storage space includes: compressing the data to be retained, and backing up the compressed data to be retained to the target storage space; writing the data to be retained in the target storage space into a corresponding partition includes: decompressing the compressed data to be retained, and writing the decompressed data to be retained into a corresponding partition.
[0013] According to one embodiment of the present invention, backing up the data to be retained to a target storage space includes: encrypting the data to be retained, and backing up the encrypted data to be retained to the target storage space; writing the data to be retained in the target storage space to a corresponding partition includes: decrypting the encrypted data to be retained, and writing the decrypted data to be retained to a corresponding partition.
[0014] According to an embodiment of the present invention, after backing up the data to be retained to the RAM, the method further comprises: backing up the data to be retained in the RAM to the external memory.
[0015] According to an embodiment of the present invention, obtaining the data list includes: reading the data list from the system; or reading the data list from the external memory.
[0016] According to an embodiment of the present invention, the RAM backup flag is read from the system, or the RAM backup flag is read from the external memory.
[0017] To achieve the above-mentioned purpose, the second aspect of the embodiment of the present invention proposes a device for retaining data, which includes: an acquisition module, used to obtain a data list, the data list including identification information of the data to be retained; a backup module, used to read the data to be retained in the target partition according to the identification information, and back up the data to be retained to the target storage space; a writing module, used to write the data to be retained in the target storage space into the corresponding partition after a preset condition is met.
[0018] To achieve the above objectives, the third aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method for retaining data as provided in the first aspect of the present invention is implemented.
[0019] To achieve the above-mentioned purpose, the fourth aspect of the present invention proposes an electronic device, including a storage medium and a processor, wherein a computer program is stored on the storage medium, and when the computer program is executed by the processor, the method for retaining data proposed in the first aspect of the present invention is implemented.
[0020] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 is a flow chart of a method for retaining data according to an embodiment of the present invention;
[0022] Figure 2 is a schematic diagram of multiple storage partitions in an Android device according to an embodiment of the present invention;
[0023] Figure 3 This is a simplified flowchart of data retention in Android according to an embodiment of the present invention;
[0024] Figure 4 This is a specific flow chart of data retention in Android according to an embodiment of the present invention;
[0025] Figure 5 is a schematic diagram of the structure of a device for retaining data according to an embodiment of the present invention;
[0026] Figure 6 It is a schematic structural diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0027] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present invention, and should not be construed as limiting the present invention.
[0028] The following describes in detail the method, device, storage medium, and electronic device for retaining data in the embodiments of the present invention in combination with instructions 1-6 and specific implementation methods.
[0029] Figure 1 FIG. 1 is a flow chart of a method for retaining data according to an embodiment of the present invention. Figure 1As shown, methods of retaining data may include:
[0030] S101, obtaining a data list, the data list including identification information of the data to be retained;
[0031] S102, reading the data to be retained in the target partition according to the identification information, and backing up the data to be retained to the target storage space;
[0032] S103, after the preset conditions are met, the data to be retained in the target storage space is written into the corresponding partition.
[0033] As a specific embodiment, when the system is upgraded or the system is restored to factory settings, a data list of data to be retained is obtained, wherein the data list includes identification information of the data to be retained. The data to be retained is read from a target partition, such as a partition to be upgraded and / or a partition to be erased, according to the identification information of the data to be retained in the data list, and the read data to be retained is backed up to a target storage space. After the system upgrade is completed or the system is restored to factory settings, the data to be retained in the target storage space is written to the corresponding partition of the system.
[0034] In one embodiment of the present invention, obtaining the data list includes: reading the data list from the system; or reading the data list from an external memory.
[0035] Specifically, when obtaining the data list, the data list may be read from the system, or the data list may be read from an external memory. Exemplarily, when performing a system upgrade or restoring the system to factory settings through a device where the system to be upgraded or restored to factory settings is located, the data list is read from the system, and the data is backed up with the device. When using an external memory to control the device where the system to be upgraded or restored to factory settings is located to perform a system upgrade or restore the system to factory settings, the data list is read from the external memory so that the external memory can perform data backup.
[0036] It should be noted that the system upgrade in the embodiment of the present invention includes the system upgrade initiated by the user, and also includes the system upgrade forcibly performed by the system. For example, if the system is abnormal and cannot be started normally, it needs to be forcibly upgraded to restore to normal. The system factory reset in the embodiment of the present invention includes the system factory reset initiated manually by the user, and also includes the system factory reset performed by the system forcibly performed. For example, if the system is abnormal and cannot be started normally, it needs to be forcibly restored to factory settings to restore to normal.
[0037] It should be noted that the data list can be pre-set according to user needs, so that when the system is upgraded or the system is restored to factory settings, the data to be retained in the target partition can be determined according to the data list. The data list includes both the data in the upgrade partition to be overwritten and the data in the partition to be erased.
[0038] In one embodiment of the present invention, the target storage space includes RAM or external memory.
[0039] As a specific embodiment, the read data to be retained may be stored in a RAM (Random Access Memory). When the system to be upgraded or restored to factory settings is an Android system, the RAM refers to the running memory of the Android system.
[0040] As a specific embodiment, the read data to be retained may be stored in an external storage device, such as a USB flash drive or a mobile hard disk.
[0041] In an embodiment of the present invention, the read data to be retained can be backed up to RAM, that is, system operating memory or external memory. However, when determining whether to back up the read data to be retained to RAM or external memory, it is necessary to determine whether RAM backup is enabled and whether RAM has sufficient storage space.
[0042] In one embodiment of the present invention, backing up the to-be-retained data to the target storage space may include:
[0043] When the RAM backup flag is in the enabled state and the data size of the data to be retained is less than or equal to the preset RAM space size, the data to be retained is backed up to the RAM, otherwise, the data to be retained is backed up to the external memory.
[0044] Specifically, when determining whether to back up the read data to be retained to RAM or external memory, the enable (permit) RAM backup flag can be obtained to determine whether the enable RAM backup flag is valid. If the flag is valid, it is determined that RAM backup can be enabled, and then the data size of the data to be retained is calculated. If the data size of the data to be retained is lower than the usable size of RAM, the data to be retained is backed up to RAM. If the flag is invalid, or the data size of the data to be retained is higher than the usable size of RAM, the data to be retained is backed up to the external memory.
[0045] It should be noted that the embodiment of the present invention does not limit the order of the steps of determining whether to enable RAM backup and calculating the data size of the data to be retained. It is possible to first determine whether to enable RAM backup, or to first calculate the data size of the data to be retained. Specifically, when the data size of the data to be retained is calculated first, it can be compared with the usable size of the RAM when it is subsequently determined to enable RAM backup. In addition, when the data size of the data to be retained is calculated first, the size of the external memory can also be determined based on the calculated data size of the data to be retained.
[0046] In one embodiment of the present invention, the RAM backup flag is read from the system, or the RAM backup flag is read from an external memory.
[0047] Specifically, when reading the RAM backup flag, the RAM backup flag may be read from the system, or the RAM backup flag may be read from an external memory. Exemplarily, when performing a system upgrade or restoring the system to factory settings through a device where the system to be upgraded or restored to factory settings is located, the RAM backup flag is read from the system. When performing a system upgrade or restoring the system to factory settings through an external memory to control a device where the system to be upgraded or restored to factory settings is located, the RAM backup flag is read from the external memory.
[0048] In one embodiment of the present invention, backing up the data to be retained to the target storage space includes: compressing the data to be retained, and backing up the compressed data to be retained to the target storage space; writing the data to be retained in the target storage space to the corresponding partition includes: decompressing the compressed data to be retained, and writing the decompressed data to be retained to the corresponding partition.
[0049] Specifically, when backing up the data to be retained to the RAM or external memory, in order to reduce the space occupied by the data to be retained, the data to be retained may be compressed, and the compressed data to be retained may be backed up to the RAM or external memory. If the data to be retained is compressed, when writing the data to be retained in the RAM or external memory to the corresponding partition, the compressed data to be retained may be decompressed, and the decompressed data to be retained may be written to the corresponding partition.
[0050] In one embodiment of the present invention, backing up the data to be retained to the target storage space includes: encrypting the data to be retained, and backing up the encrypted data to be retained to the target storage space; writing the data to be retained in the target storage space to the corresponding partition includes: decrypting the encrypted data to be retained, and writing the decrypted data to be retained to the corresponding partition.
[0051] Specifically, when backing up the data to be retained to the RAM or external memory, especially the external memory, in order to prevent the leakage of the data to be retained, the data to be retained can be encrypted and the encrypted data to be retained can be backed up to the RAM or external memory. If the data to be retained is encrypted, when writing the data to be retained in the RAM or external memory to the corresponding partition, the encrypted data to be retained is decrypted and the decrypted data to be retained is written to the corresponding partition.
[0052] It should be noted that the data to be retained can be compressed and encrypted, which can be set according to user needs.
[0053] In one embodiment of the present invention, after backing up the data to be retained to the RAM, the method for retaining data further includes: backing up the data to be retained in the RAM to an external memory.
[0054] Specifically, when the system is upgraded or restored to factory settings due to a system abnormality, after the system upgrade instruction and / or the system factory reset instruction is executed, if the data to be retained is backed up in RAM, the data to be retained in RAM can be backed up to an external memory for use in problem analysis. If the data to be retained is backed up in an external memory, the data to be retained can be directly obtained from the external memory for problem analysis.
[0055] Taking an Android device performing a system upgrade or restoring the system to factory settings as an example, the method for retaining data in an embodiment of the present invention is described:
[0056] Specifically, see Figure 2-Figure 4 ,in, Figure 2 A schematic diagram showing multiple storage partitions in an Android device. Figure 3 A simplified flowchart of the data retention process of Android is shown. Figure 4 The specific flow chart of data retention in Android is shown. When the Android system performs a system upgrade or a system factory reset, the system enters recovery mode. In response to the system upgrade instruction and / or the system factory reset instruction, the target partition (overwrite partition and / or partition to be erased) is determined, and a data list of data to be retained in the target partition (overwrite partition and / or partition to be erased) is obtained. Among them, the data list of data to be retained in the partition to be overwritten and / or to be erased can be obtained by modifying the recovery program, presetting the list into the program, or storing the data list in a USB flash drive, and the Android device reads the list. The data size of the data to be retained is calculated according to the data list, and it is determined whether RAM backup is enabled. If RAM backup is enabled and RAM has enough storage space to store the data to be retained, the data to be retained is stored in RAM. Otherwise, the data to be retained is stored in a USB flash drive. Among them, the data to be retained can be compressed and / or encrypted, and the compressed and / or encrypted data to be retained is stored in RAM or USB flash drive. The Android system executes the system upgrade or system factory reset process, and after the execution is completed, the data to be retained in RAM or USB flash drive is written to the corresponding partition of the system. When the data to be retained is stored in the RAM, the data to be retained stored in the RAM can also be saved to the USB flash drive while the RAM is writing the corresponding partition of the system.
[0057] The method for retaining data in an embodiment of the present invention does not occupy additional system storage resources when storing the data to be retained, and has no restrictions on the storage location of the data to be retained. It can maximize the use of system storage resources, improve resource utilization, and save costs.
[0058] The method for retaining data in the embodiment of the present invention has no limit on the size of the data to be retained and is dynamic. What may need to be adjusted is the capacity of the external memory, such as a USB flash drive.
[0059] The method for retaining data in an embodiment of the present invention compresses and / or encrypts the data to be retained and stores it in a USB flash drive, which can be used to export key system data such as certain configuration files, system logs, etc., to facilitate problem analysis.
[0060] The method for retaining data in the embodiment of the present invention can be used to upgrade a partition. Unlike erasing the data partition when restoring factory settings, when upgrading a partition, the original data of the partition is overwritten with the new partition data. The embodiment of the present invention can be used to retain the data in the partition when upgrading it.
[0061] The method for retaining data in the embodiment of the present invention, such as when retaining data during a system upgrade or system factory reset, obtains a data list, reads the target partition, such as the data to be retained in the partition to be upgraded and / or the partition to be erased, according to the identification information in the data list, and backs up the data to be retained in the target storage space. After the system upgrade or system factory reset, the data to be retained stored in the target storage space is rewritten into the corresponding partition of the system. The method for retaining data in the embodiment of the present invention does not need to allocate a separate area for the data to be retained from the system partition when saving the data to be retained, that is, it does not occupy additional system storage resources, improves resource utilization, and saves costs.
[0062] The present invention provides a device for retaining data.
[0063] Figure 5 FIG. 1 is a schematic diagram of the structure of a device for retaining data according to an embodiment of the present invention. Figure 5 As shown, the device for retaining data may include: an acquisition module 10, used to obtain a data list, the data list includes identification information of the data to be retained; a backup module 20, used to read the data to be retained in the target partition according to the identification information, and back up the data to be retained to the target storage space; a writing module 30, used to write the data to be retained in the target storage space into the corresponding partition after the preset conditions are met.
[0064] It should be noted that, for other specific implementations of the device for retaining data provided in the embodiment of the present invention, reference may be made to other specific implementations of the method for retaining data in the above embodiment of the present invention.
[0065] The device for retaining data in the embodiment of the present invention, for example, when retaining data during a system upgrade or system factory reset, obtains a data list, reads the target partition, such as the data to be retained in the partition to be upgraded and / or the partition to be erased, according to the identification information in the data list, and backs up the data to be retained in the target storage space. After the system upgrade or system factory reset, the data to be retained stored in the target storage space is rewritten into the corresponding partition of the system. The device for retaining data in the embodiment of the present invention does not need to allocate a separate area for the data to be retained from the system partition when saving the data to be retained, that is, it does not occupy additional system storage resources, improves resource utilization, and saves costs.
[0066] The present invention provides a computer-readable storage medium.
[0067] In this embodiment, a computer program is stored on a computer-readable storage medium, and when the computer program is executed by a processor, the method for retaining data as described above is implemented.
[0068] The present invention provides an electronic device.
[0069] In this embodiment, the electronic device 500 may include a storage medium 503 and a processor 501. The storage medium 503 stores a computer program. When the computer program is executed by the processor 501, the method for retaining data as described above is implemented.
[0070] Figure 6 is a structural block diagram of an electronic device according to an embodiment of the present invention. Figure 6 As shown, the electronic device 500 includes: a processor 501 and a storage medium 503. The processor 501 and the storage medium 503 are connected, such as through a bus 502. Optionally, the electronic device 500 may also include a transceiver 504. It should be noted that in actual applications, the transceiver 504 is not limited to one, and the structure of the electronic device 500 does not constitute a limitation on the embodiments of the present invention.
[0071] Processor 501 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array), or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It may implement or execute various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of the present invention. Processor 501 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and the like.
[0072] The bus 502 may include a path to transmit information between the above components. The bus 502 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus 502 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0073] The storage medium 503 is used to store a computer program corresponding to the method for retaining data in the above embodiment of the present invention, and the computer program is controlled and executed by the processor 501. The processor 501 is used to execute the computer program stored in the storage medium 503 to implement the content shown in the above method embodiment.
[0074] Among them, the electronic device 500 includes but is not limited to: mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 6 The electronic device 500 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0075] The computer-readable storage medium and electronic device of the embodiments of the present invention execute the method for retaining data as described above. For example, when retaining data during a system upgrade or a system factory reset, a data list is obtained and a target partition is read according to identification information in the data list. For example, the data to be retained in the partition to be upgraded and / or the partition to be erased is backed up in the target storage space. After the system upgrade or the system factory reset, the data to be retained stored in the target storage space is rewritten into the corresponding partition of the system. When saving the data to be retained, there is no need to allocate a separate area for the data to be retained from the system partition, i.e., no additional system storage resources are occupied, resource utilization is improved, and costs are saved.
[0076] It should be noted that the logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be specifically implemented in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection portion with one or more wirings (electronic device), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways if necessary, and then stored in a computer memory.
[0077] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, a plurality of steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0078] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0079] In the description of the present invention, it is to be understood that the terms “center”, “longitudinal”, “lateral”, “length”, “width”, “thickness”, “up”, “down”, “front”, “back”, “left”, “right”, “vertical”, “horizontal”, “top”, “bottom”, “inside”, “outside”, “clockwise”, “counterclockwise”, “axial”, “radial”, “circumferential”, etc., indicating orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the referred device or element must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as limiting the present invention.
[0080] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0081] In the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements, unless otherwise clearly defined. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0082] In the present invention, unless otherwise clearly specified and limited, a first feature being "above" or "below" a second feature may mean that the first and second features are in direct contact, or the first and second features are in indirect contact through an intermediate medium. Moreover, a first feature being "above", "above" or "above" a second feature may mean that the first feature is directly above or obliquely above the second feature, or simply means that the first feature is higher in level than the second feature. A first feature being "below", "below" or "below" a second feature may mean that the first feature is directly below or obliquely below the second feature, or simply means that the first feature is lower in level than the second feature.
[0083] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present invention.
Claims
1. A method for retaining data, characterized in that: The method comprises: Acquire a data list, wherein the data list includes identification information of the data to be retained; Reading the data to be retained in the target partition according to the identification information, and backing up the data to be retained to the target storage space; After a preset condition is met, the data to be retained in the target storage space is written into a corresponding partition.
2. The method for retaining data according to claim 1, characterized in that: The target storage space includes RAM or external memory.
3. The method for retaining data according to claim 2, characterized in that: Backing up the data to be retained to the target storage space includes: When the RAM backup flag is in an enabled state and the data size of the data to be retained is less than or equal to the preset RAM space size, the data to be retained is backed up to the RAM, otherwise, the data to be retained is backed up to the external memory.
4. The method for retaining data according to claim 1, characterized in that: Backing up the data to be retained to the target storage space includes: compressing the data to be retained, and backing up the compressed data to be retained to the target storage space; Writing the to-be-retained data in the target storage space into a corresponding partition includes: The compressed data to be retained is decompressed, and the decompressed data to be retained is written into a corresponding partition.
5. The method for retaining data according to claim 1, characterized in that: Backing up the data to be retained to the target storage space includes: Encrypting the data to be retained, and backing up the encrypted data to be retained to the target storage space; Writing the to-be-retained data in the target storage space into a corresponding partition includes: The encrypted data to be retained is decrypted, and the decrypted data to be retained is written into a corresponding partition.
6. The method for retaining data according to claim 3, characterized in that: After backing up the data to be retained to the RAM, the method further includes: The data to be retained in the RAM is backed up to the external memory.
7. The method for retaining data according to claim 2, characterized in that: Get a list of data, including: Read the data list from the system; or, The data list is read from the external memory.
8. The method for retaining data according to claim 3, characterized in that: The RAM backup flag is read from the system, or the RAM backup flag is read from the external memory.
9. A device for retaining data, characterized in that: The device comprises: An acquisition module, used for acquiring a data list, wherein the data list includes identification information of the data to be retained; A backup module, used for reading the data to be retained in the target partition according to the identification information, and backing up the data to be retained to the target storage space; The writing module is used to write the data to be retained in the target storage space into the corresponding partition after a preset condition is met.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for retaining data according to any one of claims 1 to 8 is implemented.
11. An electronic device comprising a storage medium and a processor, wherein a computer program is stored on the storage medium, wherein: When the computer program is executed by the processor, the method for retaining data according to any one of claims 1 to 8 is implemented.
