Image processing method, computer program product, device and storage medium
By dividing system partitions and using different file systems, lightweight and fast firmware upgrades are achieved, solving the problems of time-consuming and wasteful partitions in the existing technology, and improving the system upgrade efficiency.
Patent Information
- Application Number
- CN202411918976.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-03-11
- Estimated Expiration
- 2044-12-25
AI Technical Summary
The firmware upgrade process in the server product takes a long time, and Flash content needs to be refreshed in full and BMC is restarted to make the new firmware take effect, resulting in the problem of wasted partitions and long upgrade time.
By dividing the system partitions, the corresponding partitions of the original file system, differential file system and common system are obtained, the target parameters are obtained and the corresponding file system partitions are run, and the partition overlay is overwritten based on the original and differential file systems is generated to generate the target image file to achieve lightweight and fast firmware upgrades.
It effectively reduces the firmware size and upgrade time, improves system upgrade and maintenance efficiency, and avoids partition waste and long-term upgrade processes.
Smart Images

Figure CN119356621B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to an image processing method, a computer program product, a device and a storage medium. Background Art
[0002] In embedded Linux systems, system firmware is usually stored in SPI flash (non-volatile storage media using SPI communication). When building the firmware, the partitions are already fixed. When burning the chip or updating the firmware, the entire image needs to be burned, which causes a long firmware upgrade time. At the same time, in scenarios with high reliability requirements, dual-image backup is required. At this time, the backup partition needs to be completely copied to another location in the Flash to achieve partition switching when any partition cannot be started to achieve the purpose of partition backup.
[0003] Current server products all use BMC firmware upgrades to fix problems and upgrade functions. However, the traditional firmware upgrade process is relatively time-consuming. All firmware content in the flash must be refreshed, and the BMC must be restarted for the new firmware version to take effect. It is not lightweight and fast enough, and there are serious problems of partition waste and long upgrade time. Summary of the invention
[0004] Based on this, it is necessary to provide an image processing method, computer program product, device and storage medium that can improve the efficiency of system update and maintenance in order to solve the above technical problems.
[0005] In order to solve the above technical problems, in a first aspect, a mirror processing method is provided, the method comprising:
[0006] Divide the system partition to obtain partitions corresponding to the original file system, the differential file system and the shared system;
[0007] Obtain target input parameters, and run the original file system in the original file system partition and the target difference file system in the difference file system partition according to the target input parameters, wherein the original file system stores the original image file, and the target difference file system stores the target difference image file;
[0008] Based on the original file system and the target differential file system, partitions are overlaid and superimposed to obtain the target root file system. The target root file system stores the target image file formed based on the original image file and the target differential image file. The target image file is obtained from the target root file system and processed.
[0009] In one embodiment, dividing the system partition to obtain the original file system, the differential file system, and the shared system corresponding partition includes:
[0010] Get the root file system partition and non-root file system partition in the system partition;
[0011] Dividing the root file system partition into an original file system partition and a differential file system partition, wherein the differential file system partition includes a first differential file system partition and a second differential file system partition;
[0012] Use the non-root file system partition as the shared system partition. The shared system partition includes the boot partition, kernel partition, shared partition, and log partition.
[0013] In one embodiment, the method further comprises:
[0014] Generate a first mirror partition based on the original file system partition, the first differential file system partition, and the common system partition;
[0015] A second mirror partition is generated based on the original file system partition, the second differential file system partition, and the common system partition.
[0016] In one embodiment, the method further comprises:
[0017] Determine whether the target difference file system partition of the target difference file system corresponding to the target input parameter is marked as damaged;
[0018] If the target difference file system partition of the target difference file system corresponding to the target input parameter is marked as damaged, the target difference file system switching operation is performed;
[0019] If the target difference file system partition of the target difference file system corresponding to the target input parameter is not marked as damaged, a target parameter is generated according to the target difference file system, and the target parameter is passed to the system kernel, and the system kernel performs the partition overlay operation according to the target parameter.
[0020] In one embodiment, performing partition overlay based on the original file system and the target differential file system to obtain the target root file system includes:
[0021] Obtain the file system directory corresponding to the original file system and the file system directory corresponding to the target difference file system;
[0022] The file system directory corresponding to the original file system and the file system directory corresponding to the target differential file system are jointly mounted to the mount directory of the target root file system to obtain the target root file system.
[0023] In one embodiment, the file system directory corresponding to the original file system and the file system directory corresponding to the target differential file system are jointly mounted to the mount directory of the target root file system to obtain the target root file system, including:
[0024] Obtain the original image file and place the original image file in the first file directory;
[0025] Obtain a target difference image file, and place the target difference image file in a second file directory;
[0026] By executing the mount command in the mount directory, the second file directory is used as the upper file directory, and the first file directory is used as the lower file directory and stacked in the mount directory, a target root file system is obtained.
[0027] In one embodiment, partition overlay is performed based on the original file system partition and the target differential file system partition, and before obtaining the target root file system, the following step is further included:
[0028] Verify the original image file and the target difference image file according to a preset verification method to obtain a verification result;
[0029] If the verification result is successful, partition overlay is performed based on the original file system and the target differential file system to obtain the target root file system;
[0030] If the verification result is a verification failure, the read start offset, data segment size and data value corresponding to the original image file and the target difference image file are obtained, and the data value of the data segment size is written to the start offset position in the bottom memory of the baseboard management controller;
[0031] The baseboard management controller parses the original image file and the target difference image file according to the data value of the data segment size, and refreshes the original image file and the target difference image file according to the parsed image file.
[0032] In one embodiment, the target difference file system is a first difference file system, and if a target difference file system partition of the target difference file system corresponding to the target input parameter is marked as damaged, performing the target difference file system switching operation includes:
[0033] If the first differential file system partition is marked as damaged, determining whether the second differential file system partition is marked as damaged;
[0034] If the second differential file system partition is not marked as damaged, switching the second differential file system in the second differential file system partition to the target differential file system, obtaining the differential image file in the second differential file system as the target differential image file, forming a new target image file based on the target differential image file and the original image file, and processing the new target image file;
[0035] If the second differential file system partition is marked as damaged, a recovery image file is obtained from the recovery file system, and a firmware recovery operation of the baseboard management controller is performed using the recovery image file.
[0036] In one embodiment, performing a firmware recovery operation of a baseboard management controller using a recovery image file includes:
[0037] Get the target configuration file and determine whether the target configuration file is normal;
[0038] If the target configuration file is normal, obtain the network status. If the network status is connected, start the firmware download process, verify the downloaded firmware, and obtain the verification result.
[0039] When the verification result is successful, a firmware recovery operation of the baseboard management controller is performed.
[0040] In one embodiment, obtaining the target configuration file includes:
[0041] Get the configuration file from the shared partition and check whether the configuration file in the shared partition is normal;
[0042] If the configuration file in the shared partition is normal, the configuration file in the shared partition is used as the target configuration file;
[0043] If the configuration file in the shared partition is abnormal, the target configuration file is obtained from the default file in the original file system partition.
[0044] In one embodiment, the method further comprises:
[0045] The boot program started by the baseboard management controller calls the target image file of the first image partition to start the baseboard management controller;
[0046] The number of times the boot program calls the target image file of the first image partition is obtained, and when the number of times the boot program calls the target image file of the first image partition is greater than a preset number of calls, the boot program is guided to call the target image file of the second image partition.
[0047] In one embodiment, the method further comprises:
[0048] When the baseboard management controller is started by using the target image file of the first image partition for a period exceeding a first period without starting the baseboard management controller, the baseboard management controller is started by using the target image file of the second image partition;
[0049] After the target image file of the second image partition is used to start the baseboard management controller, it is checked whether the target image file of the first image partition is abnormal. If the target image file of the first image partition is abnormal, the target image file of the second image partition is used to start the baseboard management controller. If the baseboard management controller is not started after the time length for starting the baseboard management controller exceeds the second time length, the target image file of the second image partition is used to start the baseboard management controller, wherein the second time length is less than the first time length.
[0050] In order to solve the above technical problem, in a second aspect, a computer program product is provided, including a computer program, characterized in that when the computer program is executed by a processor, the steps of the method in the above first aspect are implemented.
[0051] In order to solve the above technical problem, a third aspect provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program: the processor implements the steps of the above first aspect method when executing the computer program.
[0052] In order to solve the above technical problems, in a fourth aspect, the present application provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of the method of the above first aspect are implemented.
[0053] Different from the prior art, the present application divides the system partition to obtain the original file system, the target difference file system and the partition corresponding to the shared system; obtains the target input parameter, runs the original file system in the original file system partition and the target difference file system in the target difference file system partition according to the target input parameter, the original file system stores the original image file, and the target difference file system stores the target difference image file; performs partition overlay and superposition based on the original file system and the target difference file system, obtains the target root file system, stores the target image file formed based on the original image file and the target difference image file in the target root file system, obtains the target image file from the target root file system, and processes the target image file. In this way, it is designed that the system partition can be split to obtain partitions corresponding to multiple file systems, provide the operating environment of multiple file systems, obtain multiple file systems by refining the file system, and then perform partition overlay and superposition of multiple file systems on this basis, which can effectively reduce the volume of firmware and the duration of subsequent firmware upgrades, and greatly improve the efficiency of system upgrades and maintenance. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] Figure 1 A schematic diagram of a process flow of a mirror processing method in one embodiment;
[0055] Figure 2A schematic diagram of the structure of system partitions in one embodiment;
[0056] Figure 3 is a flowchart of a mirror processing method in another embodiment;
[0057] Figure 4 A schematic diagram of a stacked file system in one embodiment;
[0058] Figure 5 A schematic diagram of a flow chart of a mirror processing method in another embodiment;
[0059] Figure 6 is a structural block diagram of an image processing device in an embodiment;
[0060] Figure 7 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0061] In order to make the purpose, technical solution and advantages of 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.
[0062] In one embodiment, Figure 1 As shown, the present application provides a mirror processing method, which specifically includes the following steps:
[0063] Step 101, divide the system partition to obtain partitions corresponding to the original file system, the differential file system and the shared system.
[0064] System partition refers to Linux file system partition. Linux file system partition can divide the hard drive into multiple logical parts. Each partition can be formatted with a different file system and can be mounted and used independently.
[0065] The Linux file system partition stores the Linux image file, which is usually an ISO file that contains all the necessary files for booting the Linux system. This image file contains the following parts: Boot Partition: Usually part of the file system, it contains the necessary boot loader (such as GRUB) for booting the Linux system. Kernel: Located in the image file, it is the core component of Linux startup and is responsible for starting the system. Initialized memory disk (initrd / initramfs): It is a temporary root file system used to provide some necessary drivers and tools before the actual root file system is mounted. The final root file system contains the files necessary for the system to boot and use other systems to mount, including the directories and key files required for the Linux system to start.
[0066] See also Figure 2 In this application, the system partition is first divided into a root file system partition and a non-root file system partition; the root file system partition here includes a temporary root file system in an existing Linux image file and a final root file system. In this application, the root file system partition is divided into an original file system partition, a first differential file system partition, and a second differential file system partition.
[0067] The non-root file system partition is used as the common system partition, and functional partitions such as boot partition, kernel partition, shared partition, log partition, etc. are set up in the common system partition.
[0068] Among them, the boot partition (Bootloader) can determine the system that needs to be started based on the system startup status, its own environment variables and other conditions. After updating the startup parameters, it guides the kernel to start and passes the startup parameters to the kernel.
[0069] The kernel partition (also known as the Linux kernel) is located in the image file and is the core component of Linux startup. It is responsible for starting the system by overlaying the boot partition. The boot partition here refers to the partition that is started from the original file system partition, the first differential file system partition, and the second differential file system partition.
[0070] Shared partition (Conf / bkconf), which retains BMC configuration and is used for dual-image sharing and recovery partition sharing configuration. BMC configuration can include BMC IP configuration information, network configuration information, etc.
[0071] The original file system partition (Initfs) is used to store the original file system. The original file system implements basic network management, firmware download, and firmware upgrade functions, and also saves the shared software and dependent libraries that the system depends on. The original file system is a temporary file system that contains the necessary drivers and tools to help the kernel load the real root file system. This application is set in the original file system partition to integrate complete firmware upgrade, download, and repair functions, that is, to integrate firmware upgrade, download, and repair solutions. When it is determined that the firmware is abnormal and cannot be started, the original file system can be started to complete the firmware recovery operation and restore management capabilities in time.
[0072] The differential file system partition may include a first differential file system partition (the partition where the partition 1 file system is located in the figure) and a second differential file system partition (the partition where the partition 2 file system is located in the figure). The first differential file system partition stores the first differential file system, and the second differential file system partition stores the second differential file system.
[0073] The target difference file system partition is the second difference file system partition or the second difference file system partition. That is, the target difference file system partition in the present application is determined from the first difference file system partition or the second difference file system partition, and the target difference system file is the target difference image file stored in the target difference file system partition (the difference image file stored in the first difference file system or the difference image file stored in the second difference file system).
[0074] The first difference file system and the second difference file system are used to store difference image files that are mirror images of each other. The difference image file here can be a file generated by the content of information with differences compared with the original image file in the original file system. The file generated by the content of information with differences here can be presented in the following situations: for example, the difference image file includes relevant content of a certain type of information that is not included in the original image file, or different content of a certain type of information contained in the original image file and the difference image file, and the difference image file is generated according to the above difference content.
[0075] The difference image file in the first difference file system and the difference image file in the second difference file system correspond to difference image files of different versions. This is because in actual applications, when a customer performs a firmware upgrade, the firmware upgrade can be performed based only on the difference image file in the first difference file system, or based only on the difference image file in the second difference file system. At this time, there is a version difference between the difference image file in the first difference file system and the difference image file in the second difference file system. It can be understood that the contents of the image files corresponding to the difference image files with inconsistent versions may be consistent or inconsistent.
[0076] In the present application, by setting the original file system to retain the unchanged content and basic functional components in the image file, a first difference file system and a second difference file system are set to store difference image files that are different from the original image files. The content of the difference information corresponding to the difference image file can be retained in the business image partition for subsequent image update operations, which can effectively reduce the size of the firmware and the upgrade time.
[0077] Log partition: The log partition is used to keep the operation log of the dual-partition baseboard management controller firmware. The file systems corresponding to the boot partition, kernel partition, and shared partition in this application all need to be mounted on the log partition to ensure normal configuration and log.
[0078] Recovery partition, recovery partition includes recovery file system, and the recovery file system includes recovery image file. In this application, no separate location is set for the recovery partition. In this application, if the file system is damaged, only (original file system) Initfs can be started. Initfs is essentially a recovery partition, because the original file system integrates complete firmware upgrade, download, and repair functions. When the system firmware cannot be started due to abnormality, the original file system can be started to complete the firmware recovery action, so that management capabilities can be restored in time.
[0079] A first mirror partition is generated based on the original file system partition, the first differential file system partition, and the common system partition; and a second mirror partition is generated based on the original file system partition, the second differential file system partition, and the common system partition.
[0080] The original file system partition, the first difference file system partition and the common system partition can be used to generate a first mirror partition, which is equivalent to the storage area corresponding to the main image file. The original file system partition, the second difference file system partition and the common system partition can be used to generate a second mirror partition, which is equivalent to the storage area corresponding to the backup image file. In this way, when the firmware is subsequently upgraded, it can be determined to which file system partition the part that needs to be upgraded belongs. For example, if it is determined that the part that needs to be upgraded belongs to the first difference file system partition, only the difference image file in the first difference file system partition can be upgraded to obtain the upgraded difference image file, and then the original system file partition and the common system partition are combined to complete the startup of the system and make the functions available. Compared with the method of upgrading the main image file or the backup image file as a whole in the prior art, the baseboard management controller can be upgraded lightly and quickly in the present application.
[0081] Step 102, obtain target input parameters, and run the original file system in the original file system partition and the target difference file system in the difference file system partition according to the target input parameters, the original file system stores the original image file, and the target difference file system stores the target difference image file.
[0082] In one embodiment, the target difference file system is a first difference file system. If the target difference file system partition corresponding to the target input parameter is marked as damaged, executing the target difference file system switching operation includes: if the first difference file system partition is marked as damaged, determining whether the second difference file system partition is marked as damaged; if the second difference file system partition is not marked as damaged, switching the second difference file system in the second difference file system partition to the target difference file system, obtaining a difference image file in the second difference file system as the target difference image file, forming a new target image file based on the target difference image file and the original image file, and processing the new target image file; if the second difference file system partition is marked as damaged, obtaining a recovery image file in the recovery file system, and using the recovery image file to perform a firmware recovery operation of the baseboard management controller.
[0083] Specifically, when the bootloader of the boot partition is started, the watchdog timing function will be turned on. The role of the watchdog is a time countdown counter. The target input parameter can be obtained through the watchdog. The boot program will detect its own environment variables and determine whether the boot partition corresponding to the target input parameter is marked as damaged. If it is not marked as damaged, the file system of the boot partition corresponding to the target input parameter will be run.
[0084] If the target difference file system partition corresponding to the target input parameter is marked as damaged, the target difference file system switching operation is performed; assuming that the current target difference file system partition is the partition for the first difference file system, and the new system partition of the first difference file is marked as damaged, then try to switch the second difference file system to the target difference file system.
[0085] At this time, it is necessary to determine whether the second differential file system is marked as damaged. If the second differential file system is not marked as damaged, the second differential file system is switched to the target differential file system, and the differential image file in the second differential file system is used as the target differential image file.
[0086] If the target difference file system partition corresponding to the target input parameter is not marked as damaged, the target parameter is generated according to the target difference file system, and the target parameter is passed to the system kernel, and the system kernel performs the partition overlay operation according to the target parameter.
[0087] If both the first difference file system and the second difference file system are marked as damaged, a recovery image file is obtained from the recovery file system of the recovery partition, and the firmware recovery operation of the baseboard management controller is performed using the recovery image file.
[0088] Among them, using the recovery image file to perform the firmware recovery operation of the baseboard management controller includes: obtaining the target configuration file and determining whether the target configuration file is normal; if the target configuration file is normal, obtaining the network status, and if the network status is connected, starting the firmware download process, verifying the downloaded firmware, and obtaining the verification result; when the verification result is successful, executing the firmware recovery operation of the baseboard management controller.
[0089] For details, please refer to Figure 3 , the original file system partition can also mount the user-configured partition. When the system is running normally, the user can configure the system recovery strategy, protection recovery method, and image acquisition method. The specific process is as follows:
[0090] Step 1: First, read the configuration file, load the network driver, current device model and other information, and prepare to obtain the corresponding recovery image.
[0091] Step 2: If the configuration file is normal and the network is connected, request the firmware from the server and download the firmware; if the configuration is abnormal, use the default configuration and proceed to step 4.
[0092] In this application, it is set to first obtain the configuration file from the shared partition. The configuration file here is the configuration file used to generate the image file. When the baseboard management controller generates the firmware, a part of the firmware configuration file will be synchronized to the shared partition and the default file in the original file system. First, determine whether the configuration file in the shared partition is normal; if the configuration file in the shared partition is normal, the configuration file in the shared partition is used as the target configuration file; if the configuration file in the shared partition is abnormal, obtain the target configuration file from the default file in the original file system partition. After obtaining the target configuration file, obtain the network status. When the network status is connected, it means that the environment for performing the recovery operation has been prepared. Request the firmware from the server and download the firmware, and verify the firmware. Optionally, use checksum, cyclic redundancy check, hash algorithm, etc. to verify the integrity of the firmware and obtain the verification result.
[0093] Step 3: After the firmware verification is normal, the system image is updated and restored directly. At the same time, the system log is recorded. If there is a remote log, the event is reported to the remote server. Then the bootloader parameters are updated, the abnormal startup partition mark is cleared, and the startup partition is updated again. Finally, the system is restarted to complete the startup of the new firmware.
[0094] When the firmware verification result is normal, the image update and recovery operation can be performed directly, and a log server can be opened remotely or a baseboard management controller can be set up to connect to the remote log server, and the programmed log can be connected to the remote server, and the recovery time can be reported to the remote server. After that, the target input parameter of the boot partition can be updated, and the damage mark on the damaged partition can be cleared. The boot partition can run the original file system and the target difference file system according to the updated target input parameter, that is, the boot partition this time is the original file system and the target difference file system. Generally, the restored target difference file system is the first difference file system.
[0095] Step 4: If the network is not accessible, start the broadcast mode to broadcast its own information to the server, notify the server to allocate IP, firmware path, etc. After the BMC configures its own IP, it will correspond to the firmware under the firmware path. Then execute step 3 to perform the firmware recovery operation.
[0096] Step 5: When the network fails to download the firmware, you can also manually upload the firmware in-band or out-of-band and manually perform the firmware recovery operation.
[0097] If the network status is disconnected, it means that the environment for performing the recovery operation is not ready, then the baseboard management controller's own information such as the server-assigned IP and firmware path will be broadcast to the server. After the baseboard management controller configures the baseboard management controller IP, it will download the firmware according to the firmware path and perform the firmware recovery operation in step 3.
[0098] When the network cannot download the firmware, you can first check whether the network status is connected. If the network is not connected, notify the operator to debug the network status to a connected state, or upload the firmware through in-band or out-of-band methods, and then perform the firmware recovery operation in step 3.
[0099] Step 103, partition overlay is performed based on the original file system and the target differential file system to obtain a target root file system, the target root file system stores a target image file formed based on the original image file and the target differential image file, the target image file is obtained from the target root file system, and the target image file is processed.
[0100] Specifically, obtain the file system directory corresponding to the original file system and the file system directory corresponding to the target difference file system; mount the file system directory corresponding to the original file system and the file system directory corresponding to the target difference file system to the mount directory of the target root file system to obtain the target root file system.
[0101] Overlay File System can overlay the contents of multiple directories onto another directory. Overlay File System does not directly involve the disk space structure, but simply merges files in multiple directories into the same directory according to rules. In this application, the file system directory corresponding to the original file system and the file system directory corresponding to the target difference file system can be jointly mounted to the mount directory of the target root file system through the overlay file system to form the target root file system. The overlay file system provides a read-only file system directory to ensure the security of system files.
[0102] Figure 4 A schematic diagram of a stacked file system provided in an embodiment of the present application. Figure 4 As shown in the figure, the stacked file system mainly includes three roles:
[0103] Lower Layer: This read-only layer usually contains the basic files of the system, such as an operating system image.
[0104] Upper Layer: This is a writable layer. The user's changes to the file system will be recorded in this layer, but it will only save the changed parts and will not copy the entire lower layer content.
[0105] Merged Layer: This is the final file system seen by the user, combining the upper and lower layers. The lower layer provides the basic files, and all write operations occur in the upper layer, but the user perceives it as a whole file system.
[0106] Among them, the original image file can be obtained and placed in the first file directory; the target difference image file is obtained and placed in the second file directory; by executing the mount command in the mount directory, the second file directory is used as the upper file directory, and the first file directory is used as the lower file directory and stacked in the mount directory to obtain the target root file system.
[0107] That is, in this application, the original image file in the original file system is placed in the lower layer, and the first difference file system partition or the second difference file system partition is placed in the writable layer (if the upper is started from the first difference file system partition, it is the first difference file system partition, if the upper is started from the second difference file system partition, it is the second difference file system partition). Finally, the file system is stacked to form a final file system presented to the user.
[0108] Figure 4Three situations of partition overlay are shown. In this application, when image files exist in both upper and lower, the image file in upper is used as the target image file corresponding to the target root file system. If an image file exists in one layer of upper or lower, the corresponding image file is directly used as the target image file corresponding to the target root file system. When performing a subsequent file deletion operation, if the image file exists only in upper, the image file in upper is deleted; if the image file exists only in lower, a shield is established in upper.
[0109] In a specific embodiment, see Figure 5 , the system startup process of this application specifically includes:
[0110] Step 20, after the system is powered on, the bootloader (boot partition boot program) starts; the bootloader checks its own environment variables to determine whether the current boot partition has been marked as damaged. If it is marked as damaged, it switches the partition. If both partitions are marked, it uses the recovery file system to start.
[0111] In the present application, after the system is powered on, the boot program of the boot partition is started, and by detecting its own environment variables, it is determined whether the boot partition corresponding to the target input parameter is marked as damaged. If it is marked as damaged, the boot partition switching operation is performed. If the boot partition to be switched is also marked as damaged, the recovery image file is obtained from the recovery image file of the recovery partition to perform the firmware recovery operation of the baseboard management controller. For details, see the description of step 102.
[0112] Step 21, the bootloader passes the startup plan after the above comprehensive judgment to the kernel through environment variables or parameter passing, starts the kernel and prepares to boot the file system.
[0113] Step 22: The kernel decides to use a specific partition overlay solution to load the file system based on the boot parameters, and starts the corresponding startup script to start the business process.
[0114] Step 23, when the process starts abnormally or runs abnormally, the daemon process updates the boot environment variables and restarts the system to start another partition or the recovery partition.
[0115] The bootloader of the boot partition will regenerate the boot plan. The boot mode here refers to whether to boot from the first image partition or the second image partition. According to the boot plan, environment variables and target input parameters are generated for the system kernel. The boot kernel will boot the file system in the boot plan according to the environment variables and target input parameters. When the file system runs abnormally, it will also point to the booted file system to switch or re-obtain the recovery image to perform the image recovery operation.
[0116] In one embodiment, partition overlay is performed based on the original file system partition and the target difference file system partition, and before obtaining the target root file system, the method also includes: verifying the original image file and the target difference image file according to a preset verification method to obtain a verification result; if the verification result is a verification success, partition overlay is performed based on the original file system and the target difference file system to obtain the target root file system; if the verification result is a verification failure, the read start offset, data segment size and data value corresponding to the original image file and the target difference image file are obtained, and the data value of the data segment size is written to the starting offset position in the underlying memory of the baseboard management controller; the baseboard management controller parses the original image file and the target difference image file according to the data value of the data segment size, and refreshes the original image file and the target difference image file according to the parsed image file.
[0117] Specifically, the preset verification method here can be to use the system's built-in tools to calculate the hash values of the original image file and the target difference image file. Specifically, you can enter the directory where the image file is located by entering the cmd command. Next, use the certutil command provided by the system to verify the hash value of the specified file. The obtained hash value is a unique string, which is used to verify the integrity of the file by comparing the hash values of the original image file and the target difference image file with the official standard hash value. When the hash value of the original image file is consistent with the standard hash value of the original image file and the hash value of the target difference image file is consistent with the standard hash value of the target difference file, it means that the image file has not been tampered with, otherwise the image file may be damaged or incomplete.
[0118] In addition, the detection of image files is not limited to hash value verification, but also includes checking the file format, size, and whether it contains viruses or malware. Ensuring the security and integrity of the file is a necessary step before using the image file, especially when performing critical operations such as system installation or data recovery.
[0119] After verifying the original image file and the target difference image file according to the preset method, the original image file system partition and the target difference image file system partition are verified. The verification here can be to determine whether the storage devices corresponding to the original image file system partition and the target difference image file system partition can operate normally, and whether the available storage space of the original image file system partition and the target difference image file system partition can accommodate the original image file and the target difference image file. When the verification result is that the image file has not been tampered with and the available storage space of the original image file system partition and the target difference image file partition can accommodate the original image file and the target difference image file, it is determined that the verification results of the original image file and the target difference image file are normal. In this way, the original image file and the target difference image file are verified multiple times, which is conducive to improving the reliability of the system.
[0120] The accuracy of system update and maintenance can be improved by first verifying the file contents of the original image file and the target difference image file by calculating hash values, and verifying the available storage space of the original image file system partition and the target difference image file system partition.
[0121] If the verification result of the original image file and / or the target difference image file is judged to be abnormal, the read starting offset, data segment size and data value corresponding to the original image file and the target difference image file are obtained, and the data value of the data segment size is written to the starting offset position in the underlying memory of the baseboard management controller. The baseboard manager parses the original image file and the target difference image file according to the data value of the data segment size, and refreshes the original image file and the target difference image file according to the parsed image files.
[0122] Among them, the underlying memory can be an EEPROM (electrically erasable programmable read-only memory), and a modification file of EEPROM data is provided. The baseboard management controller is directly allowed to modify the underlying memory. The version number can be added at the same time to facilitate the compatibility of the BMC (baseboard management controller) parsing software. When the verification results of the original image file and the target difference image file are abnormal, the read start offset, data segment size and data value corresponding to the original image file and the target difference image file can be written, and the data value of the data segment size can be written to the starting offset position in the underlying memory of the baseboard management controller. In this way, the image file parsing can be started based on the data value of the data segment size written to the starting offset position in the underlying memory, and the image file can be refreshed according to the parsing result.
[0123] The refresh mechanism is a key part of the BMC firmware update. Through the web interface, administrators can easily upload image files. After the upload is completed, the BMC will verify the signature of the uploaded image file to ensure its security and integrity. After the signature verification is passed, the BMC will unpack the image file and distribute it to two independent upgrade processes for image refresh operations. This dual-process design is designed to increase the upgrade speed and shorten the upgrade time, thereby ensuring the continuous and stable operation of the system.
[0124] In one embodiment, when the server is started, the boot program started by the baseboard management controller can call the target image file of the first image partition to realize the startup of the baseboard management controller; the number of times the boot program calls the target image file of the first image partition is obtained, and when the number of times the boot program calls the target image file of the first image partition is greater than the preset number of calls, the boot program is guided to call the target image file of the second image partition.
[0125] When the time length of using the target image file of the first image partition to start the baseboard management controller exceeds the first time length and the baseboard management controller is not started, the target image file of the second image partition is used to start the baseboard management controller. After the baseboard management controller is started by using the target image file of the second image partition, it is checked whether the target image file of the first image partition is abnormal. If the target image file of the first image partition is abnormal, it is set that when the time length of using the target image file of the first image partition to start the baseboard management controller exceeds the second time length and the baseboard management controller is not started, the target image file of the second image partition is used to start the baseboard management controller, wherein the second time length is less than the first time length.
[0126] The BMC image consists of three parts: the boot program, the kernel, and the file system. The boot program is an image boot program. When it starts to boot normally, the watchdog timing function will be turned on. The function of the watchdog is a time countdown counter. For example, if the watchdog timeout is 60 seconds, the boot program starts to boot the image program and starts timing. If the kernel information is not successfully booted within 60 seconds, the watchdog will not be closed and will time out. By setting the watchdog timeout action, the SPI interface can be switched to the target image file information of the second image partition, that is, continue to boot from the second image partition, thus realizing the dual image switching logic. In addition, if the boot program successfully boots the kernel information, the kernel startup program will re-update the watchdog timeout, that is, set the kernel startup process timeout to avoid kernel panic and other information during the kernel startup process, which causes the startup process to be stuck and the image cannot be switched. Through the timeout mechanism restrictions of the boot program and kernel processes, it is ensured that if any step in the image startup process is abnormal, the image switching mechanism can be triggered.
[0127] If the target image file information of the second image partition is received before the timing duration of the watchdog monitoring system meets the preset duration, it indicates that the BIOS (Basic Input Output System) is loaded normally and the CPU is started normally according to the current first image partition.
[0128] By setting the second time length to be shorter than the first time length, the present application can ensure that when the target image file of the first image partition is abnormal, the baseboard management controller can be started using the target image file of the second image partition to immediately recover, thereby avoiding the mirror switching mechanism being triggered again at the next startup, which would cause the startup time to be too long.
[0129] In this application, by splitting the file system partition according to the above scheme, and based on the function of the stacked file system, the system partition is mounted and replicated, which can effectively reduce the size of the firmware and the duration of subsequent firmware upgrades, greatly improving the efficiency of existing network upgrades and maintenance. At the same time, a partition recovery solution is introduced, which can integrate multiple firmware download methods such as automatic download, manual download, and in-band download, and supports automatic repair and manual firmware repair solutions to realize the firmware self-recovery function. The manual recovery method is used as a supplementary solution to achieve rapid recovery of network firmware.
[0130] By using the stacked file system function, multiple partitions are set as shared partitions. After startup, the required partitions are recombined to complete the system startup and functional availability, while effectively reducing the flash usage; the configuration partition and the log partition (log partition) are shared to ensure the configuration consistency of all startup images and the continuity of the log after system startup, which is convenient for subsequent problem location.
[0131] It can also effectively reduce the firmware upgrade time at the customer site, shorten the customer service window time, and improve maintenance efficiency.
[0132] It should be understood that although Figure 1 , Figure 3 , Figure 5 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1 , Figure 3 , Figure 5 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0133] In one embodiment, Figure 6 As shown, a mirror processing device is provided, comprising: a division module 30, an acquisition module 31 and a processing module 32, wherein:
[0134] A partitioning module 30 is used to partition the system partition to obtain partitions corresponding to the original file system, the differential file system and the shared system;
[0135] An acquisition module 31 is used to acquire a target input parameter, and to run an original file system in an original file system partition and a target difference file system in a difference file system partition according to the target input parameter, wherein the original file system stores an original image file, and the target difference file system stores a target difference image file;
[0136] The processing module 32 is used to perform partition overlay based on the original file system and the target difference file system to obtain the target root file system, the target root file system stores the target image file formed based on the original image file and the target difference image file, obtain the target image file from the target root file system, and process the target image file.
[0137] In one embodiment, the above device can implement another implementation of the mirror processing method, and the specific steps are as follows:
[0138] The system partition is divided into the original file system, the differential file system and the common system corresponding partitions including:
[0139] Get the root file system partition and non-root file system partition in the system partition;
[0140] Dividing the root file system partition into an original file system partition and a differential file system partition, wherein the differential file system partition includes a first differential file system partition and a second differential file system partition;
[0141] Use the non-root file system partition as the shared system partition. The shared system partition includes the boot partition, kernel partition, shared partition, and log partition.
[0142] In one embodiment, the above device can implement another implementation of the mirror processing method, and the specific steps are as follows:
[0143] The method also includes:
[0144] Generate a first mirror partition based on the original file system partition, the first differential file system partition, and the common system partition;
[0145] A second mirror partition is generated based on the original file system partition, the second differential file system partition, and the common system partition.
[0146] In one embodiment, the above device can implement another implementation of the mirror processing method, and the specific steps are as follows:
[0147] The method also includes:
[0148] Determine whether the target difference file system partition of the target difference file system corresponding to the target input parameter is marked as damaged;
[0149] If the target difference file system partition of the target difference file system corresponding to the target input parameter is marked as damaged, the target difference file system switching operation is performed;
[0150] If the target difference file system partition of the target difference file system corresponding to the target input parameter is not marked as damaged, a target parameter is generated according to the target difference file system, and the target parameter is passed to the system kernel, and the system kernel performs the partition overlay operation according to the target parameter.
[0151] In one embodiment, the above device can implement another implementation of the mirror processing method, and the specific steps are as follows:
[0152] Based on the original file system and the target differential file system, partition overlay is performed to obtain the target root file system, including:
[0153] Obtain the file system directory corresponding to the original file system and the file system directory corresponding to the target difference file system;
[0154] The file system directory corresponding to the original file system and the file system directory corresponding to the target differential file system are jointly mounted to the mount directory of the target root file system to obtain the target root file system.
[0155] In one embodiment, the above device can implement another implementation of the mirror processing method, and the specific steps are as follows:
[0156] The file system directory corresponding to the original file system and the file system directory corresponding to the target differential file system are mounted together to the mount directory of the target root file system. The target root file system includes:
[0157] Obtain the original image file and place the original image file in the first file directory;
[0158] Obtain a target difference image file, and place the target difference image file in a second file directory;
[0159] By executing the mount command in the mount directory, the second file directory is used as the upper file directory, and the first file directory is used as the lower file directory and stacked in the mount directory, a target root file system is obtained.
[0160] In one embodiment, the above device can implement another implementation of the mirror processing method, and the specific steps are as follows:
[0161] Based on the original file system partition and the target differential file system partition, partition overlay is performed. Before obtaining the target root file system, the following steps are also included:
[0162] Verify the original image file and the target difference image file according to a preset verification method to obtain a verification result;
[0163] If the verification result is successful, partition overlay is performed based on the original file system and the target differential file system to obtain the target root file system;
[0164] If the verification result is a verification failure, the read start offset, data segment size and data value corresponding to the original image file and the target difference image file are obtained, and the data value of the data segment size is written to the start offset position in the bottom memory of the baseboard management controller;
[0165] The baseboard management controller parses the original image file and the target difference image file according to the data value of the data segment size, and refreshes the original image file and the target difference image file according to the parsed image file.
[0166] In one embodiment, the above device can implement another implementation of the mirror processing method, and the specific steps are as follows:
[0167] The target difference file system is the first difference file system. If the target difference file system partition of the target difference file system corresponding to the target input parameter is marked as damaged, performing the target difference file system switching operation includes:
[0168] If the first differential file system partition is marked as damaged, determining whether the second differential file system partition is marked as damaged;
[0169] If the second differential file system partition is not marked as damaged, switching the second differential file system in the second differential file system partition to the target differential file system, obtaining the differential image file in the second differential file system as the target differential image file, forming a new target image file based on the target differential image file and the original image file, and processing the new target image file;
[0170] If the second differential file system partition is marked as damaged, a recovery image file is obtained from the recovery file system, and a firmware recovery operation of the baseboard management controller is performed using the recovery image file.
[0171] In one embodiment, the above device can implement another implementation of the mirror processing method, and the specific steps are as follows:
[0172] The firmware recovery operation of the baseboard management controller using the recovery image file includes:
[0173] Get the target configuration file and determine whether the target configuration file is normal;
[0174] If the target configuration file is normal, obtain the network status. If the network status is connected, start the firmware download process, verify the downloaded firmware, and obtain the verification result.
[0175] When the verification result is successful, the firmware recovery operation of the baseboard management controller is executed. In one embodiment, the above device can implement another implementation method of the image processing method, and the specific steps are as follows:
[0176] Get the target configuration file including:
[0177] Get the configuration file from the shared partition and check whether the configuration file in the shared partition is normal;
[0178] If the configuration file in the shared partition is normal, the configuration file in the shared partition is used as the target configuration file;
[0179] If the configuration file in the shared partition is abnormal, the target configuration file is obtained from the default file in the original file system partition.
[0180] In one embodiment, the above device can implement another implementation of the mirror processing method, and the specific steps are as follows:
[0181] The method also includes:
[0182] The boot program started by the baseboard management controller calls the target image file of the first image partition to start the baseboard management controller;
[0183] The number of times the boot program calls the target image file of the first image partition is obtained, and when the number of times the boot program calls the target image file of the first image partition is greater than a preset number of calls, the boot program is guided to call the target image file of the second image partition.
[0184] In one embodiment, the above device can implement another implementation of the mirror processing method, and the specific steps are as follows:
[0185] The method also includes:
[0186] When the baseboard management controller is started by using the target image file of the first image partition for a period exceeding a first period without starting the baseboard management controller, the baseboard management controller is started by using the target image file of the second image partition;
[0187] After the target image file of the second image partition is used to start the baseboard management controller, it is checked whether the target image file of the first image partition is abnormal. If the target image file of the first image partition is abnormal, the target image file of the second image partition is used to start the baseboard management controller. If the baseboard management controller is not started after the time length for starting the baseboard management controller exceeds the second time length, the target image file of the second image partition is used to start the baseboard management controller, wherein the second time length is less than the first time length.
[0188] For the specific definition of the image processing device, please refer to the definition of the image processing method above, which will not be repeated here. Each module in the above-mentioned image processing device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0189] In one embodiment, the present application also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the image processing methods provided by the above methods.
[0190] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 7 As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a mirror processing method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a key, trackball or touchpad set on the computer device housing, or an external keyboard, touchpad or mouse, etc.
[0191] Those skilled in the art will understand that Figure 7 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0192] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:
[0193] Step 101, divide the system partition to obtain partitions corresponding to the original file system, the differential file system and the shared system.
[0194] Step 102, obtain target input parameters, and run the original file system in the original file system partition and the target difference file system in the difference file system partition according to the target input parameters, the original file system stores the original image file, and the target difference file system stores the target difference image file.
[0195] Step 103, partition overlay is performed based on the original file system and the target differential file system to obtain a target root file system, the target root file system stores a target image file formed based on the original image file and the target differential image file, the target image file is obtained from the target root file system, and the target image file is processed.
[0196] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0197] The system partition is divided into the original file system, the differential file system and the common system corresponding partitions including:
[0198] Get the root file system partition and non-root file system partition in the system partition;
[0199] Dividing the root file system partition into an original file system partition and a differential file system partition, wherein the differential file system partition includes a first differential file system partition and a second differential file system partition;
[0200] Use the non-root file system partition as the shared system partition. The shared system partition includes the boot partition, kernel partition, shared partition, and log partition.
[0201] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0202] The method also includes:
[0203] Generate a first mirror partition based on the original file system partition, the first differential file system partition, and the common system partition;
[0204] A second mirror partition is generated based on the original file system partition, the second differential file system partition, and the common system partition.
[0205] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0206] The method also includes:
[0207] Determine whether the target difference file system partition of the target difference file system corresponding to the target input parameter is marked as damaged;
[0208] If the target difference file system partition of the target difference file system corresponding to the target input parameter is marked as damaged, the target difference file system switching operation is performed;
[0209] If the target difference file system partition of the target difference file system corresponding to the target input parameter is not marked as damaged, a target parameter is generated according to the target difference file system, and the target parameter is passed to the system kernel, and the system kernel performs the partition overlay operation according to the target parameter.
[0210] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0211] Based on the original file system and the target differential file system, partition overlay is performed to obtain the target root file system, including:
[0212] Obtain the file system directory corresponding to the original file system and the file system directory corresponding to the target difference file system;
[0213] The file system directory corresponding to the original file system and the file system directory corresponding to the target differential file system are jointly mounted to the mount directory of the target root file system to obtain the target root file system.
[0214] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0215] The file system directory corresponding to the original file system and the file system directory corresponding to the target differential file system are mounted together to the mount directory of the target root file system. The target root file system includes:
[0216] Obtain the original image file and place the original image file in the first file directory;
[0217] Obtain a target difference image file, and place the target difference image file in a second file directory;
[0218] By executing the mount command in the mount directory, the second file directory is used as the upper file directory, and the first file directory is used as the lower file directory and stacked in the mount directory, a target root file system is obtained.
[0219] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0220] Based on the original file system partition and the target differential file system partition, partition overlay is performed. Before obtaining the target root file system, the following steps are also included:
[0221] Verify the original image file and the target difference image file according to a preset verification method to obtain a verification result;
[0222] If the verification result is successful, partition overlay is performed based on the original file system and the target differential file system to obtain the target root file system;
[0223] If the verification result is a verification failure, the read start offset, data segment size and data value corresponding to the original image file and the target difference image file are obtained, and the data value of the data segment size is written to the start offset position in the bottom memory of the baseboard management controller;
[0224] The baseboard management controller parses the original image file and the target difference image file according to the data value of the data segment size, and refreshes the original image file and the target difference image file according to the parsed image file.
[0225] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0226] The target difference file system is the first difference file system. If the target difference file system partition of the target difference file system corresponding to the target input parameter is marked as damaged, performing the target difference file system switching operation includes:
[0227] If the first differential file system partition is marked as damaged, determining whether the second differential file system partition is marked as damaged;
[0228] If the second differential file system partition is not marked as damaged, switching the second differential file system in the second differential file system partition to the target differential file system, obtaining the differential image file in the second differential file system as the target differential image file, forming a new target image file based on the target differential image file and the original image file, and processing the new target image file;
[0229] If the second differential file system partition is marked as damaged, a recovery image file is obtained from the recovery file system, and a firmware recovery operation of the baseboard management controller is performed using the recovery image file.
[0230] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0231] The firmware recovery operation of the baseboard management controller using the recovery image file includes:
[0232] Get the target configuration file and determine whether the target configuration file is normal;
[0233] If the target configuration file is normal, obtain the network status. If the network status is connected, start the firmware download process, verify the downloaded firmware, and obtain the verification result.
[0234] When the verification result is successful, a firmware recovery operation of the baseboard management controller is performed.
[0235] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0236] Get the target configuration file including:
[0237] Get the configuration file from the shared partition and check whether the configuration file in the shared partition is normal;
[0238] If the configuration file in the shared partition is normal, the configuration file in the shared partition is used as the target configuration file;
[0239] If the configuration file in the shared partition is abnormal, the target configuration file is obtained from the default file in the original file system partition.
[0240] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0241] The method also includes:
[0242] The boot program started by the baseboard management controller calls the target image file of the first image partition to start the baseboard management controller;
[0243] The number of times the boot program calls the target image file of the first image partition is obtained, and when the number of times the boot program calls the target image file of the first image partition is greater than a preset number of calls, the boot program is guided to call the target image file of the second image partition.
[0244] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0245] The method also includes:
[0246] When the baseboard management controller is started by using the target image file of the first image partition for a period exceeding a first period without starting the baseboard management controller, the baseboard management controller is started by using the target image file of the second image partition;
[0247] After the target image file of the second image partition is used to start the baseboard management controller, it is checked whether the target image file of the first image partition is abnormal. If the target image file of the first image partition is abnormal, the target image file of the second image partition is used to start the baseboard management controller. If the baseboard management controller is not started after the time length for starting the baseboard management controller exceeds the second time length, the target image file of the second image partition is used to start the baseboard management controller, wherein the second time length is less than the first time length.
[0248] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0249] Step 101, divide the system partition to obtain partitions corresponding to the original file system, the differential file system and the shared system.
[0250] Step 102, obtain target input parameters, and run the original file system in the original file system partition and the target difference file system in the difference file system partition according to the target input parameters, the original file system stores the original image file, and the target difference file system stores the target difference image file.
[0251] Step 103, partition overlay is performed based on the original file system and the target differential file system to obtain a target root file system, the target root file system stores a target image file formed based on the original image file and the target differential image file, the target image file is obtained from the target root file system, and the target image file is processed.
[0252] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0253] The system partition is divided into the original file system, the differential file system and the common system corresponding partitions including:
[0254] Get the root file system partition and non-root file system partition in the system partition;
[0255] Dividing the root file system partition into an original file system partition and a differential file system partition, wherein the differential file system partition includes a first differential file system partition and a second differential file system partition;
[0256] Use the non-root file system partition as the shared system partition. The shared system partition includes the boot partition, kernel partition, shared partition, and log partition.
[0257] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0258] The method also includes:
[0259] Generate a first mirror partition based on the original file system partition, the first differential file system partition, and the common system partition;
[0260] A second mirror partition is generated based on the original file system partition, the second differential file system partition, and the common system partition.
[0261] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0262] The method also includes:
[0263] Determine whether the target difference file system partition of the target difference file system corresponding to the target input parameter is marked as damaged;
[0264] If the target difference file system partition of the target difference file system corresponding to the target input parameter is marked as damaged, the target difference file system switching operation is performed;
[0265] If the target difference file system partition of the target difference file system corresponding to the target input parameter is not marked as damaged, a target parameter is generated according to the target difference file system, and the target parameter is passed to the system kernel, and the system kernel performs the partition overlay operation according to the target parameter.
[0266] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0267] Based on the original file system and the target differential file system, partition overlay is performed to obtain the target root file system, including:
[0268] Obtain the file system directory corresponding to the original file system and the file system directory corresponding to the target difference file system;
[0269] The file system directory corresponding to the original file system and the file system directory corresponding to the target differential file system are jointly mounted to the mount directory of the target root file system to obtain the target root file system.
[0270] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0271] The file system directory corresponding to the original file system and the file system directory corresponding to the target differential file system are mounted together to the mount directory of the target root file system. The target root file system includes:
[0272] Obtain the original image file and place the original image file in the first file directory;
[0273] Obtain a target difference image file, and place the target difference image file in a second file directory;
[0274] By executing the mount command in the mount directory, the second file directory is used as the upper file directory, and the first file directory is used as the lower file directory and stacked in the mount directory, a target root file system is obtained.
[0275] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0276] Based on the original file system partition and the target differential file system partition, partition overlay is performed. Before obtaining the target root file system, the following steps are also included:
[0277] Verify the original image file and the target difference image file according to a preset verification method to obtain a verification result;
[0278] If the verification result is successful, partition overlay is performed based on the original file system and the target differential file system to obtain the target root file system;
[0279] If the verification result is a verification failure, the read start offset, data segment size and data value corresponding to the original image file and the target difference image file are obtained, and the data value of the data segment size is written to the start offset position in the bottom memory of the baseboard management controller;
[0280] The baseboard management controller parses the original image file and the target difference image file according to the data value of the data segment size, and refreshes the original image file and the target difference image file according to the parsed image file.
[0281] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0282] The target difference file system is the first difference file system. If the target difference file system partition of the target difference file system corresponding to the target input parameter is marked as damaged, performing the target difference file system switching operation includes:
[0283] If the first differential file system partition is marked as damaged, determining whether the second differential file system partition is marked as damaged;
[0284] If the second differential file system partition is not marked as damaged, switching the second differential file system in the second differential file system partition to the target differential file system, obtaining the differential image file in the second differential file system as the target differential image file, forming a new target image file based on the target differential image file and the original image file, and processing the new target image file;
[0285] If the second differential file system partition is marked as damaged, a recovery image file is obtained from the recovery file system, and a firmware recovery operation of the baseboard management controller is performed using the recovery image file.
[0286] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0287] The firmware recovery operation of the baseboard management controller using the recovery image file includes:
[0288] Get the target configuration file and determine whether the target configuration file is normal;
[0289] If the target configuration file is normal, obtain the network status. If the network status is connected, start the firmware download process, verify the downloaded firmware, and obtain the verification result.
[0290] When the verification result is successful, a firmware recovery operation of the baseboard management controller is performed.
[0291] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0292] Get the target configuration file including:
[0293] Get the configuration file from the shared partition and check whether the configuration file in the shared partition is normal;
[0294] If the configuration file in the shared partition is normal, the configuration file in the shared partition is used as the target configuration file;
[0295] If the configuration file in the shared partition is abnormal, the target configuration file is obtained from the default file in the original file system partition.
[0296] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0297] The method also includes:
[0298] The boot program started by the baseboard management controller calls the target image file of the first image partition to start the baseboard management controller;
[0299] The number of times the boot program calls the target image file of the first image partition is obtained, and when the number of times the boot program calls the target image file of the first image partition is greater than a preset number of calls, the boot program is guided to call the target image file of the second image partition.
[0300] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0301] The method also includes:
[0302] When the baseboard management controller is started by using the target image file of the first image partition for a period exceeding a first period without starting the baseboard management controller, the baseboard management controller is started by using the target image file of the second image partition;
[0303] After the target image file of the second image partition is used to start the baseboard management controller, it is checked whether the target image file of the first image partition is abnormal. If the target image file of the first image partition is abnormal, the target image file of the second image partition is used to start the baseboard management controller. If the baseboard management controller is not started after the time length for starting the baseboard management controller exceeds the second time length, the target image file of the second image partition is used to start the baseboard management controller, wherein the second time length is less than the first time length.
[0304] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0305] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0306] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application.
Claims
1. A mirror processing method, characterized in that: include: Divide the system partition to obtain partitions corresponding to the original file system, the differential file system and the shared system; Obtain target input parameters, and run the original file system in the original file system partition and the target difference file system in the difference file system partition according to the target input parameters, wherein the original file system stores the original image file, and the target difference file system stores the target difference image file; Partition overlay is performed based on the original file system and the target differential file system to obtain a target root file system, in which a target image file formed based on the original image file and the target differential image file is stored, the target image file is obtained from the target root file system, and the target image file is processed.
2. The method according to claim 1, characterized in that The partitioning of the system partition to obtain the original file system, the difference file system and the common system corresponding partitions includes: Get the root file system partition and non-root file system partition in the system partition; Dividing the root file system partition into an original file system partition and a differential file system partition, wherein the differential file system partition includes a first differential file system partition and a second differential file system partition; The non-root file system partition is used as a common system partition, and the common system partition includes a boot partition, a kernel partition, a shared partition, and a log partition.
3. The method according to claim 2, characterized in that The method further comprises: Generate a first mirror partition based on the original file system partition, the first differential file system partition, and the common system partition; A second mirror partition is generated based on the original file system partition, the second differential file system partition, and the common system partition.
4. The method according to claim 1, characterized in that: The method further comprises: Determine whether the target difference file system partition of the target difference file system corresponding to the target input parameter is marked as damaged; If the target difference file system partition of the target difference file system corresponding to the target input parameter is marked as damaged, a target difference file system switching operation is performed; If the target difference file system partition of the target difference file system corresponding to the target input parameter is not marked as damaged, a target parameter is generated according to the target difference file system, and the target parameter is passed to the system kernel, and the system kernel performs a partition overlay operation according to the target parameter.
5. The method according to claim 1, characterized in that: The performing partition overlay and superposition based on the original file system and the target differential file system to obtain the target root file system comprises: Obtain the file system directory corresponding to the original file system and the file system directory corresponding to the target difference file system; The file system directory corresponding to the original file system and the file system directory corresponding to the target differential file system are jointly mounted to the mount directory of the target root file system to obtain the target root file system.
6. The method according to claim 5, characterized in that The step of jointly mounting the file system directory corresponding to the original file system and the file system directory corresponding to the target differential file system to the mount directory of the target root file system to obtain the target root file system comprises: Obtain an original image file, and place the original image file in a first file directory; Obtain a target difference image file, and place the target difference image file in a second file directory; By executing a mount command in the mount directory, the second file directory is used as an upper file directory, and the first file directory is used as a lower file directory and stacked into the mount directory to obtain a target root file system.
7. The method according to claim 1, characterized in that The partition overlaying and superposition based on the original file system partition and the target differential file system partition, before obtaining the target root file system, further comprises: Verify the original image file and the target difference image file according to a preset verification method to obtain a verification result; If the verification result is successful, partition overlay is performed based on the original file system and the target differential file system to obtain the target root file system; If the verification result is a verification failure, obtaining the read start offset, data segment size and data value corresponding to the original image file and the target difference image file, and writing the data value of the data segment size to the start offset position in the bottom memory of the baseboard management controller; The baseboard management controller parses the original image file and the target difference image file according to the data value of the data segment size, and refreshes the original image file and the target difference image file according to the parsed image file.
8. The method according to claim 4, characterized in that The target difference file system is a first difference file system, and if the target difference file system partition of the target difference file system corresponding to the target input parameter is marked as damaged, performing the target difference file system switching operation includes: If the first differential file system partition is marked as damaged, determining whether the second differential file system partition is marked as damaged; If the second differential file system partition is not marked as damaged, switching the second differential file system in the second differential file system partition to the target differential file system, acquiring the differential image file in the second differential file system as the target differential image file, forming a new target image file based on the target differential image file and the original image file, and processing the new target image file; If the second differential file system partition is marked as damaged, a recovery image file is obtained from the recovery file system, and the firmware recovery operation of the baseboard management controller is performed using the recovery image file.
9. The method according to claim 8, characterized in that The method of performing a firmware recovery operation of a baseboard management controller by using the recovery image file includes: Obtain a target configuration file, and determine whether the target configuration file is normal; If the target configuration file is normal, obtain the network status; if the network status is connected, start the firmware download process, verify the downloaded firmware, and obtain the verification result; When the verification result is successful, a firmware recovery operation of the baseboard management controller is performed.
10. The method according to claim 9, characterized in that The obtaining of the target configuration file comprises: Get the configuration file from the shared partition and check whether the configuration file in the shared partition is normal; If the configuration file in the shared partition is normal, the configuration file in the shared partition is used as the target configuration file; If the configuration file in the shared partition is abnormal, the target configuration file is obtained from the default file in the original file system partition.
11. The method according to claim 3, characterized in that The method further comprises: The boot program started by the baseboard management controller calls the target image file of the first image partition to start the baseboard management controller; The number of times the boot program calls the target image file of the first image partition is obtained, and when the number of times the boot program calls the target image file of the first image partition is greater than a preset number of calls, the boot program is guided to call the target image file of the second image partition.
12. The method according to claim 11, characterized in that The method further comprises: When the baseboard management controller is started by using the target image file of the first image partition for a period exceeding a first period without starting the baseboard management controller, the baseboard management controller is started by using the target image file of the second image partition; After the target image file of the second image partition is used to start the baseboard management controller, it is checked whether the target image file of the first image partition is abnormal. If the target image file of the first image partition is abnormal, the target image file of the second image partition is used to start the baseboard management controller. If the baseboard management controller is not started for a time period exceeding a second time period, the target image file of the second image partition is used to start the baseboard management controller, wherein the second time period is less than the first time period.
13. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 12 are implemented.
14. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 12 are implemented.
15. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 12 are implemented.
Citation Information
Patent Citations
Root file system-containing mirror image file obtaining method and starting method
CN115129421A
Construction method, device and equipment of root file system and readable storage medium
CN116361246A