CN117453295A - Operating system migration method, device, equipment and storage medium - Google Patents

Operating system migration method, device, equipment and storage medium Download PDF

Info

Publication number
CN117453295A
CN117453295A CN202311408557.4A CN202311408557A CN117453295A CN 117453295 A CN117453295 A CN 117453295A CN 202311408557 A CN202311408557 A CN 202311408557A CN 117453295 A CN117453295 A CN 117453295A
Authority
CN
China
Prior art keywords
operating system
upgraded
software package
data
partition
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311408557.4A
Other languages
Chinese (zh)
Inventor
崔士伟
王传国
张宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Metabrain Intelligent Technology Co Ltd
Original Assignee
Suzhou Metabrain Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou Metabrain Intelligent Technology Co Ltd filed Critical Suzhou Metabrain Intelligent Technology Co Ltd
Priority to CN202311408557.4A priority Critical patent/CN117453295A/en
Publication of CN117453295A publication Critical patent/CN117453295A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4406Loading of operating system
    • G06F9/441Multiboot arrangements, i.e. selecting an operating system to be loaded
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1448Management of the data involved in backup or backup restore
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/178Techniques for file synchronisation in file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates

Abstract

The application relates to an operating system migration method, an operating system migration device and a storage medium. The main technical scheme comprises the following steps: and under the condition that the first operating system normally operates, backing up the first operating system to obtain a second operating system, upgrading a software package to be upgraded in the second operating system according to the installation data, and after the software package to be upgraded is upgraded, synchronizing the update data of the first operating system to a specific file directory of the second operating system so as to complete migration from the first operating system to the second operating system. In the whole upgrading process, the first operating system operates normally, coexistence of the first operating system and the second operating system is achieved, switching between the operating systems can be conducted rapidly, and downtime caused by migration of the operating systems is reduced.

Description

