Domestic operating system Ghost mirror image backup and restoration method
By generating Ghost image files through a graphical interface or command line, the problem of system backup and restoration across hardware platforms is solved, enabling system migration and recovery across hardware architectures, improving the flexibility and efficiency of backup, and reducing storage resource consumption and operation and maintenance costs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHINA STANDARD SOFTWARE
- Filing Date
- 2026-01-14
- Publication Date
- 2026-05-15
AI Technical Summary
Existing backup and restore solutions lack cross-hardware platform compatibility and migration capabilities, making it difficult to recover from system failures. Furthermore, redundant data after multiple backups consumes storage resources, increasing management complexity and costs.
System backups can be performed using a graphical interface or command line. Ghost image files are generated by compressing them using the mksquashfs command. System restoration across hardware platforms is supported. Combined with an identification file mechanism and space prediction function, image integrity and storage optimization are ensured.
It achieves broad compatibility across hardware architectures, improves system cloning and deployment efficiency, reduces storage resource consumption, lowers operation and maintenance costs, and supports rapid migration and recovery of heterogeneous hardware environments.
Smart Images

Figure CN122044955A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to an operating system backup and restore method, and more particularly to a method for backing up and restoring a domestically produced operating system Ghost image, belonging to the field of computer operating system technology. Background Technology
[0002] Existing backup and restore solutions are typically limited to performing recovery operations on the same physical machine, lacking cross-hardware platform compatibility and migration capabilities. When system failures or restore failures occur, such solutions are highly susceptible to preventing the original system from recovering properly, or even from reverting to its complete state at the time of backup. This can lead to the loss of critical data or damage to the pre-configured environment, significantly extending system recovery time and severely impacting business continuity. Furthermore, most existing system backup methods continuously generate and accumulate redundant data after multiple backup operations, causing backup file sizes to increase dramatically, significantly consuming storage resources and further exacerbating storage management complexity and cost pressures. Summary of the Invention
[0003] To address the aforementioned issues, this invention provides a method for backing up and restoring a domestically developed operating system Ghost image, thereby improving the efficiency and flexibility of system environment cloning and deployment.
[0004] To achieve the above objectives, the technical solution of the present invention is: a method for backing up and restoring a domestically produced operating system Ghost image, comprising the following steps: Perform system backup using a graphical interface or command line, and use the mksquashfs command to compress and package the backup data into a Ghost image file. Then, select a suitable Ghost image as the installation source for system restoration.
[0005] Furthermore, when using a graphical interface to perform system backup to obtain a Ghost image, the system backup is completed first, and then the system image is created based on the generated backup file.
[0006] Furthermore, obtaining a Ghost image by performing system backup using a graphical interface includes the following steps: Step S1: Select the backup storage directory; Step S2: The background obtains the storage directory from Step S1 for environment detection, uses the rsync command to obtain the backup file size, and checks whether the available space is greater than the backup file size. If it is greater, proceed to Step S3. Step S3: Backup preparation, set the backup file name; in the background, set the UUID of the current backup file and record it in the / backup / snapshots / backuplist.xml file, and prepare the default backup directory for system backup: / backup / snapshots / uuid / data; Step S4: Backup in progress: The backup progress bar is displayed. During the backup process, the rsync command is used to copy the specified file to the directory / backup / snapshots / uuid / data; Step S5: Backup successful: Register the dbus listener system for backup signals, including backup progress signals and backup completion signals. If successful, display "Backup successful". Step S6: Select the system backup file. In the backup file list, select the system backup status for which you want to create a Ghost image. The background retrieves the backup file selected by the user and verifies whether the backup node exists in backuplist.xml. Step S7: Select the image storage location; Step S8: Environment detection: Verify that the backup data exists and check whether the available space is greater than the image file size. If the space is sufficient, proceed to step S9. Step S9: Creating: Display the creation progress bar. During the creation process, add the identifier file / etc / .ghost and execute the mksquashfs command to package the backup files selected in step S6 into an image file with the .kyimg extension. Step S10: Creation complete: Register the dbus listener system backup signals, including the creation progress signal and the creation completion signal. If successful, the backup will be displayed as successful.
[0007] Furthermore, if the available space is less than the backup file size in step S2, the system will prompt "Detection failed, insufficient backup space" and return to step S1 to select a backup path again; or the system can clean up the space and re-detect the environment.
[0008] Furthermore, if the available space is less than the image file size in step S8, a message will be displayed saying "Detection failed, insufficient space", and the process will return to step S7 to select a new storage path; or the space can be cleared and the environment will be re-detected.
[0009] Furthermore, performing a system backup using the command line to obtain a Ghost image file includes the following steps: Step S1: Execute mk-ghost in the terminal. First, it checks whether the current user has root privileges. If yes, continue to step S2. Otherwise, it exits and prints the message "Requires running as root user". Step S2: When executing mk-ghost in the terminal, if the parameter "-d" is added, the storage directory of the image will be selected, and the backup file size will be calculated at the same time; Step S3: Determine the available space size of the partition where the directory is located. If it is greater than the backup file size, proceed to step S4. Step S4: Set the image name; Step S5: Start creating the image. Add the identifier file / etc / .ghost and execute the mksquashfs command to package the backup files into an image file with the .kyimg extension.
[0010] Furthermore, if the available space is insufficient in step S3, a pop-up message will appear prompting the user that there is not enough space and that more space is needed.
[0011] Furthermore, the system restoration includes the following steps: Step S1: In the installation interface, select "Ghost file" as the installation source and select an image file with the .kyimg extension; Step S2: Determine if the image is available. If the image is available, proceed to step S3. Step S3: Select the installation location. Users can choose to install on a single hard drive or with two hard drives as needed. Step S4: Determine if the selected hard disk space is sufficient. If the selected hard disk space is larger than the image file, proceed with the installation until the installation is successful.
[0012] Furthermore, if the image is unavailable in step S2, an image error message will be displayed. Select the correct image and proceed with the installation.
[0013] Furthermore, in step S4, if the hard disk space is less than the image file size, a prompt will appear indicating insufficient space, requiring the selection of another hard disk or replacement of the image file.
[0014] The beneficial effects of the domestic operating system Ghost image backup and restore method of the present invention are as follows: This invention has broad compatibility across hardware architectures and can be applied to the domestic Kylin operating system based on both ARM and x86 architectures. It can realize the rapid creation of Ghost images, system cloning and unified deployment, and effectively support system migration and recovery in heterogeneous hardware environments.
[0015] This invention provides both graphical and command-line image generation methods, significantly enhancing the applicability and operability of the method. Users can flexibly choose the operation mode according to the actual scenario, and it supports custom image names and storage paths, meeting the diverse needs of users with different technical backgrounds and improving the flexibility of system backup and the efficiency of human-computer interaction.
[0016] This invention introduces an identifier file mechanism and combines it with the mksquashfs compression command to achieve efficient image generation and optimized storage space while ensuring image integrity and reversibility. This method not only significantly improves image creation efficiency but also effectively reduces storage resource consumption caused by multiple backups, thereby reducing repetitive work and maintenance costs in system maintenance.
[0017] The backup image generated by this invention is an independent, standardized file (e.g., .kyimg). This file can be stored on a USB flash drive, external hard drive, network storage (NAS / SAN), or any other storage medium, and can be booted from any of these media during restoration, greatly improving deployment flexibility and the efficiency of large-scale operation and maintenance.
[0018] This invention also provides a graphical user interface (GUI), allowing users to intuitively complete backups within a familiar operating system. Simultaneously, its command-line tool (mk-ghost) supports one-click generation and rich customization options, making it easily integrated into automated operation and maintenance scripts. Furthermore, the space prediction function of this invention can automatically avoid failures due to insufficient storage space, making the entire process more intelligent and reliable. Attached Figure Description
[0019] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments.
[0020] Figure 1 This is a schematic diagram of the overall concept of the method of the present invention: Figure 2 This is a schematic diagram of the process of creating a Ghost image using the graphical method of the present invention; Figure 3 This is a flowchart illustrating the process of creating a Ghost image using the command-line method of this invention; Figure 4 This is a schematic diagram of the Ghost image restoration process of this invention. Detailed Implementation
[0021] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Many specific details are set forth in the following description to provide a thorough understanding of the present invention. However, the present invention may also be implemented in other ways different from those described herein. Those skilled in the art can make similar extensions without departing from the spirit of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0022] Definitions of abbreviations and key terms: GHOST: General Hardware-Oriented Software Transfer is a widely used data backup and recovery method.
[0023] This invention provides a method for backing up and restoring a domestically produced server operating system Ghost image, aiming to achieve efficient system image generation and rapid deployment across hardware platforms. The method is mainly implemented by two functional modules: system backup and system restore, responsible for image generation and system recovery respectively. It also supports local and cross-machine restoration, significantly improving the efficiency and flexibility of system environment cloning and deployment. The method of this invention is described in detail below with reference to the accompanying drawings.
[0024] Example 1
[0025] Combination Figure 1 As shown, the method of the present invention mainly includes a system backup step and a system restore step, wherein, The system backup process includes two image generation methods to adapt to different application scenarios: a graphical method and a command-line method. Specifically: 1. Creating a Ghost image via a graphical interface: This requires first backing up the system, then creating a system image based on the generated backup file. The graphical backup tool consists of two main modules: a front-end graphical interface and a background service process (not shown in the diagram), which communicate via D-Bus.
[0026] 2. One-click generation of Ghost images via command line: Users can customize the image storage path and name by executing the mk-ghost command, or directly use the default configuration to generate an image with one click.
[0027] The above graphical interface or command line can be used to perform system backup, and the mksquashfs command can be used to compress and package the backup data into a Ghost image file to ensure that the generated image file has good storage efficiency and integrity.
[0028] The system restore process allows users to select a Ghost image as the installation source within the system installation interface and to automatically partition and install from any target hard drive. This method not only supports system migration between different hard drives but is also suitable for deployment in a unified multi-machine environment, significantly reducing the time and manpower costs of batch server configuration and improving system reliability and business continuity.
[0029] Example 2
[0030] Based on Example 1, combined with Figure 2 The present invention provides a detailed description of the steps for performing system backup in a graphical manner, specifically including the following steps: Step S1: Select the backup storage directory. The default backup path is / backup / snapshots. You can also customize the location where the backup files are stored: you can choose a local custom path (such as / home directory) or move the custom path (such as / run / media / root / 'storage media name').
[0031] Step S2: The background retrieves the storage directory from Step S1 for environment detection, uses the rsync command to obtain the backup file size, and checks whether the available space is greater than the backup file size. If it is greater, proceed to Step S3; if it is less, prompt "Detection failed, insufficient backup space". You can return to Step S1 to select a backup path again, or you can clean up the space and re-detect the environment, i.e., re-execute Step S2.
[0032] Step S3: Backup Preparation: The default backup file name is YY-MM-DD HH:MM:SS. You can also customize the backup file name. In the background, set the UUID of the current backup file and record it in the / backup / snapshots / backuplist.xml file. Prepare the system backup in the default backup directory / backup / snapshots / uuid / data.
[0033] Step S4: Backup in progress: The backup progress bar is displayed. You can also cancel the backup. During the backup process, use the rsync command to copy the specified file to the directory / backup / snapshots / uuid / data.
[0034] Step S5: Backup successful: Register the dbus listener system for backup signals, including backup progress signals and backup completion signals. If the signals are received, the backup will be displayed as successful.
[0035] Step S6: Select a system backup file. In the backup file list, select the system backup status for which you want to create a Ghost image. The background retrieves the backup file selected by the user and verifies whether the backup node exists in backuplist.xml.
[0036] Step S7: Select the image storage location. The default path is / ghost. You can also customize the location of the image file: you can choose a local custom path (such as / root directory) or move the custom path (such as / run / media / root / 'storage media name').
[0037] Step S8: Environment Detection: Verify that the backup data exists and check if the available space is greater than the image file size. If there is enough space, proceed to step S9. If there is not enough space, the message "Detection failed, insufficient space" will be displayed. You can return to step S7 to select a storage path again, or you can clean up the space and re-detect the environment, i.e., re-execute step S8.
[0038] Step S9: Creating: The creation progress bar is displayed. You can also cancel the creation. During the creation process, add the identifier file / etc / .ghost and execute the mksquashfs command to package the backup files into an image file with the .kyimg extension.
[0039] Step S10: Creation complete: Register the dbus listener system backup signals, including the creation progress signal and the creation completion signal. If successful, the backup will be displayed as successful.
[0040] Example 3
[0041] Based on Example 1, combined with Figure 3 This invention provides a detailed description of system backup via command line, specifically including the following steps: Step S1: Execute mk-ghost in the terminal. First, it will determine whether the current user has root privileges. If so, continue to step S2; otherwise, it will exit and print the message "Requires running as root user".
[0042] Step S2: When executing mk-ghost in the terminal, if you add the parameter "-d", you can select the storage directory of the image and calculate the backup file size at the same time.
[0043] Step S3: Determine the available space size of the partition where the directory is located. If it is greater than the backup file size, proceed to step S4. If the available space is insufficient, a pop-up message will prompt the user that there is not enough space and xx more space is needed.
[0044] Step S4: Set the image name: The default image name is "ghost-year-month-day-hour-minute-second-architecture". Users can set it according to their preferences. If the name is empty, it will be created automatically with the default name.
[0045] Step S5: Start creating the image. Add the identifier file / etc / .ghost and execute the mksquashfs command to package the backup files into an image file with the .kyimg extension.
[0046] Example 4
[0047] Based on Examples 2 and 3, combined with Figure 4 The steps for system restoration according to the present invention are described in detail, specifically including the following steps: Step S1: In the installation interface, select "Ghost file" as the installation source and select an image file with the .kyimg extension.
[0048] Step S2: Determine if the image is available. If the image is available, proceed to step S3. If the image is unavailable, an image error message will be displayed. Only by selecting the correct image can the installation proceed.
[0049] Step S3: Select the installation location. Users can choose to install on a single hard drive or with two hard drives as needed.
[0050] Step S4: Determine if the selected hard drive space is sufficient. If the selected hard drive space is larger than the image file, the installation can proceed until successful. If the hard drive space is smaller than the image file, a prompt will appear indicating insufficient space, requiring you to select another hard drive or change the image file.
[0051] In summary, the technical solution of the present invention solves the following technical problems: Firstly, traditional backup methods typically cannot achieve efficient migration and recovery of system images across hardware platforms, making it difficult to quickly restore the system to other servers when the original device fails, which seriously affects business continuity. Secondly, most existing backup methods generate large image files that lack effective compression and integration mechanisms. After multiple backups, the storage space occupied increases significantly, resulting in high management and storage costs. Third, existing technologies lack an integrated solution that can simultaneously support complete system backup, rapid image generation, and unified deployment across multiple machines, making it difficult to effectively improve the efficiency of system environment cloning and batch deployment while ensuring data integrity.
[0052] Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.
Claims
1. A method for backing up and restoring a domestically produced operating system Ghost image, characterized in that, Includes the following steps: Perform system backup using a graphical interface or command line, and use the mksquashfs command to compress and package the backup data into a Ghost image file. Then, select a suitable Ghost image as the installation source for system restoration.
2. The method according to claim 1, characterized in that, When using a graphical interface to perform a system backup to obtain a Ghost image, the system backup is completed first, and then the system image is created based on the generated backup file.
3. The method according to claim 2, characterized in that, Obtaining a Ghost image by performing a system backup using a graphical interface includes the following steps: Step S1: Select the backup storage directory; Step S2: The background obtains the storage directory from Step S1 for environment detection, uses the rsync command to obtain the backup file size, and checks whether the available space is greater than the backup file size. If it is greater, proceed to Step S3. Step S3: Backup preparation, set the backup file name; in the background, set the UUID of the current backup file and record it in the / backup / snapshots / backuplist.xml file, and prepare the default backup directory for system backup: / backup / snapshots / uuid / data; Step S4: Backup in progress: The backup progress bar is displayed. During the backup process, the rsync command is used to copy the specified file to the directory / backup / snapshots / uuid / data; Step S5: Backup successful: Register the dbus listener system for backup signals, including backup progress signals and backup completion signals. If successful, display "Backup successful". Step S6: Select the system backup file. In the backup file list, select the system backup status for which you want to create a Ghost image. The background retrieves the backup file selected by the user and verifies whether the backup node exists in backuplist.xml. Step S7: Select the image storage location; Step S8: Environment detection: Verify that the backup data exists and check whether the available space is greater than the image file size. If the space is sufficient, proceed to step S9. Step S9: Creating: Display the creation progress bar. During the creation process, add the identifier file / etc / .ghost and execute the mksquashfs command to package the backup files selected in step S6 into an image file with the .kyimg extension. Step S10: Creation complete: Register the dbus listener system backup signals, including the creation progress signal and the creation completion signal. If successful, the backup will be displayed as successful.
4. The method according to claim 3, characterized in that, If the available space is less than the backup file size in step S2, the system will prompt "Detection failed, insufficient backup space" and return to step S1 to select a backup path again; or the system can clean up the space and re-detect the environment.
5. The method according to claim 3, characterized in that, If the available space is less than the image file size in step S8, the system will prompt "Detection failed, insufficient space" and return to step S7 to select a new storage path; or clean up the space and re-detect the environment.
6. The method according to claim 1, characterized in that, The process of performing a system backup using the command line to obtain a Ghost image file includes the following steps: Step S1: Execute mk-ghost in the terminal. First, it checks whether the current user has root privileges. If yes, continue to step S2; otherwise, it exits and prints the message "Requires running as root user". Step S2: When executing mk-ghost in the terminal, if the parameter "-d" is added, the storage directory of the image will be selected, and the backup file size will be calculated at the same time; Step S3: Determine the available space size of the partition where the directory is located. If it is greater than the backup file size, proceed to step S4. Step S4: Set the image name; Step S5: Start creating the image. Add the identifier file / etc / .ghost and execute the mksquashfs command to package the backup files into an image file with the .kyimg extension.
7. The method according to claim 6, characterized in that, If the available space is insufficient in step S3, a pop-up message will prompt the user that there is not enough space and more space is needed.
8. The method according to claim 1, characterized in that, The system restoration includes the following steps: Step S1: In the installation interface, select "Ghost file" as the installation source and select an image file with the .kyimg extension; Step S2: Determine if the image is available. If the image is available, proceed to step S3. Step S3: Select the installation location. Users can choose to install on a single hard drive or with two hard drives as needed. Step S4: Determine if the selected hard disk space is sufficient. If the selected hard disk space is larger than the image file, proceed with the installation until the installation is successful.
9. The method according to claim 8, characterized in that, If the image is unavailable in step S2, an image error message will be displayed. Select the correct image and proceed with the installation.
10. The method according to claim 8, characterized in that, If the hard disk space is less than the image file size in step S4, a prompt will appear indicating insufficient space, requiring you to select another hard disk or change the image file.