Method and device for restoring factory settings and electronic equipment

By acquiring and modifying the folder node mapping in the target disk, a method of efficiently retaining important data when factory reset is realized, solving the problem of low data retention efficiency in the prior art.

CN119883112APending Publication Date: 2025-04-25FUJIAN LANDI COMMERCIAL EQUIPMENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411879566.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-19
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

In the prior art, data retention efficiency is low when restoring factory settings, and important data is easily lost.

Method used

By obtaining the whitelist and root folder nodes in the target disk, modify the root folder node to a preset folder node by modifying the mapping, and format the disk space files corresponding to other nodes except the preset folder node.

Benefits of technology

It realizes a customized and efficient factory reset process, and the efficiency of retaining important data is extremely high, avoiding the situation where important data is easily lost.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119883112A_ABST
    Figure CN119883112A_ABST
Patent Text Reader

Abstract

The invention provides a method and device for restoring factory settings and electronic device.The method comprises the steps that when a factory setting restoring request is received, a white list in a target disk and root folder nodes corresponding to objects in the white list are obtained; modifying the root folder node into a preset folder node in a mapping modification mode, wherein a disk space mapped by the root folder node before modification is consistent with a disk space mapped by the preset folder node after modification; and formatting disk space files corresponding to other nodes except the preset folder node in the target disk. According to the method, copying and pasting type backup does not need to be carried out on the object in an actual physical storage system, so that an input and output process of a disk does not exist.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data management, and in particular to a method, device and electronic device for restoring factory settings. Background Art

[0002] Restoring to factory settings is a common way to deal with device abnormalities or to quickly clean up data. However, when restoring to factory settings, users usually want to keep important data, especially data that has not been backed up. However, in the related art, data retention when restoring to factory settings has the problem of low efficiency and easy loss of important data. Summary of the invention

[0003] The technical problem to be solved by the present invention is to provide a method, device and electronic device for restoring factory settings, so as to realize a customizable and efficient factory settings restoration process.

[0004] In order to solve the above technical problems, a technical solution adopted by the present invention is: A method for restoring factory settings, applied to an electronic device, the method comprising: When a factory reset request is received, a whitelist in the target disk and a root folder node corresponding to the object in the whitelist are obtained; The root folder node is modified into a preset folder node by modifying the mapping, and the disk space mapped by the root folder node before the modification is consistent with the disk space mapped by the preset folder node after the modification; Format the disk space files corresponding to other nodes in the target disk except the preset folder node.

[0005] In order to solve the above technical problems, another technical solution adopted by the present invention is: A device for restoring factory settings, characterized by comprising a reading module, a moving module and a formatting module; The reading module is used to obtain the whitelist in the target disk and the root folder node corresponding to the object in the whitelist; The moving module is used to modify the root folder node to a preset folder node by modifying the mapping, and the disk space mapped by the root folder node before the modification is consistent with the disk space mapped by the preset folder node after the modification; The formatting module is used to format disk space files corresponding to other nodes in the target disk except the preset folder node.

[0006] In order to solve the above technical problems, another technical solution adopted by the present invention is: An electronic device comprises a memory, a processor and a computer program stored in the memory and running on the processor, wherein the processor implements each step of the above-mentioned method for restoring factory settings when executing the computer program.

[0007] The beneficial effects of the present invention are as follows: the present application obtains the root folder node where the object in the whitelist is located, modifies the root folder node to a preset folder node by modifying the mapping, and the disk space mapped by the root folder node before the modification is consistent with the disk space mapped by the preset folder node after the modification; that is, the present application utilizes the difference between the file system and the actual physical storage system, and realizes the modification of the location of the object in the file system by changing the folder node where the object is located, without the need to perform a copy-paste type backup of the object in the actual physical storage system, so there will be no disk input and output process, and will not affect the execution efficiency of restoring the factory settings. Therefore, the present application is extremely efficient when restoring the factory settings to retain data. In the process of formatting, the disk space files corresponding to the nodes other than the protection file node are deleted, and the objects in the preset file node can be protected in the formatting process, thereby realizing a customized factory reset process. Therefore, in the formatting process of the present application, the actual physical storage system of the whitelist has not changed, and data loss will not occur due to system errors or anomalies. The data retention is efficient and the situation of easy loss of important data is avoided. BRIEF DESCRIPTION OF THE DRAWINGS

