File restoration method, device, computing equipment and readable storage medium

By creating a restore service during the startup process of the computing device and compiling the restore module into the memory file system, a second memory file system is generated, and file restoration is performed between the root partition mount service and the real root file system service. This solves the problem of inaccurate file restoration in the existing technology and achieves a balance between high accuracy and fast startup.

CN114691429BActive Publication Date: 2025-09-23UNIONTECH SOFTWARE TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210368240.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-31
Publication Date
2025-09-23
Estimated Expiration
2042-03-31

AI Technical Summary

Technical Problem

Existing file restoration methods easily lead to inconsistencies between restored files and backup files during system operation, resulting in low accuracy.

Method used

During the startup process of the computing device, a restore service is created and the restore module is compiled into the memory file system. A second memory file system is generated using the memory file system generation tool, and the restore service is started between the root partition mounting service and the switching to the real root file system service to perform file restoration.

Benefits of technology

Restoring files at the initial stage of system startup avoids file modifications during system operation, maximizes the accuracy of file restoration, and has minimal impact on the startup speed of the computing device.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114691429B_ABST
    Figure CN114691429B_ABST
Patent Text Reader

Abstract

The present invention discloses a file restoration method, apparatus, computing device and readable storage medium. The method of the present invention is executed in a computing device, and includes: creating a restoration service, the restoration service including calling a restoration script, and setting the restoration service to start between the root partition mounting service and the switching to the real root file system service, the restoration script including calling a restoration module in a restoration tool to restore the target file. Then, the restoration service and the restoration module are compiled into a first memory file system, and the first memory file system in the current computing device is replaced with the obtained second memory file system. Then, the computing device is restarted, and the restoration service in the second memory file system is started between the root partition mounting service and the switching to the real root file system service. Finally, the restoration script is called to restore the target file based on the restoration module. The file restoration method of the present invention can maximize the accuracy of file restoration.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computers, and in particular to a file restoration method, device, computing equipment, and readable storage medium. Background Art

[0002] In order to restore the operating system or the files therein, users generally install backup and restore tools on the operating system, such as rsync, rclone, and scp. However, it should be noted that these tools can only restore files after the system is started. In other words, when using the above tools to restore files, the system is still running, and some software may not be terminated. However, during the file restoration process, the restored files or their associated files may be modified due to the operation of the system and software, so there will be differences between the restored files and the files backed up by the user. Therefore, the current file restoration methods have low accuracy and cannot guarantee that the restored files are completely consistent with the files backed up by the user.

[0003] Therefore, a new file restoration method is urgently needed to solve the above problems. Summary of the Invention

[0004] To this end, the present invention provides a file restoration method, apparatus, computing device, and readable storage medium in an effort to solve or at least alleviate the above problems.

[0005] According to one aspect of the present invention, a file restoration method is provided, which is executed in a computing device, the method comprising: creating a restoration service, the restoration service comprising calling a restoration script, and setting the restoration service to be started between a root partition mounting service and a switch to a real root file system service, the restoration script comprising calling a restoration module in a restoration tool to restore a target file; compiling the restoration service and the restoration module into a first memory file system to obtain a second memory file system; replacing the first memory file system in the current computing device with the second memory file system; restarting the computing device, and starting the restoration service in the second memory file system between the root partition mounting service and the switch to the real root file system service; and calling the restoration script to restore the target file based on the restoration module in the second memory file system.

[0006] Optionally, in the file restoration method according to the present invention, the step of compiling the restoration service and the restoration module into the first memory file system includes: creating a script in the memory file system generation tool to install the restoration service and the restoration module into the first memory file system; and using the memory file system generation tool to recompile the first memory file system to obtain a second memory file system.

[0007] Optionally, in the file restoration method according to the present invention, the memory file system generation tool is a dracut tool.

[0008] Optionally, in the file restoration method according to the present invention, the restoration tool is a Uniontech-backup tool or a BackupPC tool.

[0009] Optionally, in the file restoration method according to the present invention, before the step of replacing the first memory file system in the current computing device with the second memory file system, the method further includes: backing up the first memory file system.