Operating system migration method, device, equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to an operating system migration method, an operating system migration device, and a storage medium.
Background
The existing operating system migration tool mainly takes an open source project ieapp as a main part, the ieapp tool creates a temporary root file system (Initial RAM File System, initrimfs) as a memory file system, then a restarting system enters the initrimfs memory file system, and an original system software package is replaced by a new system software package in sequence according to a corresponding relation table of an original system and the new system of the software package in the initrimfs memory file system so as to upgrade the operating system. After all the replacement is completed, the system is restarted to enter a new operating system again, and the system is stopped for a plurality of hours due to the two system restarting and the upgrading work of the software package.
In addition, in order to prevent the migration failure of the operating system from backing up to the original system, a system backup and restore tool is generally used for backing up the original whole operating system, and when the original system cannot be upgraded to a new system and the original system is damaged, the backup and restore tool can be used for restoring the first operating system, so that the system can be ensured to normally run, but the operation of backing up and restoring the whole system is also long in time. The operating system is in a shutdown state for a long time and cannot normally provide services to the outside, so that user experience is affected.
Disclosure of Invention
Based on the above, the application provides an operating system migration method, an operating system migration device and a storage medium, so that downtime caused by operating system migration is reduced.
In a first aspect, there is provided an operating system migration method, the method comprising:
under the condition that the first operating system normally operates, backing up the first operating system to obtain a second operating system, wherein the second operating system comprises the installation data of the software package to be upgraded, which is installed by the first operating system;
according to the installation data, upgrading a software package to be upgraded in a second operating system;
and after the software package to be upgraded is upgraded, synchronizing the updating data of the first operating system to the specific file directory of the second operating system so as to complete the migration from the first operating system to the second operating system.
According to one implementation manner in the embodiments of the present application, backing up a first operating system includes:
and backing up the system data of the first operating system to an idle hard disk or an idle partition except the partition where the first operating system is located.
According to one implementation manner in the embodiments of the present application, the backup of the first operating system further includes:
and when the idle hard disk or the idle partition does not exist, backing up the system data of the first operating system to the appointed directory of the partition where the first operating system is located.
According to one implementation manner in the embodiments of the present application, the method further includes:
and if the system data of the first operating system are mounted in the local target hard disk or the target partition except the partition where the first operating system is located, mounting the data in the target hard disk or the target partition in the target backup directory of the first operating system, and obtaining the second operating system.
According to one implementation in an embodiment of the present application, the installation data includes a dependency table of the software package; according to the installation data, upgrading the software package to be upgraded in the second operating system, including:
switching a backup directory where a second operating system is currently located as a root partition;
creating a dependency relationship of the software package to be upgraded in the second operating system according to the dependency relationship table;
and sequentially upgrading the software packages to be upgraded in the second operating system according to the dependency relationship.
According to an implementation manner in the embodiments of the present application, according to a dependency relationship, a software package to be upgraded is sequentially upgraded in a second operating system, including:
determining the upgrading sequence of the software package to be upgraded according to the dependency relationship;
and sequentially upgrading the software packages to be upgraded in the second operating system according to the upgrading sequence.
According to one implementation manner in the embodiment of the application, the software package to be upgraded includes a kernel software package; according to the upgrading sequence, the software package to be upgraded is sequentially upgraded in the second operating system, and the method comprises the following steps:
when the kernel software package is upgraded according to the upgrading sequence, the root partition switching rule in the temporary root file system is modified into the latest root partition switching rule, and the latest root partition switching rule comprises the steps of switching an idle hard disk containing system backup data of the first operating system or switching an idle partition to be the root partition, and switching a designated directory containing the system backup data of the first operating system to be the root partition.
According to one implementation manner in the embodiments of the present application, the method further includes:
and when the upgrade of the software package to be upgraded fails, stopping upgrading the rest of the software packages to be upgraded in the software packages to be upgraded, and deleting the system data of the second operating system.
According to one implementation manner in the embodiments of the present application, the method further includes:
after the software package to be upgraded is completely upgraded successfully, adding a starting item of a second operating system in an operating system starting program for starting the second operating system, wherein the operating system starting program comprises a starting item of a first operating system.
According to one implementation manner in the embodiments of the present application, the method further includes:
when the second operating system operates abnormally, restarting the first operating system through the starting item of the first operating system to continue to provide the service.
According to one implementation manner in the embodiments of the present application, after the software package to be upgraded is upgraded, synchronizing the update data of the first operating system to the specific file directory of the second operating system includes:
after the software package to be upgraded is upgraded, writing update data in the configuration file, wherein the update data is updated in the process of upgrading the software package to be upgraded by the first operating system;
and according to the configuration file, synchronizing the update data of the first operating system to a specific file directory of the second operating system.
According to one implementation manner in the embodiments of the present application, according to a configuration file, synchronizing update data of a first operating system to a specific file directory of a second operating system includes:
responding to a system restarting operation, and acquiring updating data and a file directory of the updating data in a first operating system from a configuration file through a temporary root file system;
writing the update data into a specific file directory of the second operating system, wherein the specific file directory is the same as the file directory of the update data in the first operating system.
In a second aspect, there is provided an operating system migration apparatus, the apparatus comprising:
the backup module is used for backing up the first operating system under the condition that the first operating system normally operates to obtain a second operating system, wherein the second operating system comprises the installation data of the software package to be upgraded, which is installed by the first operating system;
the upgrade module is used for upgrading the software package to be upgraded in the second operating system according to the installation data;
and the synchronization module is used for synchronizing the update data of the first operating system to the specific file directory of the second operating system after the software package to be upgraded is upgraded, so as to complete the migration from the first operating system to the second operating system.
In a third aspect, there is provided a computer device comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores computer instructions executable by the at least one processor to enable the at least one processor to perform the method as referred to in the first aspect above.
In a fourth aspect, there is provided a computer-readable storage medium having stored thereon computer instructions for causing a computer to perform the method referred to in the first aspect above.
According to the technical content provided by the embodiment of the application, the first operating system is backed up under the condition that the first operating system normally operates to obtain the second operating system, the software package to be upgraded is upgraded in the second operating system according to the installation data, after the software package to be upgraded is upgraded, the updating data of the first operating system is synchronized to the specific file directory of the second operating system, so that the migration from the first operating system to the second operating system is completed, the first operating system normally operates in the whole upgrading process, coexistence of the first operating system and the second operating system is realized, switching between the operating systems can be rapidly performed, and the downtime caused by the migration of the operating systems is reduced.
Drawings
FIG. 1 is a diagram of an application environment for an operating system migration method in one embodiment;
FIG. 2 is a flow diagram of a method of operating system migration in one embodiment;
FIG. 3 is a diagram illustrating a first operating system backing up to a hard disk or partition in one embodiment;
FIG. 4 is a diagram illustrating a first operating system backing up to a specified directory in one embodiment;
FIG. 5 is a block diagram of an operating system migration apparatus in one embodiment;
fig. 6 is a schematic structural diagram of a computer device in one embodiment.
Detailed Description
The present application will be described in further detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
With the maintenance of the CentOS operating system stopped, a large number of stock CentOS systems on the market face the problem that common vulnerability disclosure (CVE) holes and bug cannot be repaired, and serious potential safety hazards are brought to the production environment, so that the CentOS systems need to be replaced with other operating systems as soon as possible. However, since the original centOS operating system is running the service, how to reduce the downtime in the process of operating system migration and how to quickly resume service operation after migration failure becomes a problem that needs to be solved in the process of operating system migration.
At present, a mainstream operating system migration scheme needs to create an init fs memory file system on an original running system, then a restarting system enters the init fs file system, a software package is upgraded in the init fs file system, after the upgrading is completed, the operating system needs to be restarted again to enter the upgraded operating system, the restarting process involving two operations and the upgrading process of the software package are carried out, the total time consumption can reach a plurality of hours, and during this time, the system can stop servicing. Another problem is to solve the problem of rollback of the migration failure system, and the mainstream solution at present is to adopt a system integral backup reduction mode, which is time-consuming, and if the migration failure of the system can be rolled back, a longer service stopping time is caused.
In order to solve the problems in the prior art, embodiments of the present application provide an operating system migration method, an operating system migration device, and a computer storage medium.
For ease of understanding, a system to which the present application is applicable will first be described. The migration method of the operating system can be applied to a system architecture shown in fig. 1. Wherein the terminal 110 communicates with the server 120 via a network. Under the condition that the first operating system normally operates, the server 120 backs up the first operating system to obtain a second operating system, wherein the second operating system comprises installation data of a software package to be upgraded, which is installed by the first operating system, the software package to be upgraded is upgraded in the second operating system according to the installation data, and after the software package to be upgraded is upgraded, the update data of the first operating system is synchronized to a specific file directory of the second operating system, so that migration from the first operating system to the second operating system is completed. The terminal 110 may be, but not limited to, various personal computers, notebook computers, and tablet computers, and the server 120 may be implemented as a stand-alone server or a server cluster composed of a plurality of servers.
The following first describes an operating system migration method provided in the embodiments of the present application.
FIG. 2 is a flow chart illustrating an operating system migration method according to one embodiment of the present application. As shown in fig. 2, the method may include the steps of:
and S210, under the condition that the first operating system operates normally, backing up the first operating system to obtain a second operating system.
The first operating system refers to an operating system currently running in the computing device, and is a Linux operating system for waiting for backup migration. Under the condition that the first operating system operates normally, the first operating system can be backed up to other hard disks, partitions or catalogues to obtain a second operating system. Wherein virtual file system data in the first operating system is not backed up, such as tmpfs/sysfs/procfs data.
The second operating system comprises the installation data of the software package to be upgraded, which is installed by the first operating system, and the software package to be upgraded comprises an application software package, a kernel software package, a system maintenance software package and the like. The installation data is the data necessary for installing and upgrading the software, and may include software versions of software packages, installation programs, dependency tables, application files, storage files, and the like.
S220, according to the installation data, the software package to be upgraded is upgraded in the second operating system.
Operating system migration refers to migration from one operating system platform to another operating system platform, and on the basis of installing a target operating system, the migration needs to ensure that the service system of the original operating system is migrated along with the migration as much as possible, and the user data file cannot be destroyed.
The software package to be upgraded is a software package which needs to be installed and upgraded in the second operating system for the software in the first operating system. The dependency relationship between the software in the first operating system cannot be destroyed when the software package to be upgraded is upgraded in the second operating system, so that the software package to be upgraded is sequentially upgraded according to the dependency relationship table of the software package in the installation data. And after the upgrading is finished, the dependency relationship between the software in the second operating system is the same as the dependency relationship between the software in the first operating system.
And S230, after the software package to be upgraded is upgraded, synchronizing the updating data of the first operating system to the specific file directory of the second operating system.
In the process of upgrading the software package to be upgraded, the first operating system is running and generates new running data, and the new running data is updated data. The second operating system does not generate updated data, and in order to ensure the consistency of the data in the first operating system and the second operating system, the updated data of the first operating system is synchronized to the specific file directory of the second operating system. The specific file directory is the same as the file directory of the update data in the first operating system in the second operating system.
It can be seen that, in the embodiment of the present application, under the condition that the first operating system operates normally, the first operating system is backed up to obtain the second operating system, according to the installation data, the software package to be upgraded is upgraded in the second operating system, and after the upgrading of the software package to be upgraded is completed, the update data of the first operating system is synchronized to the specific file directory of the second operating system, so that the migration from the first operating system to the second operating system is completed, and in the whole upgrading process, the first operating system operates normally, so that coexistence of the first operating system and the second operating system is realized, switching between the operating systems can be performed rapidly, and downtime caused by the migration of the operating systems is reduced.
The steps in the above-described process flow are described in detail below. First, the step S210 is described in detail in connection with the embodiment, that is, "under the condition that the first operating system is operating normally, the first operating system is backed up, and the second operating system is obtained".
As one of the realizable modes, backing up the first operating system includes: and backing up the system data of the first operating system to an idle hard disk or an idle partition except the partition where the first operating system is located.
When there is an extra free hard disk or partition, the data of the first operating system is backed up to the free hard disk or partition preferentially. As shown in fig. 3, sda1 represents a first main partition of the first hard disk, sda2 represents a first main partition of the first hard disk, and sdb1 represents a first main partition of the second hard disk. The first operating system is stored in the sda2, and the first operating system is backed up to the sdb1, that is, the system data of the first operating system is backed up to the idle hard disk, and the operating system backed up to the sdb1 is the second operating system. The system data of the first operating system can be backed up to an idle partition except the partition where the first operating system is located, and the idle partition can be located in the same hard disk as the partition where the first operating system is located or can be located in different hard disks.
And when the idle hard disk or the idle partition does not exist, backing up the system data of the first operating system to the appointed directory of the partition where the first operating system is located.
When the idle hard disk or the idle partition does not exist, the system data of the first operating system can only be backed up in the current partition, the system data of the first operating system is backed up in the appointed directory of the partition where the first operating system is located, and the appointed directory can be other directories, such as/new, where the first operating system data is not stored in the partition where the first operating system is located. As shown in fig. 4, sda1 represents a first main partition of the first hard disk, sda2 represents a first main partition of the first hard disk, a first operating system is stored in sda 2/under the directory, and system data of the first operating system is backed up to sda 2/under the network directory, that is, a second operating system is stored in sda 2/under the network directory.
As another implementation manner, if the system data of the first operating system is mounted in a local target hard disk or a target partition except the partition where the first operating system is located, the data in the target hard disk or the target partition is mounted in a target backup directory of the first operating system, so as to obtain the second operating system.
The target hard disk and the target partition are hard disks and partitions which do not need to be subjected to data backup, for example, the boot partition,/data partition,/boot partition is generally an independent mounted partition, the data in the partitions do not need to be subjected to backup, and the partitions can be directly mounted under the corresponding catalogs of the new system.
The target backup catalog is a catalog into which the system data of the first operating system is backed up and migrated, and the target backup catalog can be a catalog in a partition where the first operating system is located, or can be a catalog in other hard disks or partitions.
If the system data of the first operating system is mounted in a local target hard disk or a target partition except the partition where the first operating system is located, the system data of the first operating system can be directly mounted in a target backup directory of the first operating system without carrying out data backup during migration, so that the second operating system can be obtained.
The step S220, i.e. "upgrade the software package to be upgraded in the second operating system according to the installation data", will be described in detail below with reference to the embodiments.
As an achievable way, switching the backup directory where the second operating system is currently located to be the root partition;
creating a dependency relationship of the software package to be upgraded in the second operating system according to the dependency relationship table;
and sequentially upgrading the software packages to be upgraded in the second operating system according to the dependency relationship.
The Linux system manages data and hardware resources in a computer in the form of files, and various files are organized like a tree into a "directory tree", the root of the tree is a "root directory", and the symbol is "/". The root partition is a root node of the tree file system, any directory file is mounted below the root node, and the linux system only has one root, and no matter how many areas are divided into the hard disk, the partitions are mounted below the root directory for use.
Before a software package in the second operating system is upgraded, the backup directory where the second operating system is currently located is switched to be a root partition through a color so as to operate the second operating system. A color is a technology in the Unix/Linux operating system that allows the root file system to be changed to a specific directory, making that directory a virtual root directory.
The dependency relationship table is a table of dependency relationships among all software in the first operating system, and the dependency relationship table of the software package is generated according to the software package installed in the second operating system. The yum source of the first operating system is configured as the yum source of the second operating system and the package management software of the first operating system is upgraded to the package management software of the second operating system. The software packages to be upgraded can be obtained from the dependency table, and the software packages to be upgraded depend on the software packages. In order to ensure that the software package can be installed in the second operating system according to the service requirement of the first operating system, the software packages need to be installed in sequence according to the dependency relationship of the software packages.
And acquiring the dependency relationship between the software packages to be upgraded through the dependency relationship table, and creating the dependency relationship of the software packages to be upgraded in the second operating system. And sequentially upgrading the software packages to be upgraded in the second operating system according to the dependency relationship.
Specifically, determining the upgrading sequence of the software package to be upgraded according to the dependency relationship;
and sequentially upgrading the software packages to be upgraded in the second operating system according to the upgrading sequence.
And determining the dependence and the dependence relationship in the software package to be upgraded according to the dependence relationship, upgrading the dependent software package to be upgraded firstly, and then upgrading the software packages to be upgraded which depend on other software packages, and sequentially determining the upgrading sequence of the software packages to be upgraded. For example, the A software package depends on the B software package, the B software package depends on the C software package, the upgrading sequence of the three software packages is the C software package, the B software package and the A software package, and the C software package, the B software package and the A software package are sequentially upgraded according to the upgrading sequence of the software packages.
If the software package to be upgraded is a kernel software package, sequentially upgrading the software package to be upgraded in the second operating system according to the upgrading sequence, including:
when the kernel software package is upgraded according to the upgrade order, the root partition switching rule in the temporary root file system is modified to the latest root partition switching rule.
The latest root partition switching rules include switching an idle hard disk or an idle partition containing system backup data of the first operating system to a root partition, and switching a specified directory containing system backup data of the first operating system to a root partition.
Initramfs is a temporary root file system used in the boot process of the Linux system. It is embedded in the kernel and is responsible for the necessary initialization and preparation at startup, such as loading the drivers, identifying and mounting the devices required for the root file system. Once the initialization task is completed, the initrimfs is offloaded, the real root file system is mounted, and the system enters a normal running state.
When the kernel software package is upgraded according to the upgrading sequence, the hard disk, the partition or the directory where the second operating system is located is switched to the root partition in order to ensure that the current execution environment is located in the second operating system. Based on this, the latest root partition switching rules may include switching an idle hard disk or an idle partition containing system backup data of the first operating system to a root partition, and switching a specified directory containing system backup data of the first operating system to a root partition. The specified directory is a directory into which the system backup data of the first operating system is migrated, and the specified directory may be a/new directory.
If the system data of the first operating system is backed up to the idle hard disk or the idle partition, the idle hard disk or the idle partition needs to be mounted to the appointed directory, and then the execution color is performed to switch the appointed directory into the root partition and mount/boot partition. If the system data of the first operating system is backed up in the directory, the root partition needs to be switched to the designated directory of the mount partition. The temporary root file system is switched to the designated directory by modifying the switching logic of the temporary root file system in the initrimfs to enter the second operating system after the upgrade.
The software package upgrading process of the second operating system does not influence the operation of the first operating system, and the first operating system can normally provide services.
As one implementation, the method further includes:
and when the upgrade of the software package to be upgraded fails, stopping upgrading the rest of the software packages to be upgraded in the software packages to be upgraded, and deleting the system data of the second operating system.
When the software package to be upgraded fails to upgrade, the problem of the software in the second operating system is solved, so that the problem of the software package interdependent with the software package can also occur, and the second operating system can not be ensured to realize the service requirements met by the first operating system after the software package to be upgraded is continuously upgraded. At this time, the remaining software packages to be upgraded in the software packages to be upgraded do not need to be continuously upgraded, the second operating system cannot be normally used, the system data of the second operating system are deleted, the operation of the first operating system is not affected, and the original system is not required to be restored through a backup restoring tool.
As one implementation, the method further includes:
after the software package to be upgraded is completely upgraded successfully, adding a starting item of the second operating system in the operating system starting program grub for starting the second operating system, wherein the operating system starting program grub comprises the starting item of the first operating system.
After the system upgrade is completed, adding a starting item of the second operating system in the operating system starting program grub ensures that the kernel and the initrimfs of the second operating system can be loaded through the grub, and finally the second operating system can be switched to, and meanwhile, the first operating system can be kept to run normally. Through the arrangement, the first operating system can still normally provide services to the outside when the most time-consuming software upgrading operation is executed, and the first operating system can be ensured to quickly return to the first operating system to operate after the system migration fails.
When the second operating system operates abnormally, restarting the first operating system through the starting item of the first operating system to continue to provide the service.
If the external service is found to be abnormal after entering the second operating system, the external service can be normally provided by restarting and rapidly switching to the original system, so that the downtime caused by the system migration is greatly reduced, and the serviceability of the system is ensured.
The following describes the step S230 in detail, namely, "synchronizing the update data of the first operating system to the specific file directory of the second operating system when the upgrade of the software package to be upgraded is completed".
As an achievable way, after the software package to be upgraded is upgraded, writing the update data in the configuration file;
and according to the configuration file, synchronizing the update data of the first operating system to a specific file directory of the second operating system.
The updating data are updated data of the first operating system in the process of upgrading the software package to be upgraded. In order to ensure consistency of data in the first operating system and the second operating system, a synchronous update operation is performed on a particular file directory of the second operating system before the root partition is switched in the initrimfs.
The update data is written in the configuration file, and the directory/file that needs to be updated synchronously, such as writing/new/update_file. Updating the update data to the second operating system according to the configuration file.
Specifically, in response to a system restart operation, acquiring update data and a file directory of the update data in a first operating system from a configuration file through a temporary root file system;
writing the update data into a specific file directory of the second operating system, wherein the specific file directory is the same as the file directory of the update data in the first operating system.
The system is restarted to enter a temporary root file system, and synchronous updating operation is executed in the temporary root file system. If the first operating system is backed up to other hard disk and partition, the partition needs to be mounted to the/new directory. The temporary root file system obtains the update data from the configuration file and the file directory of the update data in the first operating system, and backs up the update data to the same file directory in the second operating system, namely the specific file directory.
It should be understood that, although the steps in the flowchart of fig. 2 are shown in sequence as indicated by the arrows, the steps are not necessarily performed in sequence as indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly stated in the present application, and the steps may be executed in other orders. Moreover, at least some of the steps in fig. 2 may include multiple sub-steps or stages that are not necessarily performed at the same time, but may be performed at different times, nor do the order in which the sub-steps or stages are performed necessarily performed in sequence, but may be performed alternately or alternately with at least a portion of the sub-steps or stages of other steps or other steps.
Fig. 5 is a schematic structural diagram of an os migration apparatus according to an embodiment of the present application, where the apparatus may be disposed in the server 120 in the system shown in fig. 1 to perform the method flow shown in fig. 2. As shown in fig. 5, the apparatus may include: the backup module 510, the upgrade module 520, and the synchronization module 530 may further include: the device comprises a mounting module, a deleting module, an adding module and a starting module. The main functions of each component module are as follows:
the backup module 510 is configured to backup the first operating system to obtain a second operating system under a condition that the first operating system is running normally, where the second operating system includes installation data of a software package to be upgraded that is installed by the first operating system;
the upgrade module 520 is configured to upgrade a software package to be upgraded in the second operating system according to the installation data;
and the synchronization module 530 is configured to synchronize the update data of the first operating system to the specific file directory of the second operating system after the software package to be upgraded is upgraded, so as to complete migration from the first operating system to the second operating system.
As one implementation, the backup module 510 is specifically configured to:
and backing up the system data of the first operating system to an idle hard disk or an idle partition except the partition where the first operating system is located.
As one implementation, the backup module 510 is specifically configured to:
and when the idle hard disk or the idle partition does not exist, backing up the system data of the first operating system to the appointed directory of the partition where the first operating system is located.
As an achievable way, the device further comprises a mounting module for:
and if the system data of the first operating system are mounted in the local target hard disk or the target partition except the partition where the first operating system is located, mounting the data in the target hard disk or the target partition in the target backup directory of the first operating system, and obtaining the second operating system.
As one implementation, the installation data includes a dependency table of the software package; the upgrade module 520 is specifically configured to:
switching a backup directory where a second operating system is currently located as a root partition;
creating a dependency relationship of the software package to be upgraded in the second operating system according to the dependency relationship table;
and sequentially upgrading the software packages to be upgraded in the second operating system according to the dependency relationship.
As one implementation, the upgrade module 520 is specifically configured to:
determining the upgrading sequence of the software package to be upgraded according to the dependency relationship;
and sequentially upgrading the software packages to be upgraded in the second operating system according to the upgrading sequence.
As one implementation, the software package to be upgraded includes a kernel software package; the upgrade module 520 is specifically configured to:
when the kernel software package is upgraded according to the upgrading sequence, the root partition switching rule in the temporary root file system is modified into the latest root partition switching rule, and the latest root partition switching rule comprises the steps of switching an idle hard disk containing system backup data of the first operating system or switching an idle partition to be the root partition, and switching a designated directory containing the system backup data of the first operating system to be the root partition.
As an achievable manner, the apparatus further comprises a puncturing module, configured to:
and when the upgrade of the software package to be upgraded fails, stopping upgrading the rest of the software packages to be upgraded in the software packages to be upgraded, and deleting the system data of the second operating system.
As an achievable way, the device further comprises an adding module for:
after the software package to be upgraded is completely upgraded successfully, adding a starting item of the second operating system in the operating system starting program grub for starting the second operating system, wherein the operating system starting program grub comprises the starting item of the first operating system.
As an achievable way, the device further comprises a starting module for:
when the second operating system operates abnormally, restarting the first operating system through the starting item of the first operating system to continue to provide the service.
As one implementation, the synchronization module 530 is specifically configured to:
after the software package to be upgraded is upgraded, writing update data in the configuration file, wherein the update data is updated in the process of upgrading the software package to be upgraded by the first operating system;
and according to the configuration file, synchronizing the update data of the first operating system to a specific file directory of the second operating system.
As one implementation, the synchronization module 530 is specifically configured to:
responding to a system restarting operation, and acquiring updating data and a file directory of the updating data in a first operating system from a configuration file through a temporary root file system;
writing the update data into a specific file directory of the second operating system, wherein the specific file directory is the same as the file directory of the update data in the first operating system.
The same and similar parts of the above embodiments are all referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the device embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference is made to the description of the method embodiments in part.
It should be noted that, in the embodiments of the present application, the use of user data may be involved, and in practical applications, user specific personal data may be used in the schemes described herein within the scope allowed by applicable laws and regulations under the condition that the applicable laws and regulations of the country are met (for example, the user explicitly agrees, the user is explicitly notified, the user is explicitly authorized, etc.).
According to embodiments of the present application, there is also provided a computer device, a computer-readable storage medium.
As shown in fig. 6, is a block diagram of a computer device according to an embodiment of the present application. Computer equipment is intended to represent various forms of digital computers or mobile devices. Wherein the digital computer may comprise a desktop computer, a portable computer, a workstation, a personal digital assistant, a server, a mainframe computer, and other suitable computers. The mobile device may include a tablet, a smart phone, a wearable device, etc.
As shown in fig. 6, the apparatus 600 includes a computing unit 601, a ROM 602, a RAM 603, a bus 604, and an input/output (I/O) interface 605, and the computing unit 601, the ROM 602, and the RAM 603 are connected to each other through the bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
The computing unit 601 may perform various processes in the method embodiments of the present application according to computer instructions stored in a Read Only Memory (ROM) 602 or computer instructions loaded from a storage unit 608 into a Random Access Memory (RAM) 603. The computing unit 601 may be a variety of general and/or special purpose processing components having processing and computing capabilities. The computing unit 601 may include, but is not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), as well as any suitable processor, controller, microcontroller, etc. In some embodiments, the methods provided by embodiments of the present application may be implemented as a computer software program tangibly embodied on a computer-readable storage medium, such as storage unit 608.
The RAM 603 may also store various programs and data required for operation of the device 600. Part or all of the computer program may be loaded and/or installed onto the device 600 via the ROM 802 and/or the communication unit 609.
An input unit 606, an output unit 607, a storage unit 608, and a communication unit 609 in the device 600 may be connected to the I/O interface 605. Wherein the input unit 606 may be such as a keyboard, mouse, touch screen, microphone, etc.; the output unit 607 may be, for example, a display, a speaker, an indicator light, or the like. The device 600 is capable of exchanging information, data, etc. with other devices through the communication unit 609.
It should be noted that the device may also include other components necessary to achieve proper operation. It may also include only the components necessary to implement the present application, and not necessarily all the components shown in the figures.
Various implementations of the systems and techniques described here can be implemented in digital electronic circuitry, integrated circuitry, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof.
Computer instructions for implementing the methods of the present application may be written in any combination of one or more programming languages. These computer instructions may be provided to a computing unit 601 such that the computer instructions, when executed by the computing unit 601, such as a processor, cause the steps involved in the method embodiments of the present application to be performed.
The computer readable storage medium provided herein may be a tangible medium that may contain, or store, computer instructions for performing the steps involved in the method embodiments of the present application. The computer readable storage medium may include, but is not limited to, storage media in the form of electronic, magnetic, optical, electromagnetic, and the like.
The above embodiments do not limit the scope of the application. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present application are intended to be included within the scope of the present application.