[0008] Figure 1 A flowchart of a method for restoring factory settings provided by an embodiment of the present invention; Figure 2 A flowchart of the steps of a method for restoring factory settings in an actual application scenario provided by an embodiment of the present invention; Figure 3 A structural diagram of a device for restoring factory settings provided by an embodiment of the present invention; Figure 4 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0009] In order to make the technical problems, technical solutions and beneficial effects to be solved by the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0010] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0011] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.

[0012] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0013] In the related art, in the process of users using electronic devices, in addition to the various data that comes with the system, in order to realize the personalized configuration of the electronic device, the user will preset some resources in the system, and in the process of using the application, some applications will also generate some irreversible data in the system, if deleted, it will affect the normal use of the application. However, in the process of using the system, there will be a situation where it is necessary to restore the factory settings. Restoring the factory settings will delete the data in the electronic device by default, especially the system data, and restore the electronic device to its initial state. This results in the loss of data in the system of applications that the user needs to use and the personalized data configured in the system, which reduces the user's experience of using the electronic device. For example, in the Android system, system-related data will be stored in the data partition, and in the process of restoring the factory settings, the data in the data partition will be deleted by default, which affects the normal use of the system by the user after completing the factory settings restoration operation.

[0014] There are some custom factory reset methods in the related art, but they require backing up or transferring files on the disk. Factory reset is usually performed when there is a problem with the system. At this time, uncontrollable errors may occur in the operation of writing or reading the disk, resulting in backup errors, which may cause important data loss. In addition, the time required for file operations on the disk is relatively long, which reduces the efficiency of factory reset. At the same time, it is difficult to grasp the timing of backing up data. If a real-time backup is performed under normal conditions, a disk partition is wasted because the frequency of performing factory reset is usually not high. However, if the backup is started when the factory reset is needed, it means that the electronic device has a problem. At this time, the disk operation cannot guarantee the correctness. If the electronic device is abnormally shut down during the operation, the backup cannot be completed, which can easily lead to data loss.

[0015] In order to solve the above problems, the present application provides a method for restoring factory settings. The following is a detailed introduction to the method for restoring factory settings of the present application.

[0016] The method for restoring factory settings in this application can be used in scenarios where files need to be retained when customizing factory settings, especially in devices where physical storage and file systems are mapped to each other but managed independently, such as various Android devices based on Linux systems. The electronic device of this application can be a mobile terminal such as a mobile phone or a POS machine, or a device such as a cash register or a computer that has a factory settings restore function.

[0017] Please refer to Figure 1 The following specifically describes a method for restoring factory settings in the present invention, with reference to the attached Figure 1 , including steps 110 to 130.

[0018] Step 110: When a factory reset request is received, a whitelist in the target disk and a root folder node corresponding to the object in the whitelist are obtained.

[0019] In one embodiment of the present application, step 110 includes steps 101 and 102 .

[0020] Step 101: Receive configuration information, where the configuration information includes a data directory node or file.

[0021] Step 102: compose a white list according to the data directory or file, and save the white list to the target disk.

[0022] In this way, a channel is provided for users to customize the whitelist. In addition to being able to directly add a whitelist according to user customization when the electronic device leaves the factory, the user can set a directory node or file as an object in the whitelist by sending configuration information and save it in the target disk. In order to prevent deletion when restoring the factory settings, it can be pre-mapped to a preset folder node or saved in the system security area, which improves flexibility and freedom.

[0023] In one embodiment of the present application, if the whitelist is not obtained or is empty in step 110, a conventional factory reset operation is directly performed.

[0024] In one embodiment of the present application, step 110 includes step 111 .

[0025] Step 111: Create a preset folder node, and save the corresponding relationship between the object and the root folder node in the preset folder node.