[0010] Optionally, in the file restoration method according to the present invention, the step of setting the restoration service to start between the root partition mounting service and switching to the real root file system service includes: setting the restoration service as the first service to be started after starting the root partition mounting service.

[0011] Optionally, in the file restoration method according to the present invention, the target file is a system file or an application layer file.

[0012] According to another aspect of the present invention, a file restoration device is provided, which resides in a computing device, and includes: a creation unit, adapted to create a restoration service, the restoration service including calling a restoration script, and setting the restoration service to start between the root partition mounting service and the switching to the real root file system service, the restoration script including calling a restoration module in a restoration tool to restore the target file; a compilation unit, adapted to compile the restoration service and the restoration module into a first memory file system to obtain a second memory file system; a replacement unit, adapted to replace the first memory file system in the current computing device with the second memory file system; a restart unit, adapted to restart the computing device, and start the restoration service in the second memory file system between the root partition mounting service and the switching to the real root file system service; and a restoration unit, adapted to call the restoration script to restore the target file based on the restoration module in the second memory file system.

[0013] According to another aspect of the present invention, a computing device is provided, comprising: at least one processor; and a memory storing program instructions, wherein the program instructions are configured to be suitable for execution by the at least one processor, and the program instructions include instructions for executing the file restoration method according to the present invention.

[0014] According to another aspect of the present invention, a readable storage medium storing program instructions is provided. When the program instructions are read and executed by a computing device, the computing device executes the file restoration method according to the present invention.

[0015] According to the file restoration method of the present invention, a restoration service is first created, wherein the restoration service includes calling a restoration script and setting the restoration service to start between the root partition mounting service and the switch to the real root file system service. Next, the created restoration service and the restoration module called in the restoration script are compiled into the first memory file system to obtain a second memory file system, and the first memory file system in the current computing device is replaced with the second memory file system. Then, the computing device is restarted, and the restoration service in the second memory file system is started between the root partition mounting service and the switch to the real root file system service. Finally, the restoration script is called to restore the target file based on the restoration module in the second memory file system.

[0016] As can be seen, the restoration service of the present invention is initiated between the root partition mounting service and the switch to the actual root file system service. Therefore, the present invention restores files after the root partition mounting service is initiated and before the switch to the actual root file system service is initiated. In other words, when restoring files, the system is in the early stages of startup and not yet fully operational. Therefore, the restored files are not modified by system operation, thus maximizing the accuracy of file restoration.

[0017] Furthermore, the present invention does not install the entire restore tool into the in-memory file system. Instead, it installs only the restore module within the restore tool. This minimizes the increase in file size after the restore module is installed, minimizing the impact on the computing device's startup speed to a level that is barely noticeable to the user. In other words, the present invention maximizes file restoration accuracy while maintaining computing device startup speed. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] To achieve the above and related purposes, certain illustrative aspects are described herein in conjunction with the following description and accompanying drawings, which indicate various ways in which the principles disclosed herein may be practiced, and all aspects and their equivalents are intended to fall within the scope of the claimed subject matter. The above and other objects, features, and advantages of the present disclosure will become more apparent by reading the following detailed description in conjunction with the accompanying drawings. Throughout this disclosure, the same reference numerals generally refer to the same parts or elements.

[0019] Figure 1 shows a structural block diagram of a computing device 100 according to one embodiment of the present invention;

[0020] Figure 2 A flowchart of a file restoration method 200 according to an embodiment of the present invention is shown;

[0021] Figure 3A schematic diagram showing the startup sequence of each daemon process according to one embodiment of the present invention;

[0022] Figure 4 A structural block diagram of a file restoration device 400 according to an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0023] Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0024] Figure 1 FIG1 shows a block diagram of a computing device 100 according to an embodiment of the present invention. Figure 1 The computing device 100 shown is only an example. In practice, the computing device used to implement the file restoration method of the present invention can be any type of device, and its hardware configuration can be different from the above. Figure 1 The computing device 100 shown is the same as Figure 1 The computing device 100 shown is different. In practice, the computing device used to implement the file restoration method of the present invention can be Figure 1 The hardware components of the computing device 100 shown may be added or deleted, and the present invention does not limit the specific hardware configuration of the computing device.