Claims (15)

1. A method of operating system migration, the method comprising:
under the condition that a first operating system normally operates, backing up the first operating system to obtain a second operating system, wherein the second operating system comprises installation data of a software package to be upgraded, which is installed by the first operating system;
according to the installation data, upgrading the software package to be upgraded in the second operating system;
and after the software package to be upgraded is upgraded, synchronizing the updating data of the first operating system to the specific file directory of the second operating system so as to complete the migration from the first operating system to the second operating system.
2. The method of claim 1, wherein backing up the first operating system comprises:
and backing up the system data of the first operating system to an idle hard disk or an idle partition except the partition where the first operating system is located.
3. The method of claim 2, wherein the backing up the first operating system further comprises:
and when the idle hard disk or the idle partition does not exist, backing up the system data of the first operating system to the appointed directory of the partition where the first operating system is located.
4. The method according to claim 1, wherein the method further comprises:
and if the system data of the first operating system are mounted in a local target hard disk or a target partition except the partition where the first operating system is located, mounting the data in the target hard disk or the target partition in a target backup directory of the first operating system to obtain a second operating system.
5. The method of claim 1, wherein the installation data comprises a dependency table of software packages; and upgrading the software package to be upgraded in the second operating system according to the installation data, wherein the software package to be upgraded comprises the following components:
switching the backup catalog of the second operating system as a root partition;
creating a dependency relationship of the software package to be upgraded in the second operating system according to the dependency relationship table;
and sequentially upgrading the software package to be upgraded in the second operating system according to the dependency relationship.
6. The method according to claim 5, wherein sequentially upgrading the software package to be upgraded in the second operating system according to the dependency relationship includes:
determining the upgrading sequence of the software package to be upgraded according to the dependency relationship;
and sequentially upgrading the software package to be upgraded in the second operating system according to the upgrading sequence.
7. The method of claim 6, wherein the software package to be upgraded comprises a kernel software package; and sequentially upgrading the software package to be upgraded in the second operating system according to the upgrading sequence, wherein the software package to be upgraded comprises the following steps:
when the kernel software package is upgraded according to the upgrading sequence, the root partition switching rule in the temporary root file system is modified into the latest root partition switching rule, wherein the latest root partition switching rule comprises the steps of switching an idle hard disk containing system backup data of the first operating system or switching an idle partition to be a root partition, and switching a designated directory containing the system backup data of the first operating system to be the root partition.
8. The method of claim 6, wherein the method further comprises:
and when the upgrade of the software package to be upgraded fails, stopping upgrading the rest of the software packages to be upgraded in the software package to be upgraded, and deleting the system data of the second operating system.
9. The method of claim 5, wherein the method further comprises:
and after the software package to be upgraded is completely upgraded successfully, adding a starting item of the second operating system in an operating system starting program for starting the second operating system, wherein the operating system starting program comprises the starting item of the first operating system.
10. The method according to claim 9, wherein the method further comprises:
when the second operating system is abnormal in operation of providing service to the outside, restarting the first operating system through the starting item of the first operating system to continue providing the service to the outside.
11. The method of claim 1, wherein synchronizing the update data of the first operating system to the specific file directory of the second operating system after the software package to be upgraded is upgraded comprises:
writing the update data in a configuration file after the software package to be updated is updated, wherein the update data is updated by the first operating system in the process of updating the software package to be updated;
and according to the configuration file, synchronizing the update data of the first operating system to a specific file directory of the second operating system.
12. The method of claim 11, wherein synchronizing the update data of the first operating system to the specific file directory of the second operating system according to the configuration file comprises:
responding to a system restarting operation, and acquiring the updating data and a file directory of the updating data in the first operating system from the configuration file through a temporary root file system;
writing the update data into a specific file directory of the second operating system, wherein the specific file directory is the same as the file directory of the update data in the first operating system.
13. An operating system migration apparatus, the apparatus comprising:
the backup module is used for backing up the first operating system under the condition that the first operating system normally operates to obtain a second operating system, wherein the second operating system comprises the installation data of the software package to be upgraded, which is installed by the first operating system;
the upgrade module is used for upgrading the software package to be upgraded in the second operating system according to the installation data;
and the synchronization module is used for synchronizing the update data of the first operating system to the specific file directory of the second operating system after the software package to be upgraded is upgraded, so as to complete the migration from the first operating system to the second operating system.
14. A computer device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores computer instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-12.
15. A computer readable storage medium having stored thereon computer instructions for causing a computer to perform the method of any of claims 1 to 12.
CN202311408557.4A 2023-10-27 2023-10-27 Operating system migration method, device, equipment and storage medium Pending CN117453295A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311408557.4A CN117453295A (en) 2023-10-27 2023-10-27 Operating system migration method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311408557.4A CN117453295A (en) 2023-10-27 2023-10-27 Operating system migration method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN117453295A true CN117453295A (en) 2024-01-26