[0026] In this way, after the factory reset operation is completed, the root folder node where the object originally resides can be restored according to the correspondence between the object and the root folder node, so that only one preset folder node needs to be constructed to protect the object therein. Moreover, after having a whitelist in the target disk, the correspondence between the object and the mapped root folder node can be saved, that is, there is no need to perform file operations on the disk when the factory reset is required, thereby further speeding up the efficiency of the factory reset. Moreover, since only the correspondence is saved, only the identifiers of the two need to be stored, and there is no need to store the entire file, so it will not take up too much disk space.

[0027] In one embodiment of the present application, step 112 is included after step 110 and before step 120. Either step 111 or step 112 is performed.

[0028] Step 112: Create a preset folder node on the child node of each root folder node.

[0029] In this way, a preset folder node is created on the child node of each root folder node. When modifying the mapping, the modified mapping contains not only the information of the preset folder node but also the information of the root folder node. In the subsequent process of restoring the mapping to the original state, the information of the root folder node where the object is located can be directly obtained, so there is no need to store the corresponding relationship between the root folder node and the object separately. And there is no need to operate the files in the disk.

[0030] Step 120: modify the root folder node to a preset folder node by modifying the mapping, and the disk space mapped by the root folder node before the modification is consistent with the disk space mapped by the preset folder node after the modification.

[0031] In one embodiment of the present application, modifying the root folder node to a preset folder node by modifying the mapping in step 120 includes step a: executing a move command with the object, the root folder node, and the preset folder node as input parameters of the move command to move the mapping of the object in the storage space from the root folder node to the preset folder node.

[0032] In this way, the object, the root folder node and the preset folder node are input as parameters through the move command. The move command will modify the corresponding mapping of the object in the file system from the root folder node to the preset folder node without changing the specific location of the object in the disk space, thereby avoiding disk I / O operations. Disk I / O operations are inefficient and take a long time. If an exception occurs during the disk I / O operation, it will directly affect the quality of the backup data. If the disk I / O operation is re-executed after the exception occurs, the execution time of the data backup is further extended. However, moving the disk space file in the disk by directly modifying the folder node through the move command will not cause the above problems because there is no need for disk I / O operations. The execution time is fast, and the disk space files in the disk will not be affected by the exception. It only needs to modify the node again, and the robustness is good.

[0033] Step 130: Format the disk space files corresponding to other nodes in the target disk except the preset folder node.

[0034] In one embodiment of the present application, step 130 includes step 131: executing the delete command using other nodes in the target disk except the preset folder node as input parameters of the delete command, so that the delete command searches for and deletes the disk space files mapped by other nodes. In this way, by directly executing the delete command using other nodes except the preset folder node as input parameters, the delete command can find the disk space files mapped by the nodes and delete the disk space files according to the nodes, thereby realizing the operation of restoring the factory settings, and there is no need to traverse the nodes one by one; for example, the nodes except the preset folder node in the root folder node can be directly read as parameters of the delete command to realize the deletion at one time.

[0035] In one embodiment of the present application, step 130 or step 131 includes step b: traversing the nodes in the target disk, and when traversing to the target node, determining whether the target node is a preset folder node, if so, continuing the traversal, otherwise, executing the delete command using the target node as an input parameter of the delete command. In this way, the preset folder node will not be used as an input parameter when executing the delete command, and the disk space file in the disk corresponding to the preset folder node will not be deleted, thereby retaining the objects in the preset folder node during the factory reset process, that is, protecting the whitelist during the factory reset process.

[0036] In one embodiment of the present application, step 130 includes step 132 .

[0037] Step 132: For each object, the preset folder node is modified to the root folder node corresponding to the object by modifying the mapping. In this way, after the factory reset operation is completed, the mapping of the folder node corresponding to the object is automatically restored, and the application can directly find the corresponding object through the original path, so that after the factory reset operation, the protected files are restored to their original state except for the formatted files.

[0038] In one embodiment of the present application, if step 111 is executed, step 132 includes step c1: for each object, obtaining the target root folder node associated with the object according to the corresponding relationship, and modifying the preset folder node to the root folder node by modifying the mapping.

