CN114443354A - File recovery method and device, electronic equipment and storage medium - Google Patents

File recovery method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114443354A
CN114443354A CN202111567028.XA CN202111567028A CN114443354A CN 114443354 A CN114443354 A CN 114443354A CN 202111567028 A CN202111567028 A CN 202111567028A CN 114443354 A CN114443354 A CN 114443354A
Authority
CN
China
Prior art keywords
file
monitored
disk
identification information
handle
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
CN202111567028.XA
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.)
Beijing Wangshen Dongjian Technology Co ltd
Original Assignee
Beijing Wangshen Dongjian 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 Beijing Wangshen Dongjian Technology Co ltd filed Critical Beijing Wangshen Dongjian Technology Co ltd
Priority to CN202111567028.XA priority Critical patent/CN114443354A/en
Publication of CN114443354A publication Critical patent/CN114443354A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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/1471Saving, restoring, recovering or retrying involving logging of persistent data for recovery
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/302Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/3034Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a storage system, e.g. DASD based or network based

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Quality & Reliability (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention provides a file recovery method, a file recovery device, electronic equipment and a storage medium, wherein the method comprises the following steps: acquiring identification information of a file to be monitored, which is input by a user; the file to be monitored is a file stored in a magnetic disk; running the file to be monitored through a target process based on the identification information; acquiring a file handle of the file to be monitored, and correspondingly storing the file handle and the file to be monitored in a memory; when it is monitored that the file to be monitored in the disk does not exist, acquiring the corresponding file to be monitored in the memory based on the file handle; and restoring the file to be monitored to the disk. According to the file recovery method, the file recovery device, the electronic equipment and the storage medium, the file to be monitored is operated through the process, and the file operated through the process cannot be deleted by mistake, so that the recovery of the deleted file in the disk can be ensured, and the success rate of file recovery is improved.

Description

File recovery method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a file recovery method and apparatus, an electronic device, and a storage medium.
Background
In the existing enterprises, all industries use the internet, which avoids the need of relating to Linux servers, and all the Liunx servers are files, including hardware existing in a file form, and in the production environment of the enterprises, a large number of important files, including command files, configuration files, script files, database core files and the like, are left on the servers. When a user operates on the server, especially when a deletion operation is performed, some important files may be deleted by mistake, which easily causes the Linux server to crash down.
In the related art, file data is usually backed up in a snapshot manner at a specific time point, and when a file is found to be deleted, the file data is restored based on the snapshot backup.
However, in the related art, the snapshot backup can only store the file data before a specific time point, and if the file deletion occurs at a certain time after the snapshot backup, the file data after the snapshot backup is lost, thereby reducing the success rate of file data recovery.
Disclosure of Invention
The invention provides a file recovery method, a file recovery device, electronic equipment and a storage medium, which are used for overcoming the defect that the success rate of file data recovery is reduced in the prior art.
The invention provides a file recovery method, which comprises the following steps:
acquiring identification information of a file to be monitored, which is input by a user; the file to be monitored is a file stored in a disk;
running the file to be monitored through a target process based on the identification information;
acquiring a file handle of the file to be monitored, and correspondingly storing the file handle and the file to be monitored in a memory;
when it is monitored that the file to be monitored in the disk does not exist, acquiring the corresponding file to be monitored in the memory based on the file handle;
and restoring the file to be monitored to the disk.
According to the file recovery method provided by the invention, the running of the file to be monitored through the target process based on the identification information comprises the following steps:
acquiring a storage path of the file to be monitored in the disk based on the identification information;
acquiring the file to be monitored based on the storage path;
and starting the target process to operate the file to be monitored.
According to a file recovery method provided by the present invention, before the file handle is used to obtain the corresponding file to be monitored from the memory when it is monitored that the file to be monitored in the disk does not exist, the method further includes:
and monitoring the existence of the file to be monitored in the disk according to a preset period.
According to the file recovery method provided by the invention, the monitoring of the existence of the file to be monitored in the disk according to the preset period comprises the following steps:
determining whether the file to be monitored is found in the disk or not based on the storage path according to a preset period;
when the file to be monitored is found in the magnetic disk, determining that the file to be monitored exists;
and when the file to be monitored is not found in the magnetic disk, determining that the file to be monitored does not exist.
According to the file recovery method provided by the invention, before the identification information of the file to be monitored input by the user is obtained, the method further comprises the following steps:
outputting prompt information; and the prompt information is used for prompting a user to input a file to be monitored.
According to the file recovery method provided by the invention, the file to be monitored at least comprises one of the following: command files, configuration files, script files, and database files.
The present invention also provides a file recovery apparatus, including:
the device comprises a first acquisition unit, a second acquisition unit and a monitoring unit, wherein the first acquisition unit is used for acquiring identification information of a file to be monitored, which is input by a user; the file to be monitored is a file stored in a magnetic disk;
the running unit is used for running the file to be monitored through a target process based on the identification information;
the second acquisition unit is used for acquiring the file handle of the file to be monitored and correspondingly storing the file handle and the file to be monitored in the memory;
a third obtaining unit, configured to, when it is monitored that the file to be monitored in the disk does not exist, obtain, based on the file handle, the corresponding file to be monitored in the memory;
and the recovery unit is used for recovering the file to be monitored to the disk.
The invention also provides an electronic device comprising a memory, a processor and a computer program stored on the memory and operable on the processor, wherein the processor executes the program to implement the steps of any of the file recovery methods described above.
The present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the file restoration method as described in any one of the above.
The invention also provides a computer program product comprising a computer program which, when executed by a processor, performs the steps of the file recovery method as described in any one of the above.
According to the file recovery method, the file recovery device, the electronic equipment and the storage medium, when identification information of a file to be monitored input by a user is obtained, the corresponding file to be monitored is operated through a target process based on the identification information, a handle of the file to be monitored is obtained, and the file handle and the file to be monitored are correspondingly stored in a memory; when it is monitored that the file to be monitored in the disk does not exist, the file to be monitored in the memory can be restored to the disk based on the file handle. Because the files operated by the process cannot be deleted by mistake, the recovery of the deleted files in the disk can be ensured, and the success rate of file recovery is improved.
Drawings
In order to more clearly illustrate the present invention or the technical solutions in the prior art, the drawings used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 is a flow chart of a file recovery method provided by the present invention;
FIG. 2 is a second flowchart illustrating a file recovery method according to the present invention;
FIG. 3 is a third schematic flowchart of a file recovery method according to the present invention;
FIG. 4 is a fourth flowchart illustrating a file recovery method according to the present invention;
FIG. 5 is a schematic structural diagram of a file recovery apparatus provided in the present invention;
fig. 6 is a schematic physical structure diagram of an electronic device provided in the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is obvious that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The file recovery method of the present invention is described below in conjunction with fig. 1-4.
Fig. 1 is a schematic flow diagram of a file recovery method provided by the present invention, and as shown in fig. 1, the file recovery method includes the following steps:
step 101, obtaining identification information of a file to be monitored, which is input by a user.
The file to be monitored is a file stored in a magnetic disk.
For example, when a user needs to monitor a file stored in a disk, which is considered to be important by the user, identification information of the file to be monitored may be input on a corresponding interface of the device, where the identification information may be a name of the file to be monitored; in addition, the user may input the name of one file to be monitored, or may input the names of a plurality of files to be monitored, which is not limited in the present invention.
And 102, running the file to be monitored through a target process based on the identification information.
For example, when the identification information of the file to be monitored input by the user is acquired, the corresponding file to be monitored may be acquired in the disk based on the identification information, the target process is started, and the file to be monitored is operated by the target process, so that the file to be monitored is occupied.
It can be understood that when the identification information of a plurality of files to be monitored input by a user is obtained, the corresponding files to be monitored can be obtained in the disk based on each identification information, and a target process is started for each file to be monitored, and each target process runs one file to be monitored; for example, a user inputs identification information of 3 files to be monitored, which are respectively name a1, name a2 and name A3, and when the three names are obtained, the file to be monitored corresponding to the name a1, the file to be monitored corresponding to the name a2 and the file to be monitored corresponding to the name A3 are obtained from a disk; and then starting three target processes, namely a process 1, a process 2 and a process 3, running the file to be monitored corresponding to the name A1 through the process 1, running the file to be monitored corresponding to the name A2 through the process 2, and running the file to be monitored corresponding to the name A3 through the process 3.
And 103, acquiring a file handle of the file to be monitored, and correspondingly storing the file handle and the file to be monitored in an internal memory.
The file handle may be identification information of the file to be monitored, or may be other information that is convenient for remembering the file to be monitored.
For example, the obtaining of the file handle of the file to be monitored may specifically be: in actual service, when monitoring is often performed on a file to be monitored for the first time, the file handle needs to be created for the file to be monitored, and in the process of performing continuous monitoring on the file to be monitored for which the file handle is created, the created file handle can be directly obtained subsequently without repeated creation. In the scheme, after the file handle of the file to be monitored is obtained, the file handle and the file to be monitored are correspondingly stored in the memory, specifically under the directory of the process number of the target process in the memory.
It can be understood that when the identification information of a plurality of files to be monitored input by a user is obtained, a file handle of each file to be monitored needs to be obtained, and each file handle and the corresponding file to be monitored are stored in corresponding positions in the memory; for example, if the file to be monitored corresponding to the name a1 is run through the process 1, the file to be monitored and the file handle corresponding to the name a1 are stored in the memory under the directory of the process number of the process 1; if the file to be monitored corresponding to the name A2 is operated through the process 2, storing the file to be monitored corresponding to the name A2 and the file handle in the directory of the process number of the process 2 in the memory; if the file to be monitored corresponding to the name A3 is run through the process 3, the file to be monitored and the file handle corresponding to the name A3 are stored in the directory of the process number of the process 3 in the memory.
And 104, when it is monitored that the file to be monitored in the disk does not exist, acquiring the corresponding file to be monitored in the memory based on the file handle.
For example, after the file to be monitored is run through the target process, a timing task may be added, the existence of the file to be monitored in the disk is automatically monitored at regular intervals, and when the file to be monitored in the disk is monitored to be absent, it is indicated that the file to be monitored may be deleted by mistake; and acquiring the corresponding file to be monitored in the memory based on the file handle.
And 105, restoring the file to be monitored to the disk.
Illustratively, when the corresponding file to be monitored is found in the memory based on the file handle, the file to be monitored is automatically copied to the original storage position according to the original storage position of the file to be monitored in the disk, so as to realize the automatic recovery of the deleted file to be monitored in the disk. For example, when it is monitored that a file to be monitored corresponding to the name a2 in the disk is lost, the file handle of the file to be monitored corresponding to the name a2 is used to search the file to be monitored corresponding to the name a2 in the directory of the process number of the process 2 in the memory, and the searched file to be monitored corresponding to the name a2 is copied to the disk, so that the file to be monitored corresponding to the name a2 in the disk is automatically recovered.
When the identification information of the file to be monitored input by a user is acquired, the corresponding file to be monitored is operated through a target process based on the identification information, the handle of the file to be monitored is acquired, and the file handle and the file to be monitored are correspondingly stored in a memory; when it is monitored that the file to be monitored in the disk does not exist, the file to be monitored in the memory can be restored to the disk based on the file handle. Because the file operated by the process cannot be deleted by mistake, the recovery of the deleted file in the disk can be ensured, and the success rate of file recovery is improved.
Optionally, fig. 2 is a second schematic flow chart of the file recovery method provided by the present invention, as shown in fig. 2, step 102 in fig. 1 may be specifically implemented by the following steps:
step 1021, obtaining the storage path of the file to be monitored in the disk based on the identification information.
For example, when the identification information of the file to be monitored input by the user is acquired, a storage path corresponding to the identification information may be searched in the path list, where the storage path is a storage path of the file to be monitored in the disk; the path list is pre-established, and the path list stores the corresponding relationship between the identification information of each file stored in the disk and the storage path.
And step 1022, acquiring the file to be monitored based on the storage path.
For example, when a storage path of the file to be monitored in the disk is acquired, the file to be monitored may be acquired in the disk based on the storage path.
And 1023, starting the target process to run the file to be monitored.
Illustratively, when a file to be monitored is acquired from a disk, a target process is started, and the file to be monitored is operated through the target process, so that the file to be monitored is occupied in a memory.
According to the file recovery method provided by the invention, the storage path of the file to be monitored in the disk can be obtained based on the mark information, so that the target process can obtain the file to be monitored based on the storage path, and the normal operation of the file to be monitored by the target process is realized.
Optionally, fig. 3 is a third schematic flow chart of the file recovery method provided by the present invention, and as shown in fig. 3, before the step 104 in fig. 1 is executed, the file recovery method further includes the following steps:
and 106, monitoring the existence of the file to be monitored in the magnetic disk according to a preset period.
The preset period is a preset value, and can be set according to a requirement, for example, the preset period is any time between 0.1 second and 1 second.
Illustratively, the disk is accessed according to a preset period, and the existence of the file to be monitored in the disk is monitored.
The file recovery method provided by the invention monitors the file to be monitored in the disk according to the preset period, thereby realizing the automatic monitoring of the existence of the file in the disk.
Optionally, the monitoring of the existence of the file to be monitored in the disk according to the preset period may be implemented by:
determining whether the file to be monitored is found in the disk or not based on the storage path according to a preset period; when the file to be monitored is found in the magnetic disk, determining that the file to be monitored exists; and when the file to be monitored is not found in the magnetic disk, determining that the file to be monitored does not exist.
Illustratively, according to a preset period, accessing a disk based on an acquired storage path, determining whether a file to be monitored is found in the disk, if the file to be monitored is found in the disk, indicating that the file to be monitored in the disk is not deleted by mistake, namely determining that the file to be monitored exists, and doing no action at this time; if the file to be monitored is not found in the disk, the file to be monitored in the disk is possibly deleted by mistake, and the file to be monitored is determined to be absent.
The file recovery method provided by the invention can automatically monitor the existence of the file to be monitored in the disk based on the storage path, and a user does not need to manually check whether the file exists in the disk, so that the efficiency of monitoring the existence of the file is improved, and meanwhile, the file which is deleted by mistake in the disk can be conveniently found in time.
Optionally, fig. 4 is a fourth schematic flowchart of the file recovery method provided by the present invention, as shown in fig. 4, before executing step 101 in fig. 1, the file recovery method further includes the following steps:
and step 107, outputting prompt information.
And the prompt information is used for prompting a user to input a file to be monitored.
For example, prompt information for prompting the user to input a file to be monitored can be periodically output to the user, and the mode for outputting the prompt information can be displaying the prompt information, or voice broadcasting the prompt information, or sending the prompt information to the user equipment; when receiving the prompt message, the user can input the names of one or more files to be monitored which are considered to be important according to the requirement of the user.
The file recovery method provided by the invention has the advantages that the prompt information is input to the user, the user can conveniently input the file to be monitored when receiving the prompt information, and the user is prevented from forgetting to input the file to be monitored.
It should be noted that, before executing step 107, the method may further include the following steps:
and determining the current system version of the electronic equipment through the version identification of the electronic equipment, calling a corresponding command based on the current system version of the electronic equipment, and executing a file recovery method based on the corresponding command.
It should be noted that, in practical applications, all the steps described above may be integrated into one executable file, so that the electronic device is convenient to load the executable file and perform a specific file recovery process.
Optionally, the file to be monitored at least includes one of the following: command files, configuration files, script files, and database files.
For example, when the number of the files to be monitored is one, the files to be monitored may include a command file, or a configuration file, or a script file, or a database file, etc.; when the number of the files to be monitored is multiple, the files to be monitored may be any combination of command files, configuration files, script files and database files, or multiple command files, or multiple configuration files, or multiple script files, or multiple database files, which is not limited in the present invention.
The file recovery method provided by the invention can recover the files such as command files, configuration files, script files, database files and the like in the equipment, and embodies the comprehensiveness of file recovery.
In summary, the file recovery method provided by the invention can realize automatic monitoring of existence of any file in the disk, and can realize automatic and timely recovery of lost files in the disk based on the file handle without adopting external electronic equipment to back up important files, thereby improving the success rate of file recovery and saving external resources.
The following describes the file recovery apparatus provided by the present invention, and the file recovery apparatus described below and the file recovery method described above may be referred to correspondingly.
Fig. 5 is a schematic structural diagram of a file recovery apparatus provided by the present invention, and as shown in fig. 6, the file recovery apparatus includes a first obtaining unit 501, an executing unit 502, a second obtaining unit 503, a third obtaining unit 504, and a recovering unit 505; wherein:
a first obtaining unit 501, configured to obtain identification information of a file to be monitored, where the identification information is input by a user; the file to be monitored is a file stored in a magnetic disk;
an operation unit 502, configured to operate the file to be monitored through a target process based on the identification information;
a second obtaining unit 503, configured to obtain a file handle of the file to be monitored, and store the file handle and the file to be monitored in a memory correspondingly;
a third obtaining unit 504, configured to, when it is monitored that the file to be monitored in the disk does not exist, obtain, based on the file handle, the corresponding file to be monitored in the memory;
and a restoring unit 505, configured to restore the file to be monitored to the disk.
When the identification information of the file to be monitored input by a user is acquired, the corresponding file to be monitored is operated through a target process based on the identification information, the handle of the file to be monitored is acquired, and the file handle and the file to be monitored are correspondingly stored in a memory; when it is monitored that the file to be monitored in the disk does not exist, the file to be monitored in the memory can be restored to the disk based on the file handle. Because the files operated by the process cannot be deleted by mistake, the recovery of the deleted files in the disk can be ensured, and the success rate of file recovery is improved.
Based on any of the above embodiments, the operation unit 502 is specifically configured to:
acquiring a storage path of the file to be monitored in the disk based on the identification information;
acquiring the file to be monitored based on the storage path;
and starting the target process to operate the file to be monitored.
Based on any of the above embodiments, the apparatus further comprises a monitoring unit;
and the monitoring unit is used for monitoring the existence of the file to be monitored in the magnetic disk according to a preset period.
Based on any of the above embodiments, the monitoring unit is specifically configured to:
determining whether the file to be monitored is found in the disk or not based on the storage path according to a preset period;
when the file to be monitored is found in the magnetic disk, determining that the file to be monitored exists;
and when the file to be monitored is not found in the magnetic disk, determining that the file to be monitored does not exist.
According to any of the above embodiments, the apparatus further comprises an output unit;
the output unit is used for outputting prompt information; and the prompt information is used for prompting a user to input a file to be monitored.
Based on any embodiment, the file to be monitored at least comprises one of the following files: command files, configuration files, script files, and database files.
Fig. 6 is a schematic physical structure diagram of an electronic device provided in the present invention, and as shown in fig. 6, the electronic device may include: a processor (processor)610, a communication Interface (Communications Interface)620, a memory (memory)630 and a communication bus 640, wherein the processor 610, the communication Interface 620 and the memory 630 communicate with each other via the communication bus 640. The processor 610 may call logic instructions in the memory 630 to perform a file restore method comprising: acquiring identification information of a file to be monitored, which is input by a user; the file to be monitored is a file stored in a magnetic disk;
running the file to be monitored through a target process based on the identification information;
acquiring a file handle of the file to be monitored, and correspondingly storing the file handle and the file to be monitored in a memory;
when it is monitored that the file to be monitored in the disk does not exist, acquiring the corresponding file to be monitored in the memory based on the file handle;
and restoring the file to be monitored to the disk.
In addition, the logic instructions in the memory 630 may be implemented in software functional units and stored in a computer readable storage medium when the logic instructions are sold or used as independent products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
In another aspect, the present invention also provides a computer program product, the computer program product including a computer program, the computer program being storable on a non-transitory computer-readable storage medium, the computer program, when executed by a processor, being capable of executing the file recovery method provided by the above methods, the method including: acquiring identification information of a file to be monitored, which is input by a user; the file to be monitored is a file stored in a disk;
running the file to be monitored through a target process based on the identification information;
acquiring a file handle of the file to be monitored, and correspondingly storing the file handle and the file to be monitored in a memory;
when it is monitored that the file to be monitored in the disk does not exist, acquiring the corresponding file to be monitored in the memory based on the file handle;
and restoring the file to be monitored to the disk.
In yet another aspect, the present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored, the computer program, when executed by a processor, implementing a file recovery method provided by the above methods, the method including: acquiring identification information of a file to be monitored, which is input by a user; the file to be monitored is a file stored in a magnetic disk;
running the file to be monitored through a target process based on the identification information;
acquiring a file handle of the file to be monitored, and correspondingly storing the file handle and the file to be monitored in a memory;
when it is monitored that the file to be monitored in the disk does not exist, acquiring the corresponding file to be monitored in the memory based on the file handle;
and restoring the file to be monitored to the disk.
The above-described embodiments of the apparatus are merely illustrative, and the 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 modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. Based on the understanding, the above technical solutions substantially or otherwise contributing to the prior art may be embodied in the form of a software product, which may be stored in a computer-readable storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the various embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will 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 of the embodiments of the present invention.

Claims (10)

1. A file recovery method, comprising:
acquiring identification information of a file to be monitored, which is input by a user; the file to be monitored is a file stored in a magnetic disk;
running the file to be monitored through a target process based on the identification information;
acquiring a file handle of the file to be monitored, and correspondingly storing the file handle and the file to be monitored in a memory;
when it is monitored that the file to be monitored in the disk does not exist, acquiring the corresponding file to be monitored in the memory based on the file handle;
and restoring the file to be monitored to the disk.
2. The file recovery method according to claim 1, wherein the running the file to be monitored by the target process based on the identification information includes:
acquiring a storage path of the file to be monitored in the disk based on the identification information;
acquiring the file to be monitored based on the storage path;
and starting the target process to operate the file to be monitored.
3. The method according to claim 2, wherein before the step of acquiring the corresponding file to be monitored in the memory based on the file handle when it is monitored that the file to be monitored in the disk does not exist, the method further comprises:
and monitoring the existence of the file to be monitored in the disk according to a preset period.
4. The file recovery method according to claim 3, wherein the monitoring the existence of the file to be monitored in the disk according to a preset period comprises:
determining whether the file to be monitored is found in the disk or not based on the storage path according to a preset period;
when the file to be monitored is found in the magnetic disk, determining that the file to be monitored exists;
and when the file to be monitored is not found in the magnetic disk, determining that the file to be monitored does not exist.
5. The file recovery method according to claim 1, wherein before said obtaining the identification information of the file to be monitored input by the user, the method further comprises:
outputting prompt information; and the prompt information is used for prompting a user to input a file to be monitored.
6. The file recovery method according to any one of claims 1 to 5, wherein the file to be monitored comprises at least one of: command files, configuration files, script files, and database files.
7. A file recovery apparatus, comprising:
the device comprises a first acquisition unit, a second acquisition unit and a monitoring unit, wherein the first acquisition unit is used for acquiring identification information of a file to be monitored, which is input by a user; the file to be monitored is a file stored in a magnetic disk;
the running unit is used for running the file to be monitored through a target process based on the identification information;
the second acquisition unit is used for acquiring the file handle of the file to be monitored and correspondingly storing the file handle and the file to be monitored in the memory;
a third obtaining unit, configured to, when it is monitored that the file to be monitored in the disk does not exist, obtain, based on the file handle, the corresponding file to be monitored in the memory;
and the recovery unit is used for recovering the file to be monitored to the disk.
8. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the steps of the file recovery method according to any of claims 1 to 6 are implemented when the program is executed by the processor.
9. A non-transitory computer-readable storage medium, on which a computer program is stored, wherein the computer program, when executed by a processor, implements the steps of the file recovery method according to any one of claims 1 to 6.
10. A computer program product comprising a computer program, characterized in that the computer program realizes the steps of the file recovery method according to any one of claims 1 to 6 when executed by a processor.
CN202111567028.XA 2021-12-20 2021-12-20 File recovery method and device, electronic equipment and storage medium Pending CN114443354A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111567028.XA CN114443354A (en) 2021-12-20 2021-12-20 File recovery method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111567028.XA CN114443354A (en) 2021-12-20 2021-12-20 File recovery method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114443354A true CN114443354A (en) 2022-05-06

Family

ID=81364183

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111567028.XA Pending CN114443354A (en) 2021-12-20 2021-12-20 File recovery method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114443354A (en)

Similar Documents

Publication Publication Date Title
US10152382B2 (en) Method and system for monitoring virtual machine cluster
US20180285216A1 (en) Virtual Machine Recovery Method and Virtual Machine Management Device
CN110543386B (en) Data storage method, device, equipment and storage medium
CN112596951A (en) NAS data disaster tolerance method, device, equipment and storage medium
CN112463437B (en) Service recovery method, system and related components of storage cluster system offline node
CN110650164B (en) File uploading method and device, terminal and computer storage medium
CN111666266A (en) Data migration method and related equipment
CN109361553B (en) Configuration rollback method and device
CN110196749B (en) Virtual machine recovery method and device, storage medium and electronic device
CN110620798A (en) Control method, system, equipment and storage medium for FTP connection
CN114443354A (en) File recovery method and device, electronic equipment and storage medium
CN111226200B (en) Method, device and distributed system for creating consistent snapshot for distributed application
CN111130856A (en) Server configuration method, system, equipment and computer readable storage medium
CN110688252A (en) Data recovery method, data backup device and storage medium
CN113112023B (en) Inference service management method and device of AIStation inference platform
CN115687019A (en) Database cluster fault processing method, intelligent monitoring platform, equipment and medium
CN110109775B (en) Virtual machine recovery method and device, terminal equipment and storage medium
CN108509252B (en) Virtual machine starting device and method and host
CN112948020A (en) Configuration file processing method and device
CN112783832B (en) Method and device for storing snapshot file
CN108958827B (en) Method and system for processing program upgrading fault
CN105765908A (en) Method, client and system for multi-site automatic update
CN115269161B (en) Abnormal process reverse rollback method and system
CN115543698B (en) Data backup method, device, equipment and storage medium
CN109257404B (en) Data backup method, device and system

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