CN111813753A - File saving method, file restoring method, device and terminal equipment - Google Patents

File saving method, file restoring method, device and terminal equipment Download PDF

Info

Publication number
CN111813753A
CN111813753A CN202010603387.5A CN202010603387A CN111813753A CN 111813753 A CN111813753 A CN 111813753A CN 202010603387 A CN202010603387 A CN 202010603387A CN 111813753 A CN111813753 A CN 111813753A
Authority
CN
China
Prior art keywords
file
backup
backup file
checksum
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010603387.5A
Other languages
Chinese (zh)
Inventor
刘均
李森
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Launch Technology Co Ltd
Original Assignee
Shenzhen Launch Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Launch Technology Co Ltd filed Critical Shenzhen Launch Technology Co Ltd
Priority to CN202010603387.5A priority Critical patent/CN111813753A/en
Publication of CN111813753A publication Critical patent/CN111813753A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1458Management of the backup or restore process
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Quality & Reliability (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Software Systems (AREA)
  • Retry When Errors Occur (AREA)

Abstract

The application is applicable to the field of computers, and provides a file saving method, a file restoring method, a device, a terminal device and a storage medium, wherein the file restoring method comprises the steps of detecting first file backup information of a target file after starting, wherein the first file backup information comprises a first backup file of the target file and a first reference checksum of the first backup file, if the first file backup information exists, integrity checking is carried out on the first backup file according to the first reference checksum of the first backup file, and if the integrity checking of the first backup file passes, the target file is restored according to the first backup file. According to the method and the device, when the integrity of the first backup file is verified, the target file is restored according to the first backup file, and the success rate of restoring damaged files is improved.

Description

File saving method, file restoring method, device and terminal equipment
Technical Field
The present application relates to the field of computers, and in particular, to a method for saving a file, a method for restoring a file, an apparatus, a terminal device, and a storage medium.
Background
In order to save cost, most of the existing embedded systems do not have a matched battery, and if a user encounters a sudden power failure in the process of using the system, the unsaved files can be damaged.
In the prior art, in order to recover the damaged file, a temporary file is often created in advance to record the current file operation, so that the damaged file is recovered by using the temporary file when the power failure is restarted.
Therefore, a new technical solution is needed to solve the above technical problems.
Disclosure of Invention
In view of this, embodiments of the present application provide a method for saving a file, a method for restoring a file, an apparatus, a terminal device, and a storage medium, which can restore a target file according to a first backup file when integrity check of the first backup file passes, and are favorable for improving a success rate of restoring a damaged file.
A first aspect of an embodiment of the present application provides a method for saving a file, including:
backing up a target file to obtain a first backup file;
calculating a first reference checksum of the first backup file;
and storing the first backup file and the first reference checksum in first file backup information, wherein the stored first reference checksum is used for carrying out integrity check on the first backup file after restarting, and when the integrity check of the first backup file passes, restoring the target file according to the first backup file.
In one embodiment, after storing the first backup file and the first reference checksum in the first file backup information, the method further comprises:
backing up the first backup file to obtain a second backup file;
calculating a second reference checksum of the second backup file;
and storing the second backup file and the second reference checksum in second file backup information, wherein the stored second reference checksum is used for performing integrity check on the second backup file when the integrity check of the first backup file fails, and restoring the target file according to the second backup file when the integrity check of the second backup file passes.
The beneficial effects of the embodiment of the application are that: the first backup file and the first reference checksum of the first backup file can be stored in the first file backup information, so that the phenomenon of loss is avoided, and the target file can be restored according to the first backup file.
A second aspect of an embodiment of the present application provides a method for restoring a file, including:
detecting first file backup information of a target file after starting, wherein the first file backup information comprises a first backup file of the target file and a first reference checksum of the first backup file;
if the first file backup information exists, performing integrity check on the first backup file according to a first reference checksum of the first backup file;
and if the integrity check of the first backup file passes, restoring the target file according to the first backup file.
In one embodiment, the integrity checking the first backup file according to the first reference checksum of the first backup file includes:
calculating the current checksum of the first backup file;
comparing the current checksum of the first backup file with the first reference checksum;
and if the current checksum of the first backup file is the same as the first reference checksum, determining that the integrity check of the first backup file passes.
In one embodiment, the restoring the target file according to the first backup file includes:
replacing the target file with the first backup file;
and deleting the first file backup information.
The beneficial effects of the embodiment of the application are that: when the integrity check of the first backup file passes, the target file can be restored according to the first backup file, so that the success rate of restoring damaged files is improved; according to the embodiment of the application, the current checksum of the first backup file can be calculated firstly, then the current checksum of the first backup file is compared with the first reference checksum, so that when the current checksum of the first backup file is the same as the first reference checksum, the target file is replaced by the first backup file, the backup information of the first file is deleted, the damaged file can be restored quickly, the local storage space can be saved, and the application has high usability and practicability.
A third aspect of an embodiment of the present application provides an apparatus for saving a file, including:
the first backup module is used for backing up the target file to obtain a first backup file;
the first calculation module is used for calculating a first reference checksum of the first backup file;
and the first storage module is used for storing the first backup file and the first reference checksum in first file backup information, the stored first reference checksum is used for carrying out integrity check on the first backup file after restarting, and when the integrity check of the first backup file passes, the target file is restored according to the first backup file.
In one embodiment, the apparatus for saving a file further includes:
the second backup module is used for backing up the first backup file to obtain a second backup file;
the second calculation module is used for calculating a second reference checksum of the second backup file;
and the second storage module is used for storing the second backup file and the second reference checksum in second file backup information, and the stored second reference checksum is used for performing integrity check on the second backup file when the integrity check of the first backup file fails, and restoring the target file according to the second backup file when the integrity check of the second backup file passes.
A fourth aspect of the embodiments of the present application is an apparatus for restoring a file, including:
the detection module is used for detecting first file backup information of a target file after starting, wherein the first file backup information comprises a first backup file of the target file and a first reference checksum of the first backup file;
the checking module is used for carrying out integrity checking on the first backup file according to a first reference check sum of the first backup file if the first file backup information exists;
and the recovery module is used for recovering the target file according to the first backup file if the integrity of the first backup file passes the verification.
In one embodiment, the verification module comprises:
the computing unit is used for computing the current checksum of the first backup file;
a comparing unit, configured to compare the current checksum of the first backup file with the first reference checksum;
and the determining unit is used for determining that the integrity check of the first backup file passes if the current checksum of the first backup file is the same as the first reference checksum.
In one embodiment, the recovery module comprises:
a replacement unit configured to replace the target file with the first backup file;
and the deleting unit is used for deleting the first file backup information.
A fifth aspect of embodiments of the present application provides a terminal device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor implements the method of any one of the first aspect or the method of any one of the second aspect when executing the computer program.
A sixth aspect of embodiments of the present application provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the method of any one of the above first aspects or the method of any one of the above second aspects.
A seventh aspect of embodiments of the present application provides a computer program product, which, when run on a terminal device, causes the terminal device to perform the method of any one of the above first aspects or the method of any one of the above second aspects.
It is to be understood that, for the beneficial effects of the third aspect, reference may be made to the relevant description in the first aspect, for the beneficial effects of the fourth aspect, reference may be made to the relevant description in the second aspect, and for the beneficial effects of the fifth to seventh aspects, reference may be made to the relevant description in the first aspect or the second aspect, which is not repeated herein.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
Fig. 1 is a schematic flowchart of a method for saving a file according to an embodiment of the present application;
fig. 2 is a schematic flowchart of a method for restoring a file according to a second embodiment of the present application;
fig. 3 is a schematic flowchart of a method for restoring a file according to a third embodiment of the present application;
fig. 4 is a schematic structural diagram of an apparatus for saving a file according to a fourth embodiment of the present application;
fig. 5 is a schematic structural diagram of an apparatus for restoring a file according to a fifth embodiment of the present application;
fig. 6 is a schematic structural diagram of a terminal device according to a sixth embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the present application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in the specification of the present application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be further understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
As used in this specification and the appended claims, the term "if" may be interpreted contextually as "when", "upon" or "in response to a determination" or "in response to a detection". Similarly, the phrase "if it is determined" or "if a [ described condition or event ] is detected" may be interpreted contextually to mean "upon determining" or "in response to determining" or "upon detecting [ described condition or event ]" or "in response to detecting [ described condition or event ]".
It should be understood that, the sequence numbers of the steps in this embodiment do not mean the execution sequence, and the execution sequence of each process should be determined by the function and the inherent logic of the process, and should not constitute any limitation to the implementation process of the embodiment of the present application.
It should be noted that, the descriptions of "first" and "second" in this embodiment are used to distinguish different regions, modules, and the like, and do not represent a sequential order, and the descriptions of "first" and "second" are not limited to be of different types.
The method for saving files provided by the present application may be used in a scenario where the first backup file and the first reference checksum are stored in first file backup information, and may also be used in a scenario where the second backup file and the second reference checksum are stored in second file backup information, which may be determined specifically according to circumstances. The method for restoring the file can be used in a scene with power failure when the target file is restored according to the first backup file or the second backup file, and can also be used in a scene with power failure when the first backup file and the file containing the second checksum are deleted; it should be understood that, when the method is used in a scenario where a power failure occurs when the target file is restored according to the first backup file or the second backup file, such as a scenario where a power failure occurs when the target file is replaced with the first backup file or the second backup file, at this time, since the integrity check of the first backup file or the second backup file can both pass, the target file can still be restored according to the first backup file or the second backup file; and when the method is used in a scenario where a power outage occurs when the first backup file and the file containing the second checksum are deleted, the target file is restored according to the first backup file or the second backup file, so that the finally obtained target file is intact.
In order to explain the technical solution described in the present application, the following description will be given by way of specific examples.
Example one
Fig. 1 is a schematic flowchart of a method for saving a file according to an embodiment of the present application, where the method may include the following steps:
s101: and backing up the target file to obtain a first backup file.
The first backup file is the first backup file closest to the current moment, and the content of the first backup file is the same as that of the target file; when the execution subject of the method for saving the file is the server, the target file can be any one or more files in the server. In one embodiment, any one or more files in the server may be pre-designated as target files.
In an embodiment, after the first backup file is generated, the first backup file may be backed up to obtain a second backup file, a second reference checksum of the second backup file is calculated, and the second backup file and the second reference checksum are stored in the second file backup information, where the stored second reference checksum is used to perform integrity check on the second backup file when the integrity check of the first backup file fails, and when the integrity check of the second backup file passes, the target file may be restored according to the second backup file.
The integrity check of the second backup file is the same as the integrity check of the first backup file, and reference may be made to the description of the integrity check of the first backup file in step S103, which is not repeated herein.
S102: a first reference checksum of the first ghosted file is calculated.
Where the checksum is used to verify the sum of given data, typically in hexadecimal.
In one embodiment, a Message Digest (MD) Algorithm, a Secure Hash Algorithm (SHA), or a Cyclic Redundancy Check (CRC) Algorithm may be employed to calculate the first reference checksum for the first backup file. Further, in order to increase the speed of calculation, the first reference checksum of the first backup file may be only the checksum of the first backup file header.
S103: the first backup file and the first reference checksum are stored in the first file backup information.
The stored first reference checksum is used for carrying out integrity check on the first backup file after restarting, and when the integrity check of the first backup file passes, the target file is restored according to the first backup file. It should be noted that the integrity check here is a file integrity check, which is used to check whether the first backup file is complete.
In one embodiment, the first backup file may be integrity checked by existing or future available methods, such as using MD algorithm, SHA algorithm, or CRC algorithm.
Therefore, the first backup file and the first reference checksum of the first backup file can be stored in the first file backup information, so that the phenomenon of loss is avoided, the target file can be restored according to the first backup file, and the method and the device have high usability and practicability.
Example two
Fig. 2 is a schematic flowchart of a method for restoring a file according to a second embodiment of the present application, where the method may include the following steps:
s201: and detecting first file backup information of the target file after starting, wherein the first file backup information comprises a first backup file of the target file and a first reference checksum of the first backup file.
Wherein the startup includes a first restart after a power outage. It should be noted that the power failure here may be a human power failure, such as a user turning off the machine by mistake, or a non-human power failure, such as a situation of power failure in a large range due to a natural disaster.
S202: and if the first file backup information exists, performing integrity check on the first backup file according to the first reference checksum of the first backup file.
Because the originally intact first backup file may also be damaged to a different extent at the moment of power failure, as with the target file, in order to avoid a situation where the target file is failed to be restored due to incompleteness of the first backup file, before the target file is restored according to the first backup file, in the embodiment of the present application, the first backup file is further subjected to integrity check, where the integrity check is file integrity check, and is used to check whether the first backup file is intact. In one embodiment, the first backup file may be integrity checked by any existing or future available method, such as Message Digest (MD), Secure Hash Algorithm (SHA), or Cyclic Redundancy Check (CRC).
S203: and if the integrity of the first backup file passes the verification, restoring the target file according to the first backup file.
Therefore, the method and the device for restoring the target file can be used for restoring the target file according to the first backup file when the integrity check of the first backup file is passed, are favorable for improving the success rate of restoring damaged files, and have high usability and practicability.
EXAMPLE III
Fig. 3 is a schematic flowchart of a method for restoring a file according to a third embodiment of the present application, which is a further supplement and detailed description of steps S202 and S203 in the second embodiment, and the method may include the following steps:
s301: and detecting first file backup information of the target file after starting, wherein the first file backup information comprises a first backup file of the target file and a first reference checksum of the first backup file.
The step S301 is the same as the step S201 in the first embodiment, and the specific implementation process may refer to the description of the step S201, which is not repeated herein.
S302: if the first file backup information exists, calculating the current checksum of the first backup file, comparing the current checksum of the first backup file with the first reference checksum, and if the current checksum of the first backup file is the same as the first reference checksum, determining that the integrity check of the first backup file is passed.
In order to compare the current checksum of the first backup file with the first reference checksum, the algorithm used in calculating the current checksum of the first backup file in the present application is the same as the algorithm used in calculating the first reference checksum of the first backup file, such as an MD algorithm.
Wherein the current checksum of the first back-up file may be compared to the first reference checksum based on an algorithm employed in calculating the current checksum of the first back-up file and the first reference checksum. Specifically, when both of the MD algorithms are adopted, the MD5 value of the current checksum of the first backup file may be compared with the MD5 value of the first reference checksum of the first backup file; when both adopt the SHA algorithm, the SHA value of the current checksum of the first backup file may be compared with the SHA value of the first reference checksum of the first backup file; when both of them adopt the CRC algorithm, the CRC value of the current checksum of the first backup file may be compared with the CRC value of the first reference checksum of the first backup file, as the case may be.
S303: and if the integrity of the first backup file passes the verification, replacing the target file with the first backup file, and deleting the backup information of the first file.
It should be noted that, in order to effectively save the local storage space, the first file backup information is deleted while or after the target file is replaced with the first backup file.
As can be seen from the above, in the third embodiment of the present application, compared with the first embodiment, the current checksum of the first backup file may be calculated first, and then the current checksum of the first backup file is compared with the first reference checksum, so that when the current checksum of the first backup file is the same as the first reference checksum, the target file is replaced by the first backup file, and the backup information of the first file is deleted, which is beneficial to quickly restoring the damaged file and saving the local storage space, and has strong usability and practicability.
Example four
Fig. 4 is a schematic structural diagram of an apparatus for saving a file according to a fourth embodiment of the present application, and only a part related to the embodiment of the present application is shown for convenience of description.
The device for saving the file can be a software unit, a hardware unit or a unit combining software and hardware which is built in the terminal equipment, and can also be integrated into the terminal equipment as an independent pendant.
The device for saving files comprises:
a first backup module 41, configured to backup a target file to obtain a first backup file;
a first calculation module 42, configured to calculate a first reference checksum of the first backup file;
the first storage module 43 is configured to store the first backup file and the first reference checksum in the first file backup information, where the stored first reference checksum is used to perform integrity check on the first backup file after restart, and when the integrity check of the first backup file passes, recover the target file according to the first backup file.
In one embodiment, the apparatus for saving a file further comprises:
the second backup module is used for backing up the first backup file to obtain a second backup file;
the second calculation module is used for calculating a second reference checksum of the second backup file;
and the second storage module is used for storing the second backup file and a second reference check sum in the second file backup information, the stored second reference check sum is used for carrying out integrity check on the second backup file when the integrity check of the first backup file fails, and the target file is restored according to the second backup file when the integrity check of the second backup file passes.
EXAMPLE five
Fig. 5 is a schematic structural diagram of an apparatus for restoring a file according to a fifth embodiment of the present application, and only a part related to the fifth embodiment of the present application is shown for convenience of description.
The device for restoring the file can be a software unit, a hardware unit or a unit combining software and hardware which is built in the terminal equipment, and can also be integrated into the terminal equipment as an independent pendant.
The device for restoring the file comprises:
the detection module 51 is configured to detect first file backup information of the target file after starting, where the first file backup information includes a first backup file of the target file and a first reference checksum of the first backup file;
the checking module 52 is configured to, if the first file backup information exists, perform integrity checking on the first backup file according to a first reference checksum of the first backup file;
and the restoring module 53 is configured to restore the target file according to the first backup file if the integrity check of the first backup file passes.
In one embodiment, the verification module 52 includes:
the computing unit is used for computing the current checksum of the first backup file;
the comparison unit is used for comparing the current checksum of the first backup file with the first reference checksum;
and the determining unit is used for determining that the integrity check of the first backup file passes if the current check sum of the first backup file is the same as the first reference check sum.
In one embodiment, the recovery module 53 includes:
a replacement unit for replacing the target file with the first backup file;
and the deleting unit is used for deleting the first file backup information.
EXAMPLE six
Fig. 6 is a schematic structural diagram of a terminal device according to a sixth embodiment of the present application. As shown in fig. 6, the terminal device 6 of this embodiment includes: a processor 60, a memory 61, and a computer program 62 stored in the memory 61 and executable on the processor 60. The processor 60, when executing the computer program 62, implements the steps of the first embodiment of the method described above, such as the steps S101 to S103 shown in fig. 1. Alternatively, the steps in the second to third embodiments of the method described above, for example, steps S201 to S203 shown in fig. 2, are implemented. The processor 60, when executing the computer program 62, implements the functions of the various modules/units in the various device embodiments described above, such as the functions of the modules 41 to 43 shown in fig. 4. Alternatively, the functions of the modules/units in the above-described device embodiments, such as the functions of the modules 51 to 53 shown in fig. 5, are implemented.
Illustratively, the computer program 62 may be divided into one or more modules/units, which are stored in the memory 61 and executed by the processor 60 to accomplish the present application. One or more of the modules/units may be a series of computer program instruction segments capable of performing specific functions, which are used to describe the execution of the computer program 62 in the terminal device 6. For example, the computer program 62 may be divided into a first backup module, a first computing module, and a first storage restoration module, each of which functions as follows:
the first backup module is used for backing up the target file to obtain a first backup file;
the first calculation module is used for calculating a first reference checksum of the first backup file;
the first storage module is used for storing the first backup file and the first reference checksum in the first file backup information, the stored first reference checksum is used for carrying out integrity check on the first backup file after restarting, and when the integrity check of the first backup file passes, the target file is restored according to the first backup file.
For another example, the computer program 62 may be divided into a detection module, a verification module, and a recovery module, each of which functions as follows:
the detection module is used for detecting first file backup information of the target file after starting, wherein the first file backup information comprises a first backup file of the target file and a first reference checksum of the first backup file;
the verification module is used for carrying out integrity verification on the first backup file according to a first reference checksum of the first backup file if the first file backup information exists;
and the recovery module is used for recovering the target file according to the first backup file if the integrity check of the first backup file passes.
The terminal device 6 may be a server, such as a local server or a cloud server. Terminal device 6 may include, but is not limited to, a processor 60, a memory 61. Those skilled in the art will appreciate that fig. 6 is merely an example of a terminal device 6 and does not constitute a limitation of terminal device 6 and may include more or less components than those shown, or combine certain components, or different components, e.g., terminal device 6 may also include input-output devices, network access devices, buses, etc.
The Processor 60 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The storage 61 may be an internal storage unit of the terminal device 6, such as a hard disk or a memory of the terminal device 6. The memory 61 may also be an external storage device of the terminal device 6, such as a plug-in hard disk provided on the terminal device 6, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like. Further, the memory 61 may also include both an internal storage unit of the terminal device 6 and an external storage device. The memory 61 is used for storing computer programs and other programs and data required by the terminal device. The memory 61 may also be used to temporarily store data that has been output or is to be output.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art would appreciate that the modules, elements, and/or method steps of the various embodiments described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of a unit is merely a logical division, and an actual implementation may have another division, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
Units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, all or part of the flow in the method according to the embodiments described above may be implemented by a computer program, which is stored in a computer readable storage medium and used by a processor to implement the steps of the embodiments of the methods described above. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying computer program code, recording medium, U.S. disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution media, and the like. It should be noted that the computer readable medium may contain other components which may be suitably increased or decreased as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, in accordance with legislation and patent practice, the computer readable medium does not include electrical carrier signals and telecommunications signals.
The above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions in the embodiments of the present application.

Claims (10)

1. A method of saving a file, comprising:
backing up a target file to obtain a first backup file;
calculating a first reference checksum of the first backup file;
and storing the first backup file and the first reference checksum in first file backup information, wherein the stored first reference checksum is used for carrying out integrity check on the first backup file after restarting, and when the integrity check of the first backup file passes, restoring the target file according to the first backup file.
2. The method of claim 1, wherein after storing the first ghosted file with the first reference checksum in the first file ghosting information, further comprising:
backing up the first backup file to obtain a second backup file;
calculating a second reference checksum of the second backup file;
and storing the second backup file and the second reference checksum in second file backup information, wherein the stored second reference checksum is used for performing integrity check on the second backup file when the integrity check of the first backup file fails, and restoring the target file according to the second backup file when the integrity check of the second backup file passes.
3. A method of restoring a file, comprising:
detecting first file backup information of a target file after starting, wherein the first file backup information comprises a first backup file of the target file and a first reference checksum of the first backup file;
if the first file backup information exists, performing integrity check on the first backup file according to a first reference checksum of the first backup file;
and if the integrity check of the first backup file passes, restoring the target file according to the first backup file.
4. The method of claim 3, wherein said integrity-checking the first ghosted file in accordance with the first reference checksum for the first ghosted file comprises:
calculating the current checksum of the first backup file;
comparing the current checksum of the first backup file with the first reference checksum;
and if the current checksum of the first backup file is the same as the first reference checksum, determining that the integrity check of the first backup file passes.
5. The method of claim 3 or 4, wherein the restoring the target file from the first backup file comprises:
replacing the target file with the first backup file;
and deleting the first file backup information.
6. An apparatus for saving a file, comprising:
the first backup module is used for backing up the target file to obtain a first backup file;
the first calculation module is used for calculating a first reference checksum of the first backup file;
and the first storage module is used for storing the first backup file and the first reference checksum in first file backup information, the stored first reference checksum is used for carrying out integrity check on the first backup file after restarting, and when the integrity check of the first backup file passes, the target file is restored according to the first backup file.
7. An apparatus for restoring files, comprising:
the detection module is used for detecting first file backup information of a target file after starting, wherein the first file backup information comprises a first backup file of the target file and a first reference checksum of the first backup file;
the checking module is used for carrying out integrity checking on the first backup file according to a first reference check sum of the first backup file if the first file backup information exists;
and the recovery module is used for recovering the target file according to the first backup file if the integrity of the first backup file passes the verification.
8. A terminal device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the method according to claim 1 or 2 when executing the computer program.
9. A terminal device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the method according to any of claims 3 to 5 when executing the computer program.
10. A computer-readable storage medium, in which a computer program is stored, which, when executed by one or more processors, implements the method of claim 1 or 2 and/or the method of any one of claims 3 to 5.
CN202010603387.5A 2020-06-29 2020-06-29 File saving method, file restoring method, device and terminal equipment Pending CN111813753A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010603387.5A CN111813753A (en) 2020-06-29 2020-06-29 File saving method, file restoring method, device and terminal equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010603387.5A CN111813753A (en) 2020-06-29 2020-06-29 File saving method, file restoring method, device and terminal equipment

Publications (1)

Publication Number Publication Date
CN111813753A true CN111813753A (en) 2020-10-23

Family

ID=72855830

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010603387.5A Pending CN111813753A (en) 2020-06-29 2020-06-29 File saving method, file restoring method, device and terminal equipment

Country Status (1)

Country Link
CN (1) CN111813753A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112269691A (en) * 2020-11-18 2021-01-26 杭州迪普科技股份有限公司 Method, device, equipment and medium for equipment configuration recovery
CN113590053A (en) * 2021-09-30 2021-11-02 苏州浪潮智能科技有限公司 Logical volume recovery method, device, equipment and storage medium
CN113626872A (en) * 2021-10-11 2021-11-09 宁波集联软件科技有限公司 Control method for integrity of preset resources in automobile memory chip module
CN114091017A (en) * 2021-11-19 2022-02-25 安天科技集团股份有限公司 Computer software defense method and device, computer equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180018344A1 (en) * 2016-07-12 2018-01-18 Commvault Systems, Inc. Dynamic management of expandable cache storage for multiple network shares configured in a file server
CN109634645A (en) * 2018-12-28 2019-04-16 深圳市有方科技股份有限公司 Firmware upgrade method and terminal
CN111104248A (en) * 2018-10-26 2020-05-05 伊姆西Ip控股有限责任公司 Method, apparatus and computer program product for verifying cached files

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180018344A1 (en) * 2016-07-12 2018-01-18 Commvault Systems, Inc. Dynamic management of expandable cache storage for multiple network shares configured in a file server
CN111104248A (en) * 2018-10-26 2020-05-05 伊姆西Ip控股有限责任公司 Method, apparatus and computer program product for verifying cached files
CN109634645A (en) * 2018-12-28 2019-04-16 深圳市有方科技股份有限公司 Firmware upgrade method and terminal

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112269691A (en) * 2020-11-18 2021-01-26 杭州迪普科技股份有限公司 Method, device, equipment and medium for equipment configuration recovery
CN113590053A (en) * 2021-09-30 2021-11-02 苏州浪潮智能科技有限公司 Logical volume recovery method, device, equipment and storage medium
CN113590053B (en) * 2021-09-30 2021-12-03 苏州浪潮智能科技有限公司 Logical volume recovery method, device, equipment and storage medium
CN113626872A (en) * 2021-10-11 2021-11-09 宁波集联软件科技有限公司 Control method for integrity of preset resources in automobile memory chip module
CN114091017A (en) * 2021-11-19 2022-02-25 安天科技集团股份有限公司 Computer software defense method and device, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
CN111813753A (en) File saving method, file restoring method, device and terminal equipment
CN113626256B (en) Virtual machine disk data backup method, device, terminal and storage medium
CN109086425B (en) Data processing method and device for database
CN110162429B (en) System repair method, server and storage medium
CN100367225C (en) BIOS shadowed small-print hard disk drive as robust, always on, backup for hard disk image and software failure
US20140140135A1 (en) Storage device, recovery method, and recording medium for recovery program
CN112783537A (en) Embedded linux operating system upgrading method and system based on MTD storage equipment
CN111722960A (en) Starting method, system, equipment and medium under CMOS information abnormity
CN114780298B (en) File data processing method and device, computer terminal and storage medium
CN115309589A (en) Method, system and device for recovering temporary storage area of substrate management controller
CN104268032A (en) Multi-controller snapshot processing method and device
CN106919474A (en) A kind of data cached guard method and device
CN110729014A (en) Method and device for backing up erase count table in SSD (solid State disk) storage, computer equipment and storage medium
CN113448760B (en) Method, system, equipment and medium for recovering abnormal state of hard disk
JP2778798B2 (en) Queue structure management processing method for control data
CN115858251A (en) Control method and device for substrate control unit, electronic equipment and storage medium
CN115827069A (en) Starting control method, system and device for server mainboard
CN114968297A (en) OTA (over the air) upgrading method, electronic equipment and chip system
CN104572350A (en) Method and device for processing metadata
CN115329391B (en) Text database protection method, device, equipment and medium
CN111427718A (en) File backup method, recovery method and device
JP4078871B2 (en) Semiconductor memory system, data recovery method thereof, and data recovery program
WO2012106897A1 (en) Data processing method and device
CN107402849B (en) Backup and recovery method based on K-UX system
CN115509814A (en) Method, device, equipment and medium for configuration verification and recovery based on PFR

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20201023

RJ01 Rejection of invention patent application after publication