[0039] In this way, the original root folder node mapping of the object is restored through the pre-saved correspondence between the object and the root folder node.

[0040] In one embodiment of the present application, if step 112 is executed, step 132 includes step c2: for each object, obtain the target root folder node corresponding to the preset folder node of the object, and modify the preset folder node to the target root folder node by modifying the mapping.

[0041] In this way, since a preset folder node is created on each child node of the root folder node in step 112, the path corresponding to the preset folder node includes the root folder node, and the information of the root folder node can be directly obtained. By modifying the mapping, the preset folder node is modified to the root folder node that the object originally corresponds to, so there is no need to perform an additional backup of the corresponding relationship between the root folder node and the object before performing the factory reset operation. In addition, there is no need to perform a search operation, and the path of the preset folder node is directly obtained, which automatically carries the information of the root folder node, further speeding up the efficiency of restoring the object to its original mapping position.

[0042] For example, the root folder nodes are data1 and data2, and preset folder nodes data1 / recovery and data2 / recovery are created in their child nodes respectively. If the root folder node previously mapped to the object is data1, its mapping is modified to data1 / recovery, which contains the information of data1. When restoring the original mapping of the object, the original root folder node information data1 can be obtained by directly reading the node currently mapped to the object, thereby realizing the recovery of the root node where the object is located without the need for a retrieval step or additional storage of the correspondence between the object and the root folder node.

[0043] In summary, the commonly understood file backup is to copy the data and paste it to other locations on the disk, so that the disk has two copies of the same data at different locations at the same time, which will take up extra disk space. The present invention utilizes the characteristics of separate management of storage devices and file systems in the system, and combines this characteristic with factory reset. For objects in the whitelist that need to be protected during factory reset, the mapping of the physically corresponding disk space files in the file system is changed, and the original root folder node is changed to a preset folder node. The disk space mapped by the root folder node before the modification is consistent with the disk space mapped by the preset folder node after the modification. Since no disk I / O operation is involved, the efficiency of retaining data during factory reset is extremely high; in the process of executing factory reset, the disk space files corresponding to other folder nodes except the preset folder node are deleted, thereby realizing the protection of objects in the whitelist. After completing the factory reset operation, the preset folder node mapped by the object is modified back to the original root folder node to restore the object status, so that the objects in the whitelist can maintain their original status after the factory reset operation. Since the recovery process does not involve disk I / O operations, the efficiency of recovery after the factory reset operation is guaranteed. At the same time, during the formatting process, the actual physical storage system corresponding to the whitelist remains unchanged. In this way, even if the system fails, it will not cause data loss on the disk, thus avoiding the problem of important data being easily lost due to system errors during the backup process.

[0044] Please refer to Figure 2 , the following specifically introduces the application embodiment of the present application. The present application can apply the above solution in an Android device, including steps 210 to 250.

[0045] Step 210, obtaining a white list, in which the directories and files that the customer needs to keep when restoring the factory settings are stored, is equivalent to the above steps 101, 102 and 110.

[0046] Step 220: Create a new recovery folder node under the data partition root folder node data, which is equivalent to the above step 112.

[0047] Currently, the application data of the Android system is stored in the data partition. Under the / data / data directory, each application will create a new directory with the application package name. The directory stores the cache and related data retained during the use of the application, etc.

[0048] Step 230, move the directories and files under the data partition in the whitelist to the recovery folder node through the mv command. The directory hierarchy remains unchanged during the move, and only the root folder node data of the object in the whitelist is modified to data / recovery. The mv command is a basic command in the Linux system. It is a tool for moving and renaming files or directories, allowing developers to flexibly manage files and directories in the file system; and because the mv command does not need to operate on specific files on the disk, the execution process is almost time-saving. Equivalent to the above step 120.

[0049] For example, if the directory level of the file mapping is data / music, directly modify the root folder node data to data / recovery. Then the directory level of the file mapping after modification is data / recovery / music. In this way, in the later recovery process, you only need to pay attention to the root folder node and the preset folder node, and there is no need to save the directory level. If the object in the whitelist is a directory, this method can also be used to change the mapping.