Family

ID=89586816

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311408557.4A Pending CN117453295A (en) 2023-10-27 2023-10-27 Operating system migration method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN117453295A (en)

Similar Documents

Publication Publication Date Title
JP3329841B2 (en) Network system and its software management method
US8010504B2 (en) Increasing application availability during automated enterprise deployments
US9910664B2 (en) System and method of online firmware update for baseboard management controller (BMC) devices
EP3769224B1 (en) Configurable recovery states
US20080155303A1 (en) Distributed platform management for high availability systems
JP5476481B2 (en) Dealing with node failures
CN105138431A (en) Linux system back-up and restoring method
US11803412B2 (en) Containerized application management system and management method
US10445295B1 (en) Task-based framework for synchronization of event handling between nodes in an active/active data storage system
US20190187977A1 (en) Dual boot operating system installation using multiple redundant drives
CN110825419B (en) Firmware refreshing method and device, electronic equipment and storage medium
JP2020035374A (en) Availability system, method, and program
CN112445495A (en) Mirroring and recovery method for high-performance computing cluster nodes
CN107526838B (en) Method and device for database cluster capacity expansion
CN115576743B (en) Operating system recovery method, operating system recovery device, computer equipment and storage medium
CN117453295A (en) Operating system migration method, device, equipment and storage medium
US11675931B2 (en) Creating vendor-neutral data protection operations for vendors' application resources
CN114490570A (en) Production data synchronization method and device, data synchronization system and server
CN113590033A (en) Information synchronization method and device of super-fusion system
US10599412B2 (en) Operating system installation on a computing device with multiple redundant drives
CN112379973A (en) Heavy loading method and device
CN112000282A (en) Storage double-live method, device and related components
US20200167171A1 (en) Virtual machine booting using disk metadata
JP5317182B2 (en) POS terminal, module update method and module update program
KR20190130903A (en) Method and system for swapping booting disk

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination