Backup method of system configuration setting file
By using three-partition flash memory in the substrate management controller and repairing and overwriting when it cannot be mounted, the problem of system configuration setting files is damaged during the backup process, data integrity and consistency are achieved, and the need to increase hardware capacity is avoided.
Patent Information
- Application Number
- CN202311204965.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-18
- Publication Date
- 2025-03-18
AI Technical Summary
In the prior art, when the backup system is configured and set, frequent backup write operations can easily lead to simultaneously damage to the flash memory partition, and the method of using dual image files requires increasing hardware capacity and increasing hardware cost.
By using three-partition flash memory in the substrate management controller, mount and copy data separately, ensure the integrity and consistency of the data between different partitions, and repair and overwrite when it cannot be mounted to avoid data corruption.
It effectively solves the problem of system configuration setting files being damaged during the backup process, reduces the chance of damage, and avoids the need to increase hardware capacity, achieving data integrity and consistency.
Smart Images

Figure CN119645740A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a file system management method, and more particularly to a system configuration file backup method. Background Art
[0002] At present, when the code base of the baseboard management controller (BMC) is initialized, a flash partition storing multiple system configuration files is mounted as Journaling Flash File System Version 2 (JFFS2). When the initialization phase is completed and the BMC is running, the BMC reads and writes the system configuration files as needed. When the BMC is writing, a power outage may occur, causing the system configuration files to be damaged, resulting in the next time the BMC is connected to the power supply for initialization, the flash partition cannot be mounted as JFFS2, that is, it cannot be started normally.
[0003] To solve the above situation, two solutions are currently used. One is to use two flash memory partitions to back up with rsync, and the other is to use a dual image file to overcome the problem.
[0004] Among them, the method of using two flash partitions to back up with rsync is to use a main flash partition and a backup flash partition, each main flash partition and a backup flash partition. When the BMC cannot normally mount the system configuration setting file of the main flash partition during the initialization stage, the backup flash partition can be mounted and the operating system can be run. When the system configuration setting file of the main flash partition changes, the BMC will copy the main flash partition and overwrite it to the backup flash partition.
[0005] The method of using dual image files is to store two image files in one flash memory, or to store two image files in two flash memories respectively. When the BMC cannot be initialized normally, the other image file is directly used for initialization.
[0006] However, the method of backing up two flash memory partitions with rsync has a high probability of damaging the flash memory partitions at the same time due to frequent backup writing, and the method of using dual image files requires replacing a larger capacity flash memory or installing additional flash memory, resulting in an increase in hardware cost. Summary of the invention
[0007] Therefore, an object of the present invention is to provide a method for backing up a system configuration file to solve the problem of system configuration file damage.
[0008] Therefore, the present invention is executed by a baseboard management controller of a computer device, the baseboard management controller is electrically connected to a flash memory, the flash memory includes a first flash memory partition storing a plurality of first system configuration settings files, a second flash memory partition storing a plurality of second system configuration settings files, and a third flash memory partition storing a plurality of third system configuration settings files, the flash memory stores an operating system, and the method includes a step (A), a step (B), a step (C), a step (D), a step (E), a step (F), a step (G), a step (H), and a step (J). In the step (A), the baseboard management controller mounts the first flash memory partition and determines whether the first flash memory partition is mounted successfully. In the step (B), when it is determined that the first flash memory partition is mounted successfully, the baseboard management controller mounts the second flash memory partition and determines whether the second flash memory partition is mounted successfully. In the step (C), when it is determined that both the first flash memory partition and the second flash memory partition are mounted successfully, the baseboard management controller mounts the third flash memory partition and determines whether the third flash memory partition is mounted successfully. In the step (D), when it is determined that the first flash partition, the second flash partition, and the third flash partition are all mounted successfully, the baseboard management controller copies and overwrites the first flash partition to the third flash partition, and runs the operating system. In the step (E), when it is determined that the first flash partition and the second flash partition are all mounted successfully, and the third flash partition is not mounted successfully, the baseboard management controller repairs the third flash partition, copies and overwrites the first flash partition to the third flash partition, and runs the operating system. In the step (F), when it is determined that the first flash partition is not mounted successfully, the baseboard management controller mounts the second flash partition and determines whether the second flash partition is mounted successfully. In the step (G), when it is determined that the first flash partition and the second flash partition are not mounted successfully, the baseboard management controller repairs the first flash partition and the second flash partition. In the step (H), after repairing the first flash partition and the second flash partition, the baseboard management controller mounts the third flash partition and determines whether the third flash partition is mounted successfully. In the step (I), when it is determined that the first flash partition and the second flash partition are both unsuccessful to mount, and the third flash partition is mounted successfully, the baseboard management controller copies and overwrites the third flash partition to the first flash partition and the second flash partition, and runs the operating system. In the step (J), when running the operating system, the third flash partition is not read or written.
[0009] Particularly, in step (J), when the operating system is running, when the first system configuration files of the first flash partition are changed, the first flash partition is copied and overwritten to the second flash partition.
[0010] In particular, the following steps are also included after step (H): (K) when it is determined that the first flash partition, the second flash partition, and the third flash partition are all mounted unsuccessfully, repairing the third flash partition and initializing after restarting.
[0011] In particular, the following steps are also included after step (B): (L) when it is determined that the first flash partition is mounted successfully and the second flash partition is mounted unsuccessfully, the second flash partition is repaired, and the first flash partition is copied and overwritten to the second flash partition, and the operating system is run.
[0012] In particular, the following steps are also included after step (B): (M) when it is determined that the first flash partition is mounted unsuccessfully and the second flash partition is mounted successfully, the first flash partition is repaired, and the second flash partition is copied and overwritten to the first flash partition, and the operating system is run.
[0013] In particular, in step (C), the first flash partition is also copied and overwritten to the second flash partition.
[0014] In particular, in step (E), the third flash partition is erased and formatted to repair the third flash partition, and in step (G), the first flash partition and the second flash partition are erased and formatted to repair the first flash partition and the second flash partition.
[0015] Compared with the prior art, the system configuration profile backup method of the present invention, when it is determined that the first flash memory partition, the second flash memory partition, and the third flash memory partition are all mounted successfully, the baseboard management controller copies the first flash memory partition and overwrites it to the third flash memory partition to ensure that the data stored in the third flash memory partition is complete and undamaged, and the third flash memory partition is not read and written when the baseboard management controller runs the operating system to greatly reduce the probability of damage, and when it is determined that the first flash memory partition and the second flash memory partition are all mounted unsuccessfully, the baseboard management controller copies the third flash memory partition and overwrites it to the first flash memory partition and the second flash memory partition to solve the problem of simultaneous damage of the first flash memory partition and the second flash memory partition, and no additional hardware is required. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Other features and effects of the present invention will be clearly presented in the embodiments with reference to the accompanying drawings, in which: Figure 1 is a block diagram illustrating a computer device for implementing the system configuration file backup method of the present invention; and Figure 2 is a flow chart illustrating an embodiment of a method for backing up a system configuration file of the present invention. DETAILED DESCRIPTION
[0017] Before the present invention is described in detail, it should be noted that similar elements are denoted by the same reference numerals in the following description.
[0018] See also Figure 1 , a computer device 1 for implementing the system configuration file backup method of the present invention is described, including a flash memory 11, and a baseboard management controller 12 electrically connected to the flash memory 11. The computer device 1 is, for example, a server or an embedded system, but is not limited thereto.
[0019] The flash memory 11 includes a first flash memory partition 111 storing a plurality of first system configuration files, a second flash memory partition 112 storing a plurality of second system configuration files, and a third flash memory partition 113 storing a plurality of third system configuration files. The flash memory 11 stores an operating system, such as Linux, but not limited thereto.
[0020] See also Figure 1 , 2 , an embodiment of the method for backing up the system configuration setting file of the present invention, the steps included in the embodiment will be described below.
[0021] In step 201 , the baseboard management controller 12 mounts the first flash memory partition 111 .
[0022] In step 202, the baseboard management controller 12 determines whether the first flash partition 111 is mounted successfully. When it is determined that the first flash partition 111 is mounted successfully, the process proceeds to step 203; and when it is determined that the first flash partition 111 is not mounted successfully, the process proceeds to step 213.
[0023] It is worth noting that in the present embodiment, the baseboard management controller 12 uses a cyclic redundancy check (CRC) technology to determine whether the flash memory partition is mounted successfully. The principle is that if the file system layer is not written completely and a CRC error occurs, the flash memory partition cannot be mounted. The CRC technology is not the focus of the present invention, so it will not be described in detail here.
[0024] In step 203 , the baseboard management controller 12 mounts the second flash memory partition 112 .
[0025] In step 204, the baseboard management controller 12 determines whether the second flash partition 112 is mounted successfully. When it is determined that the second flash partition 112 is not mounted successfully, the process proceeds to step 205; and when it is determined that the second flash partition 112 is mounted successfully, the process proceeds to step 207.
[0026] In step 205 , the baseboard management controller 12 repairs the second flash memory partition 112 .
[0027] It should be noted that, in this embodiment, the baseboard management controller 12 repairs the flash memory partition by erasing and formatting the flash memory partition, but the present invention is not limited thereto.
[0028] In step 206 , the baseboard management controller 12 copies the first flash partition 111 and overwrites the first flash partition 112 .
[0029] In step 207 , the baseboard management controller 12 copies the first flash partition 111 and overwrites the first flash partition 112 .
[0030] In step 208 , the baseboard management controller 12 mounts the third flash memory partition 113 .
[0031] In step 209, the baseboard management controller 12 determines whether the third flash partition 113 is mounted successfully. When it is determined that the third flash partition 113 is not mounted successfully, the process proceeds to step 210; and when it is determined that the third flash partition 113 is mounted successfully, the process proceeds to step 212.
[0032] In step 210 , the baseboard management controller 12 repairs the third flash memory partition 113 .
[0033] In step 211 , the baseboard management controller 12 copies the first flash partition 111 and overwrites the first flash partition 113 .
[0034] In step 212 , the baseboard management controller 12 copies the first flash partition 111 and overwrites the first flash partition 113 .
[0035] It should be noted that in this embodiment, the baseboard management controller 12 will copy and overwrite the first flash partition 111 to the third flash partition 113 only after determining that the first flash partition 111 and the second flash partition 112 are mounted successfully to ensure that there is no problem with the first system configuration files. If the first flash partition 111 is mounted successfully, but the second flash partition 112 is not mounted successfully, it means that a read / write error occurs when backing up the first flash partition 111 and the second flash partition 112. Even if the first flash partition 111 is mounted successfully, the first system configuration files stored therein may have partially experienced errors and are on the verge of being unable to be mounted.
[0036] In step 213 , the baseboard management controller 12 mounts the second flash memory partition 112 .
[0037] In step 214, the baseboard management controller 12 determines whether the second flash partition 112 is mounted successfully. When it is determined that the second flash partition 112 is mounted successfully, the process proceeds to step 215; and when it is determined that the third flash partition 113 is not mounted successfully, the process proceeds to step 217.
[0038] In step 215 , the baseboard management controller 12 repairs the first flash memory partition 111 .
[0039] In step 216 , the baseboard management controller 12 copies the second flash partition 112 to overwrite the first flash partition 111 .
[0040] In step 217 , the baseboard management controller 12 repairs the first flash partition 111 and the second flash partition 112 .
[0041] In step 218 , the baseboard management controller 12 mounts the third flash memory partition 113 .
[0042] In step 219, the baseboard management controller 12 determines whether the third flash partition 113 is mounted successfully. When it is determined that the second flash partition 112 is not mounted successfully, the process proceeds to step 220; and when it is determined that the third flash partition 113 is mounted successfully, the process proceeds to step 221.
[0043] In step 220 , the baseboard management controller 12 repairs the third flash memory partition 113 and performs initialization after restarting.
[0044] It should be noted that in this embodiment, initialization is performed to restore the factory defaults, but the present invention is not limited thereto.
[0045] In step 221 , the baseboard management controller 12 copies the third flash partition 113 and overwrites the first flash partition 111 and the second flash partition 112 .
[0046] It should be noted that steps 201 - 221 are performed during the initialization phase of the baseboard management controller 12 .
[0047] In steps 206 , 211 , 212 , 216 , and step 222 after 221 , the baseboard management controller 12 runs the operating system.
[0048] In step 223 , when the operating system is running, the third flash partition 113 is not read or written, and when the first system configuration files of the first flash partition 111 are changed, the baseboard management controller 12 copies the first flash partition 111 and overwrites it to the second flash partition 112 .
[0049] In summary, the method for backing up the system configuration file of the present invention is that, at startup, when it is determined that the first flash partition 111, the second flash partition 112, and the third flash partition 113 are all mounted successfully, the baseboard management controller 12 copies the first flash partition 111 and overwrites it to the third flash partition 113 to ensure that the system configuration file stored in the third flash partition 113 is complete and intact, and when it is determined that the first flash partition 111 and the second flash partition 112 are all mounted unsuccessfully, the baseboard management controller 12 copies the third flash partition 113 and overwrites it to the first flash partition 111. 11 and the second flash partition 112, solve the problem of the first flash partition 111 and the second flash partition 112 being damaged at the same time, and no additional hardware is needed; when the baseboard management controller 12 runs the operating system, the third flash partition 113 is not read and written to greatly reduce the probability of damage, and when the first system configuration settings of the first flash partition 111 are changed, the baseboard management controller 12 copies the first flash partition 111 and overwrites it to the second flash partition 112 to ensure that the second flash partition 112 stores the latest system configuration settings at any time, so the purpose of the present invention can be achieved.
[0050] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A method for backing up a system configuration file, executed by a baseboard management controller of a computer device, the baseboard management controller being electrically connected to a flash memory, the flash memory comprising a first flash memory partition storing a plurality of first system configuration files, a second flash memory partition storing a plurality of second system configuration files, and a third flash memory partition storing a plurality of third system configuration files, the flash memory storing an operating system, characterized in that: The method comprises the following steps: (A) mounting the first flash memory partition, and determining whether the first flash memory partition is mounted successfully; (B) when it is determined that the first flash memory partition is mounted successfully, mounting the second flash memory partition, and determining whether the second flash memory partition is mounted successfully; (C) when it is determined that both the first flash memory partition and the second flash memory partition are mounted successfully, mounting the third flash memory partition, and determining whether the third flash memory partition is mounted successfully; (D) when it is determined that the first flash memory partition, the second flash memory partition, and the third flash memory partition are all mounted successfully, copying the first flash memory partition and overwriting it to the third flash memory partition, and running the operating system; (E) when it is determined that the first flash partition and the second flash partition are both mounted successfully, and the third flash partition is not mounted successfully, repairing the third flash partition, copying and overwriting the first flash partition to the third flash partition, and running the operating system; (F) when it is determined that the mounting of the first flash memory partition is unsuccessful, mounting the second flash memory partition, and determining whether the mounting of the second flash memory partition is successful; (G) when it is determined that both the first flash partition and the second flash partition are not mounted successfully, repairing the first flash partition and the second flash partition; (H) after repairing the first flash memory partition and the second flash memory partition, mounting the third flash memory partition, and determining whether the third flash memory partition is mounted successfully; (I) when it is determined that both the first flash partition and the second flash partition are mounted unsuccessfully, and the third flash partition is mounted successfully, copying the third flash partition and overwriting it to the first flash partition and the second flash partition, and running the operating system; and (J) When the operating system is running, the third flash memory partition is not read or written.
2. The method for backing up a system configuration file according to claim 1, characterized in that: In step (J), when the operating system is running, when the first system configuration files of the first flash partition are changed, the first flash partition is copied and overwritten to the second flash partition.
3. The method for backing up a system configuration file according to claim 1, wherein: After step (H), the method further comprises the following steps: (K) When it is determined that the first flash partition, the second flash partition, and the third flash partition are all mounted unsuccessfully, the third flash partition is repaired and initialized after restarting.
4. The method for backing up a system configuration file according to claim 1, wherein: After step (B), the method further comprises the following steps: (L) When it is determined that the first flash partition is mounted successfully and the second flash partition is mounted unsuccessfully, the second flash partition is repaired, the first flash partition is copied and overwritten to the second flash partition, and the operating system is run.
5. The method for backing up a system configuration file according to claim 1, wherein: After step (B), the method further comprises the following steps: (M) When it is determined that the first flash partition is not mounted successfully and the second flash partition is mounted successfully, the first flash partition is repaired, the second flash partition is copied and overwritten to the first flash partition, and the operating system is run.
6. The method for backing up a system configuration file according to claim 1, characterized in that: In step (C), the first flash memory partition is also copied and overwritten to the second flash memory partition.
7. The method for backing up a system configuration file according to claim 1, wherein: In step (E), the third flash partition is erased and formatted to repair the third flash partition, and in step (G), the first flash partition and the second flash partition are erased and formatted to repair the first flash partition and the second flash partition.