[0050] Step 240: All disk space files corresponding to nodes other than the recovery folder node in the data folder node are deleted by using the rm command (remove function); or all nodes can be traversed and compared, and nodes other than the recovery folder node are used as parameters of the delete command to delete the disk space files corresponding to the nodes. This is equivalent to the above step 130.

[0051] It can be seen that the underlying principle of Android's factory reset operation is to perform the formatting operation of the specified partition. If the partition application data needs to be retained, the entire partition cannot be formatted directly. It can be understood as an operation similar to the local partition formatting. The essence of the formatting operation is to delete the files on the disk partition, but it is not possible to selectively retain some files. Here, the program calls the Linux system's built-in deletion command rm command to delete the disk space files. The program can control which nodes' corresponding disk space files will not be deleted according to the whitelist, thereby achieving the purpose of retaining the required application data.

[0052] Step 250, modify the mapping in the recovery folder node to data, that is, the root folder node where the file was previously located, which is equivalent to the above step 132.

[0053] In summary, in the Linux system, storage devices and file systems are different concepts. The access unit provided by the disk storage device under / dev / is a block, and the data is a bunch of 0s and 1s, which is a computer-oriented unit. The user-oriented unit is a file, so the user needs to access the storage device with the concept of a file. After the system starts, the mount operation will be performed, which is to associate the specific files on the storage device with the corresponding file driver to form a mapping relationship. The Linux file system uses the inode node to identify each file or directory. Each inode has a unique number and related metadata information, including the file's permissions, owner, size, etc. The mv command only modifies the location information of the inode of a file or directory, and does not involve the copying of the file content, that is, it does not involve the I / O operation of the disk device, and the location of the data on the disk has not changed.

[0054] Moreover, the present invention has never formatted or deleted the files and directories in the whitelist at the root, so there is no possibility of data loss regardless of whether the system is abnormal or shut down. Specifically, when performing the factory reset operation, the first step of the program is to move the directories and files in the whitelist to the recovery folder node, and the second step is to perform the formatting and deletion operation of the local partition. The execution efficiency of the first step operation is very high, and it takes almost no time. When performing the first step operation, the abnormal shutdown of the system is only theoretically possible. Even if it is assumed that the operating system is shut down abnormally in the first step, that is, only part of the files and directories in the whitelist are transferred to the recovery folder, then all the data on the disk is still intact at this time, because the deletion operation has not started at this time, so after restarting, re-execute the factory reset operation to continue to transfer the remaining whitelist directories and files, and then execute the operation of deleting other directories of the partition. After deletion, the content in the recovery folder node is moved to the data folder node according to the original directory hierarchy, so that the application data can still be completely preserved. If the system shuts down abnormally during the second step of formatting a local partition, then because the application data to be retained has been moved in advance in the first step, you can continue to delete the remaining data in the partition after the system restarts. After deletion, move the content in the recovery folder node to the data folder node according to the original directory hierarchy, so that the application data is also retained. That is, it has great fault tolerance.

[0055] Please refer to Figure 3 , the present invention also provides a device 300 for restoring factory settings, including a reading module 301, a moving module 302 and a formatting module 303; The reading module is used to obtain the whitelist in the target disk and the root folder node corresponding to the object in the whitelist.

[0056] The moving module is used to modify the root folder node to the preset folder node by modifying the mapping. The disk space mapped by the root folder node before the modification is consistent with the disk space mapped by the preset folder node after the modification.

[0057] The formatting module is used to format the disk space files corresponding to other nodes in the target disk except the preset folder node.

[0058] In one embodiment of the present application, a recovery module 304 is further included, which is used to modify the preset folder node to the root folder node corresponding to the object by modifying the mapping for each object.

[0059] The beneficial effects of the device for restoring factory settings of the present invention are the same as those of the above method and will not be described in detail here.