[0025] like Figure 1 As shown, in a basic configuration 102, computing device 100 typically includes system memory 106 and one or more processors 104. A memory bus 108 may be used for communication between processor 104 and system memory 106.

[0026] Depending on the desired configuration, the processor 104 can be any type of processor, including, but not limited to, a microprocessor (μP), a microcontroller (μC), a digital signal processing unit (DSP), or any combination thereof. The processor 104 can include one or more levels of cache, such as a level 1 cache 110 and a level 2 cache 112, a processor core 114, and registers 116. An example processor core 114 can include an arithmetic logic unit (ALU), a floating point unit (FPU), a digital signal processing core (DSP core), or any combination thereof. An example memory controller 118 can be used with the processor 104, or in some implementations, the memory controller 118 can be an internal part of the processor 104.

[0027] Depending on the desired configuration, system memory 106 can be any type of memory, including but not limited to volatile memory (such as RAM), non-volatile memory (such as ROM, flash memory, etc.), or any combination thereof. Physical memory in a computing device typically refers to volatile RAM. Data from a disk must be loaded into physical memory before it can be read by processor 104. System memory 106 may include an operating system 120, one or more applications 122, and program data 124. In some embodiments, applications 122 may be arranged so that one or more processors 104 execute instructions on the operating system using program data 124. Operating system 120 may be, for example, Linux or Windows, and includes program instructions for handling basic system services and performing hardware-dependent tasks. Applications 122 include program instructions for implementing various user-desired functions. Applications 122 may include, but are not limited to, browsers, instant messaging software, software development tools (such as integrated development environments (IDEs) and compilers). When applications 122 are installed in computing device 100, driver modules may be added to operating system 120.

[0028] When the computing device 100 is started, the processor 104 reads and executes the program instructions of the operating system 120 from the system memory 106. Applications 122 run on top of the operating system 120, utilizing the interfaces provided by the operating system 120 and the underlying hardware to implement various user-desired functions. When a user launches an application 122, it is loaded into the system memory 106, and the processor 104 reads and executes the program instructions of the application 122 from the system memory 106.

[0029] Computing device 100 also includes a storage device 132 including removable storage 136 and non-removable storage 138 , both of which are connected to storage interface bus 134 .

[0030] The computing device 100 may also include an interface bus 140 that facilitates communication from various interface devices (e.g., output devices 142, peripheral interfaces 144, and communication devices 146) to the basic configuration 102 via the bus / interface controller 130. Example output devices 142 include a graphics processing unit 148 and an audio processing unit 150. These can be configured to facilitate communication with various external devices such as a display or speakers via one or more A / V ports 152. Example peripheral interfaces 144 may include a serial interface controller 154 and a parallel interface controller 156, which can be configured to facilitate communication with external devices such as input devices (e.g., a keyboard, mouse, pen, voice input device, touch input device) or other peripherals (e.g., a printer, scanner, etc.) via one or more I / O ports 158. Example communication devices 146 may include a network controller 160, which can be arranged to facilitate communication with one or more other computing devices 162 via a network communication link via one or more communication ports 164.

[0031] A network communication link can be an example of a communication medium. Communication media can generally be embodied as computer-readable instructions, data structures, program modules in a modulated data signal such as a carrier wave or other transmission mechanism, and can include any information delivery medium. A "modulated data signal" can be a signal in which one or more of its data sets or changes thereto can be performed in a manner that encodes information in the signal. As non-limiting examples, communication media can include wired media such as a wired network or a dedicated line network, and various wireless media such as sound, radio frequency (RF), microwave, infrared (IR) or other wireless media. The term computer-readable medium as used herein can include both storage media and communication media.

[0032] In the computing device 100 according to the present invention, the application 122 includes instructions for executing the file restoration method 200 of the present invention, and the instructions can instruct the processor 104 to execute the file restoration method of the present invention. Those skilled in the art will understand that, in addition to the instructions for executing the file restoration method 200, the application 122 can also include other applications 126 for implementing other functions.

[0033] Figure 2 A flowchart of a file restoration method 200 according to an embodiment of the present invention is shown. The method 200 is suitable for performing file restoration on a computing device (eg Figure 1 Executed in the computing device 100 shown in FIG. Figure 2 As shown, the method starts at step S210.

[0034] In step S210, a restore service is created. Specifically, the restore service includes calling a restore script and setting the restore service to start between the root partition mount service and the switch to the real root file system service. Specifically, the restore service includes two steps: executing the restore script and setting the restore service startup sequence, setting the restore service to start between the root partition mount service and the switch to the real root file system service.

[0035] Regarding the startup of the restore service, you can further set the restore service to be the first service to be started after the root partition mount service is started. In other words, after starting the root partition mount service, the created restore service will be started next.

[0036] The following is an example using the Linux operating system. systemd is a Linux system tool used to start daemons. The default order of starting each daemon during kernel startup is as follows: Figure 3 As shown. Initrd-root-fs.target is the root partition mount service. According to the above description, the restore service is the first service to be started after the root partition mount service is started, so the restore service should be located in Figure 3 between initrd-root-fs.target and dracut-mount.service. It should be noted that this is an example using the Linux operating system, but is not limited thereto. The present invention does not limit the specific type of operating system.

[0037] Regarding the content of the restore script, it specifically involves calling the restore module in the restore tool to restore the target files. The target files can be system files or application-layer files. System files are files that store critical information for the operating system. They are generally automatically created and stored in corresponding folders during the operating system installation process. They directly affect the normal operation of the system and are generally not allowed to be modified at will. Application-layer files are files related to applications running on the operating system, i.e., user files.

[0038] According to one embodiment of the present invention, the exemplary code for restoring the service is as follows:

[0039] [Unit]

[0040] Description=Backup restore daemon

[0041] DefaultDependencies=no

[0042] ConditionPathExists= / etc / initrd-release

[0043] OnFailure=emergency.target

[0044] OnFailureJobMode=replace-irreversibly

[0045] Requires=initrd-root-fs.target#Set the service to start after the root partition is mounted

[0046] After=initrd-root-fs.target#Set the service to start after the root partition is mounted

[0047] AllowIsolate=yes

[0048] [Service]

[0049] Type=oneshot

[0050] ExecStart = / usr / bin / ubackup_restore#Call the restore script and perform the restore operation

[0051] At this point, the restore service is created. The process then proceeds to step S220, where the restore service and restore module are compiled into the first in-memory file system, resulting in a second in-memory file system. Here, the initramfs file system is explained. The initramfs is mounted before the operating system's actual root file system is started. Therefore, it provides a user-mode environment during the early stages of kernel startup, allowing it to perform tasks that are difficult for the kernel to complete during startup.

[0052] In this step, the restoration service and restoration module can be compiled into the first memory file system using a memory file system generation tool. Preferably, the memory file system generation tool can be the dracut tool. Dracut was designed with image size in mind, minimizing hardcoding into initramfs. Therefore, using the dracut tool to compile the restoration service and restoration module into the first memory file system can increase the speed of image loading into memory.

[0053] According to one embodiment of the present invention, the steps of compiling the restoration service and the restoration module into the first memory file system using the memory file system generation tool dracut are as follows:

[0054] First, in the memory file system generation tool dracut, create a script to install the restoration service and the restoration module into the first memory file system. Furthermore, in the dracut module of the dracut tool, create a script to install the restoration service and the restoration module into the first memory file system. The specific content of the script includes: setting the dracut module as the default installation module, installing the restoration module into the first memory file system, and installing the restoration service into the first memory file system. It should be noted that the purpose of setting the dracut module as the default installation module here is to add the restoration module and the restoration service to the first memory file system.

[0055] According to one embodiment of the present invention, the script created in the dracut module to install the restoration service and the restoration module into the first memory file system is module-setup.sh, and its exemplary code is as follows:

[0056] Then, the first in-memory file system is recompiled using the in-memory file system generation tool dracut to obtain a second in-memory file system. As mentioned above, the dracut module of the in-memory file system generation tool dracut creates a script for installing the restore service and the restore module into the first in-memory file system. Therefore, when the dracut tool is used to recompile the first in-memory file system, the dracut tool automatically calls the script created therein to add the restore service and the restore module to the first in-memory file system, thereby obtaining the second in-memory file system.

[0057] It should be noted here that the second memory file system is obtained by adding the restore module for restoring the target file called in the created restore service and restore script to the first memory file system. Therefore, compared with the first memory file system, the volume of the second memory file system is bound to increase. If the volume of the second memory file system is too large, it will affect the startup speed of the computing device. Therefore, it is preferred to use a restore module in a smaller backup and restore tool. For example, the restore module in the Uniontech-backup tool or the BackupPC tool can be used. Of course, the above is only an example, and the restore module in other detachable or smaller backup and restore tools can also be used, and the present invention is not limited to this.

[0058] After obtaining the second memory file system, the process proceeds to step S230, where the first memory file system in the current computing device is replaced with the second memory file system. Memory file systems are generally mounted in the / boot directory. Therefore, this step specifically replaces the first memory file system in the / boot directory with the second memory file system. This way, the second memory file system will be loaded the next time the system is booted. Furthermore, before replacing the first memory file system in the current computing device with the second memory file system, according to one embodiment of the present invention, the first memory file system may be backed up to facilitate subsequent restoration of the second memory file system to the first memory file system.

[0059] According to one embodiment of the present invention, exemplary code for replacing a first memory file system in a current computing device with a second memory file system is as follows:

[0060] #Generate initramfs

[0061] dracut initramfs-$(uname-r).img

[0062] #Back up the original initramfs

[0063] mv / boot / initramfs-$(uname-r).img / boot / initramfs-$(uname-r)-bak.img

[0064] #Replace initramfs, and the regenerated initramfs can be loaded into memory at next boot

[0065] mv initramfs-$(uname-r).img / boot / initramfs-$(uname-r).img

[0066] Then, the process proceeds to step S240 , where the computing device is restarted, and between the root partition mounting service and the switching to the real root file system service, the restoration service in the second memory file system is started.

[0067] In step S230 above, the first memory file system has been replaced with the second memory file system. Therefore, after the computing device restarts, the second memory file system is loaded. Specifically, according to the content of the restore service in the second memory file system, the restore service is started between the root partition mount service and the switch to the real root file system service. Furthermore, when in some embodiments the restore service is set as the first service to be started after the root partition mount service is started, the restore service is started immediately after the root partition mount service is started.

[0068] Subsequently, step S250 is entered to call the restore script to restore the target file based on the restore module in the second memory file system. Specifically, after the restore service is started, the restore script is called according to the content in the restore service. After the root partition mount service is started, the memory file system has been created (i.e., the second memory file system has been created). At this time, the restore module has the conditions to restore the file. Therefore, after calling the restore script in the restore service, the target file can be restored by calling the restore module.

[0069] It should be noted that according to the startup order of each daemon process, the switch to the real root file system service is after the root partition mount service (see Figure 3 ), so when restoring the target file, the actual root file system service has not yet started. Clearly, the present invention restores the target file after the root partition mount service has started, but before the actual root file system service has started. In other words, when restoring the target file, the system is in the initial startup phase and not yet fully operational. This approach clearly ensures maximum file restoration accuracy.

[0070] The present invention also provides a file restoration device. Figure 4 FIG. 4 shows a structural block diagram of a file restoration apparatus 400 according to an embodiment of the present invention, which is suitable for being resident in a computing device 100. Figure 4 As shown, the file restoration device includes a creation unit 410 , a compilation unit 420 , a replacement unit 430 and a restart unit 430 .

[0071] The creation unit 410 is adapted to create a restore service, wherein the restore service includes calling a restore script and setting the restore service to start between the root partition mounting service and the switching to the real root file system service. The restore script includes calling a restore module in the restore tool to restore the target file.

[0072] The compiling unit 420 is adapted to compile the restoration service and the restoration tool into the first memory file system to obtain a second memory file system.

[0073] The replacement unit 430 is adapted to replace the first memory file system in the current computing device with the second memory file system.

[0074] The restart unit 440 is adapted to restart the computing device and start the restoration service in the second memory file system between the root partition mounting service and the switching to the real root file system service.

[0075] The restoration unit 450 is adapted to call a restoration script to restore the target file based on the restoration module in the second memory file system.

[0076] The specific details of the file restoration device 400 according to the present invention are described in detail based on Figures 1 to 3 The details are disclosed in the description and will not be repeated here.

[0077] According to the file restoration method of the present invention, a restoration service is first created, wherein the restoration service includes calling a restoration script and setting the restoration service to start between the root partition mounting service and the switch to the real root file system service. Next, the created restoration service and the restoration module called in the restoration script are compiled into the first memory file system to obtain a second memory file system, and the first memory file system in the current computing device is replaced with the second memory file system. Then, the computing device is restarted, and the restoration service in the second memory file system is started between the root partition mounting service and the switch to the real root file system service. Finally, the restoration script is called to restore the target file based on the restoration module in the second memory file system.

[0078] As can be seen, the restoration service of the present invention is initiated between the root partition mounting service and the switch to the actual root file system service. Therefore, the present invention restores files after the root partition mounting service is initiated and before the switch to the actual root file system service is initiated. In other words, when restoring files, the system is in the early stages of startup and not yet fully operational. Therefore, the restored files are not modified by system operation, thus maximizing the accuracy of file restoration.

[0079] Furthermore, the present invention does not install the entire restore tool into the in-memory file system. Instead, it installs only the restore module within the restore tool. This minimizes the increase in file size after the restore module is installed, minimizing the impact on the computing device's startup speed to a level that is barely noticeable to the user. In other words, the present invention maximizes file restoration accuracy while maintaining computing device startup speed.

[0080] The various techniques described herein may be implemented in conjunction with hardware or software, or a combination thereof. Thus, the methods and apparatus of the present invention, or certain aspects or portions of the methods and apparatus of the present invention, may be implemented in the form of program codes (i.e., instructions) embedded in a tangible medium, such as a removable hard disk, a USB flash drive, a floppy disk, a CD-ROM, or any other machine-readable storage medium, wherein when the program is loaded into a machine such as a computer and executed by the machine, the machine becomes an apparatus for practicing the present invention.

[0081] When the program code is executed on a programmable computer, the computing device generally includes a processor, a storage medium readable by the processor (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device. The memory is configured to store the program code; the processor is configured to execute the file restoration method of the present invention according to the instructions in the program code stored in the memory.

[0082] By way of example and not limitation, readable media include readable storage media and communication media. Readable storage media store information such as computer-readable instructions, data structures, program modules, or other data. Communication media typically embody computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and include any information delivery medium. Combinations of any of the above are also included within the scope of readable media.

[0083] In the description provided herein, the algorithms and displays are not inherently related to any particular computer, virtual system, or other device. Various general-purpose systems may also be used in conjunction with the examples of the present invention. Based on the above description, it is apparent that the structure required for constructing such systems is well understood. In addition, the present invention is not directed to any specific programming language. It should be understood that various programming languages ​​may be utilized to implement the present invention described herein, and the description of specific languages ​​above is provided for the purpose of disclosing the preferred embodiment of the present invention.

[0084] In the description provided herein, a large number of specific details are described. However, it is understood that embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures, and techniques are not shown in detail so as not to obscure the understanding of this description.

[0085] It should be understood that in order to streamline the present disclosure and aid understanding of one or more of the various inventive aspects, in the above description of exemplary embodiments of the present invention, various features of the present invention are sometimes grouped together in a single embodiment, figure, or description thereof. However, this method of disclosure should not be interpreted as reflecting an intention that the claimed invention requires more features than are expressly recited in each claim.

[0086] Those skilled in the art will appreciate that the modules, units, or components of the devices in the examples disclosed herein may be arranged in the device described in the embodiment, or alternatively may be located in one or more devices different from the devices in the examples. The modules in the foregoing examples may be combined into one module or further divided into multiple submodules.

[0087] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and in addition may be divided into multiple submodules or subunits or subcomponents. All features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed herein may be combined in any combination, except that at least some of such features and / or processes or units are mutually exclusive. Unless expressly stated otherwise, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.

[0088] Furthermore, those skilled in the art will appreciate that although some embodiments described herein include certain features and not other features included in other embodiments, the combination of features from different embodiments is intended to be within the scope of the invention and to form different embodiments.

[0089] In addition, some of the embodiments are described herein as methods or combinations of method elements that can be implemented by a processor of a computer system or by other devices that perform the functions described. Thus, a processor having the necessary instructions for implementing the method or method element forms a device for implementing the method or method element. Furthermore, the elements described herein of the device embodiments are examples of devices for implementing the functions performed by the elements for the purpose of implementing the invention.

[0090] As used herein, unless otherwise specified, the use of ordinal numbers "first," "second," "third," etc. to describe common objects merely indicates that different instances of similar objects are involved and are not intended to imply that the objects so described must have a given order in time, space, ranking, or in any other manner.

[0091] Although the present invention has been described with respect to a limited number of embodiments, it will be apparent to those skilled in the art, having benefit of the foregoing description, that other embodiments are contemplated within the scope of the invention thus described. Furthermore, it should be noted that the language used in this specification has been selected primarily for readability and didactic purposes, rather than for the purpose of explaining or limiting the subject matter of the present invention. Consequently, many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the appended claims. The disclosure of the present invention is intended to be illustrative rather than restrictive of the scope of the invention, which is defined by the appended claims.

Claims

1. A file restoration method, adapted to be executed in a computing device, comprising: Creating a restore service, the restore service including calling a restore script, and setting the restore service to start between the root partition mounting service and the switching to the real root file system service, the restore script including calling a restore module in a restore tool to restore a target file, the target file being a system file or an application layer file, and setting the restore service to start between the root partition mounting service and the switching to the real root file system service includes: Set the restore service as the first service to be started after starting the root partition mount service; Compiling the restoration service and the restoration module into the first memory file system to obtain a second memory file system; Replacing the first memory file system in the current computing device with the second memory file system; Restarting the computing device, and starting the restore service in the second memory file system after the root partition mounting service is started; The restoration script is called to restore the target file based on the restoration module in the second memory file system.

2. The method according to claim 1, wherein The step of compiling the restoration service and the restoration module into the first memory file system includes: In the memory file system generation tool, creating a script for installing the restoration service and the restoration module into the first memory file system; The first memory file system is recompiled using the memory file system generation tool to obtain the second memory file system.

3. The method according to claim 1 or 2, wherein The memory file system generation tool is the dracut tool.

4. The method according to claim 1 or 2, wherein The restoration tool is the Uniontech-backup tool or the BackupPC tool.

5. The method according to claim 1 or 2, wherein: Before the step of replacing the first memory file system in the current computing device with the second memory file system, the method further includes: Back up the first memory file system.

6. A file restoration device, adapted to reside in a computing device, comprising: a creation unit adapted to create a restore service, the restore service comprising calling a restore script, and setting the restore service to be started between a root partition mount service and a switch to a real root file system service, the restore script comprising calling a restore module in a restore tool to restore a target file, the target file being a system file or an application layer file, and setting the restore service to be started between the root partition mount service and the switch to the real root file system service comprising: setting the restore service to be the first service to be started after starting the root partition mount service; a compiling unit, adapted to compile the restoration service and the restoration module into the first memory file system to obtain a second memory file system; a replacement unit, adapted to replace the first memory file system in the current computing device with the second memory file system; a restart unit, adapted to restart the computing device and start the restore service in the second memory file system after the root partition mounting service is started; The restoration unit is adapted to call the restoration script to restore the target file based on the restoration module in the second memory file system.

7. A computing device comprising: at least one processor; as well as A memory storing program instructions, wherein the program instructions are configured to be executed by the at least one processor, and the program instructions include instructions for executing the method according to any one of claims 1 to 5.

8. A readable storage medium storing program instructions, wherein when the program instructions are read and executed by a computing device, the computing device executes the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Method and apparatus for repairing file system by initramfs

    CN109062576A