[0060] Please refer to Figure 4 The present invention also provides an electronic device 400, including a memory 401 and a processor 402, and a computer program stored in the memory 401 and running on the processor 402. When the processor 402 executes the computer program, it implements the various steps in the method for restoring factory settings as described above.

[0061] The beneficial effects of the electronic device of the present invention are the same as those of the above method and will not be described in detail here.

[0062] The above are only embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent transformations made using the contents of the specification and drawings of the present invention, or directly or indirectly applied in related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A method for restoring factory settings, characterized in that: Applied to electronic equipment, the method comprises: When a factory reset request is received, a whitelist in the target disk and a root folder node corresponding to the object in the whitelist are obtained; The root folder node is modified into a preset folder node by modifying the mapping, and the disk space mapped by the root folder node before the modification is consistent with the disk space mapped by the preset folder node after the modification; Format the disk space files corresponding to other nodes in the target disk except the preset folder node.

2. The method for restoring factory settings according to claim 1, characterized in that: The step of formatting the disk space files corresponding to other nodes in the target disk except the preset folder node includes: For each of the objects, the preset folder node is modified to be the root folder node corresponding to the object by modifying the mapping.

3. The method for restoring factory settings according to claim 2, characterized in that: After obtaining the whitelist in the target disk and the root folder node corresponding to the object in the whitelist, and before modifying the root folder node to a preset folder node by modifying the mapping, the method includes: Creating a preset folder node on each child node of the root folder node; For each of the objects, modifying the preset folder node to a root folder node corresponding to the object by modifying the mapping includes: For each of the objects, a target root folder node corresponding to the preset folder node of the object is obtained, and the preset folder node is modified to the target root folder node by modifying the mapping.

4. The method for restoring factory settings according to claim 2, characterized in that: The step of obtaining the whitelist in the target disk and the root folder node corresponding to the object in the whitelist comprises: Saving the corresponding relationship between the object and the root folder node in a preset folder node; For each of the objects, modifying the preset folder node to a root folder node corresponding to the object by modifying the mapping includes: For each of the objects, the target root folder node associated with the object is obtained according to the corresponding relationship, and the preset folder node is modified to the root folder node by modifying the mapping.

5. The method for restoring factory settings according to claim 1, characterized in that: The modifying of the root folder node to a preset folder node by modifying the mapping includes: The move command is executed by using the object, the root folder node and the preset folder node as input parameters of the move command to move the mapping of the object in the storage space from the root folder node to the preset folder node.

6. The method for restoring factory settings according to claim 1, characterized in that: The method of formatting the disk space files corresponding to other nodes in the target disk except the preset folder node includes: The other nodes in the target disk except the preset folder node are used as input parameters of the deletion command to execute the deletion command, so that the deletion command searches for the disk space files mapped by the other nodes and deletes them.

7. A method for restoring factory settings according to claim 1 or 6, characterized in that: The method of formatting the disk space files corresponding to other nodes in the target disk except the preset folder node includes: Traverse the nodes in the target disk, and when traversing to the target node, determine whether the target node is the preset folder node, if so, continue traversing, otherwise, use the target node as an input parameter of the delete command to execute the delete command.

8. The method for restoring factory settings according to claim 1, characterized in that: The step of obtaining the whitelist in the target disk includes: receiving configuration information, wherein the configuration information includes a data directory node or a file; A white list is formed according to the data directory or file, and the white list is saved in the target disk.

9. A device for restoring factory settings, characterized in that: Including reading module, moving module and formatting module; The reading module is used to obtain the whitelist in the target disk and the root folder node corresponding to the object in the whitelist; The moving module is used to modify the root folder node to a preset folder node by modifying the mapping, and the disk space mapped by the root folder node before the modification is consistent with the disk space mapped by the preset folder node after the modification; The formatting module is used to format disk space files corresponding to other nodes in the target disk except the preset folder node.

10. An electronic device, characterized in that: The invention comprises a memory, a processor and a computer program stored in the memory and running on the processor, wherein the processor implements each step of a method for restoring factory settings as described in any one of claims 1 to 7 when executing the computer program.