CN108241550B - Backup and restoration method for operating system - Google Patents

Backup and restoration method for operating system Download PDF

Info

Publication number
CN108241550B
CN108241550B CN201611206690.1A CN201611206690A CN108241550B CN 108241550 B CN108241550 B CN 108241550B CN 201611206690 A CN201611206690 A CN 201611206690A CN 108241550 B CN108241550 B CN 108241550B
Authority
CN
China
Prior art keywords
disk
backup
grub
data
partition information
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.)
Active
Application number
CN201611206690.1A
Other languages
Chinese (zh)
Other versions
CN108241550A (en
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.)
Shenzhen Yanxiang Smart Technology Co ltd
Original Assignee
EVOC 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 EVOC Intelligent Technology Co Ltd filed Critical EVOC Intelligent Technology Co Ltd
Priority to CN201611206690.1A priority Critical patent/CN108241550B/en
Publication of CN108241550A publication Critical patent/CN108241550A/en
Application granted granted Critical
Publication of CN108241550B publication Critical patent/CN108241550B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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/1479Generic software techniques for error detection or fault masking
    • G06F11/1482Generic software techniques for error detection or fault masking by means of middleware or OS functionality

Abstract

The invention provides an operating system backup and restoration method, which comprises the following steps: acquiring data partition information on a source disk of a Linux system; mounting the data partition information to a regeneration dragon system directory; executing a tar command to pack the data file on the source disk; saving the data partition information; reading the data partition information; partitioning the target disk according to the data partitioning information; mounting the partition of the target disk; executing the tar command to decompress the data file on the source disk to the target disk; judging a grub version of the Linux system according to the decompressed data file; and installing the Linux system with a correct grub version. The method can remove the limit that the capacity of the target disk in the regeneration dragon is larger than or equal to the capacity of the source disk, and can select grub configuration to correctly boot the Linux system.

Description

Backup and restoration method for operating system
Technical Field
The invention relates to the technical field of computer science, in particular to an operating system backup and restoration method.
Background
With the continuous development of the Linux operating system, the Linux operating system is widely used, and the backup and restoration of the Linux system is an important technology. The backup restoring tool carried by the Linux system has the commands of dd, tar, cpio, dump and the like, the commands are generally operated on a command line and are suitable for system administrators and developers to use, and users who are accustomed to operating Windows and just contact Linux are difficult to use the backup restoring tool.
In the prior art, the regeneration software is a small system cloning tool with complete functions, can be used for backup and restoration operation of a Linux system, provides a friendly operation interface, supports Chinese display, and is convenient for a user just contacting the Linux system. The backup restoration of the regeneration dragon mainly uses dd commands, and good hard disk cloning can be achieved.
When the Linux system is restored by using the regeneration software backup, two defects exist: 1. the capacity of the target hard disk must be equal to or greater than the capacity of the source hard disk, otherwise restoration failure may result. 2. If the backup Linux system boots using grub2 and the regeneration dragon installs grub by default, the grub cannot normally use the configuration of grub2 to boot the Linux system correctly when restoring.
Disclosure of Invention
The operating system backup restoration method provided by the invention can solve the defects that the capacity of a target disk in the regeneration dragon software must be larger than or equal to the capacity of a source disk, and the problem that the grub cannot normally use the configuration of the grub2 to correctly boot the Linux system during regeneration dragon restoration.
The invention provides an operating system backup and restoration method, which comprises the following steps:
acquiring data partition information on a source disk of a Linux system;
step two, mounting the data partition information to a regeneration dragon system directory;
step three, executing a tar command to pack the data files on the source disk;
step four, storing the data partition information;
step five, reading the data partition information;
step six, partitioning the target disk according to the data partitioning information;
step seven, mounting the partition of the target disk;
step eight, executing the tar command to decompress the data file on the source disk to the target disk;
step nine, judging a grub version of the Linux system according to the decompressed data file;
and step ten, installing the Linux system with the correct grub version.
Optionally, the method further comprises the step of inputting a target folder, a target disk and selecting a source disk by a user before the step one.
Optionally, a step of calling a task _ savedisk function is further included before the step of inputting the target folder, the target disk and selecting the source disk by the user.
Optionally, the first step obtains the data partition information through fdisk and/or grep and/or cut commands.
Optionally, the step two mounts the data partition information to the regeneration dragon system directory through mount command.
Optionally, a step of calling a task _ restore function is further included between the step five and the step four.
Optionally, step six partitions the target disk by a paired command.
Optionally, step nine, judging the grub version of the Linux system according to the boot directory in the data file.
Optionally, the correct grub version in step ten may be grub or grub 2.
The operating system backup restoration method provided by the embodiment of the invention modifies the background dd command operation of the Linux system of the Regenerational dragon backup into the tar command operation based on the revision of the Regenerational dragon software, thereby solving the defect that the capacity of a target disk in the Regenerational dragon is required to be larger than or equal to the capacity of a source disk. Meanwhile, the invention also modifies the subsequent processing code after the regeneration dragon restores the Linux system data, and the modified code determines to install grub or grub2 according to the file and directory information in the boot directory, thereby solving the problem that the grub can not normally use the configuration of grub2 to correctly guide the Linux system during the restoration of the regeneration dragon.
Drawings
FIG. 1 is a flow diagram of a prior art start-up process for a recycle dragon system;
FIG. 2 is a flowchart of an embodiment of the present invention for implementing backup of an operating system;
FIG. 3 is a flowchart of another embodiment of the present invention for restoring an operating system;
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
"Rebate" is a Debian-based system cloning tool that supports backup-restore of a variety of operating systems and file systems, including Linux (ext2, ext3, ext4, reiserfs, reiser4, xfs, jfs, btrfs), Mac OS (HFS +), Microsoft Windows (fat, ntfs), FreeBSD, NetBSD, OpenBSD (UFS), and VMware ESX (VMFS). In the backup and reduction process, the regeneration host only backs up useful data, so that the backup time and the hard disk space can be effectively saved, and other unsupported files are processed in a full-copy mode. The recycle dragon supports hard disk and partition backup and restoration, and also supports hard disk to hard disk copy, but the target hard disk or partition must be larger than or equal to the size of the original hard disk or partition.
The function of the regeneration dragon restoring backup is mainly realized by Shell script operation, and the backup and the restoration are supported through SSH, Samba or NFS. For Linux backup and restore, the background implementation of the regeneration dragon mainly adopts dd commands, partition table information, boot sectors and the like of the hard disk can be backed up during backup, and hard disk data is written into a target hard disk by using dd commands during restore.
When the system is started, the starting process is shown in figure 1. The recycling dragon is a Linux system, the backup/restore operation of the recycling dragon is equivalent to an application program, after the Linux system is started in the step S11, the system automatically starts scripts under a/etc/ocs/ocs-live.d/directory in the step S12, so that an operating environment is prepared for backup/restore of the recycling dragon, and then restarts scripts under a/opt/drbl/sbin the step S13, wherein the scripts under the directory have a plurality of scripts, and the corresponding scripts are started to perform the backup/restore operation in the step S15 according to different selections of users in the step S14 interface interaction.
Furthermore, the backup operation of the regeneration dragon is mainly completed by ocs-functions, ocs-live-save, ocs-sr and other scripts; the restoration operation is mainly completed by ocs-functions, ocs-live-restore, ocs-sr and other scripts. Wherein the core script is ocs-functions.
During backup, a task _ savedisk function is called, then the task _ savedicks function is called to store each hard disk partition, the task _ savedicks function calls an image _ save function for further processing, finally the task _ savedicks function is called, and a dd command is used in the function to perform data backup operation.
During restoration, a task _ restore function is called, then a task _ restore function is called to restore each partition, dd commands are used in the task _ restore function to restore data, and finally special parts of the hard disk are processed, such as MBR, partition table information, installation grub and the like.
The invention provides an operating system backup and restoration method, which modifies a specifically used command tool of background operation of regeneration dragon backup/restoration to tar, and after modification, the original partition which does not mount a disk is changed into a partition which mounts data first when data is backed up, and then the data on the partition is packed by using the tar command. And after packaging, storing the partition information on the source disk for use in restoration.
Further, the step of implementing the operating system backup specifically according to the present invention is shown in fig. 2, and in step S21, a task _ savedisk function is called; at step S22, the user inputs a target folder for backup; at step S23, the user inputs the target disk where the backup is located; at step S24, the user selects a source disk that needs to be backed up; at step S25, obtaining partition information of the Linux system on the source disk using fdisk and/or grep and/or cut commands; at step S26, mount all data partitions of the source disk under the directory of the regeneration dragon system using mount command; at step S27, tar packaging the data file on the source disk is performed; at step 28, the partition information on the source disk is saved to the target folder.
Further, the step of the present invention for specifically implementing the operating system restoration is as shown in fig. 3, and in step S31, a task _ restore function is called; at step S32, the partition information of the source disk saved at the time of backup is read; at step S33, partitioning the target disk using the paired command according to the partition information of the source disk; at step S34, mount the respective partitions of the target disk; at step S35, tar is executed to decompress the backup file to the target disk; at step S36, determining a grub version used by the system on the source disk according to the decompressed boot directory, and installing a correct grub version system; at step S37, the target disk is unloaded, and then the system is restarted.
The operating system backup restoration method provided by the embodiment of the invention is based on the revision of the regeneration dragon software, and modifies the background dd command operation of the regeneration dragon backup Linux system into the tar command operation, so that the method is not limited by the fact that the capacity of a target disk is larger than or equal to the capacity of a source disk when the Linux system is backed up/restored, and meanwhile, the method can judge that the Linux system is correctly guided by using the grub and/or the grub2 during restoration. The method and the device enable the process of backup and restoration of the Linux operating system to be flexible and convenient.
The above description is only for the specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (6)

1. An operating system backup restoration method, comprising:
acquiring data partition information on a source disk of a Linux system;
step two, mounting the data partition information to a regeneration dragon system directory;
step three, executing a tar command to pack the data files on the source disk;
step four, storing the data partition information;
step five, reading the data partition information;
step six, partitioning the target disk through a paired command according to the data partitioning information;
step seven, mounting the partition of the target disk;
step eight, executing the tar command to decompress the data file on the source disk to the target disk;
judging a grub version of the Linux system according to the boot directory in the decompressed data file;
step ten, installing a correct grub version of the Linux system, wherein the correct grub version is grub or grub 2.
2. The operating system backup and restore method according to claim 1, further comprising the step of a user entering a target folder, a target disk and selecting a source disk before said step one.
3. The operating system backup restoration method according to claim 2, further comprising the step of calling a task _ savedisk function before the step of the user entering a target folder, a target disk, and selecting a source disk.
4. The backup restoration method for the operating system according to claim 1, wherein the step one is to obtain the data partition information through fdisk and/or grep and/or cut commands.
5. The os backup restoration method according to claim 1, wherein the step mounts the data partition information under the directory of the player dragon system by a mount command.
6. The operating system backup restoring method according to claim 1, wherein between the fifth step and the fourth step, further comprising the step of calling a task _ restore function.
CN201611206690.1A 2016-12-23 2016-12-23 Backup and restoration method for operating system Active CN108241550B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611206690.1A CN108241550B (en) 2016-12-23 2016-12-23 Backup and restoration method for operating system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611206690.1A CN108241550B (en) 2016-12-23 2016-12-23 Backup and restoration method for operating system

Publications (2)

Publication Number Publication Date
CN108241550A CN108241550A (en) 2018-07-03
CN108241550B true CN108241550B (en) 2021-05-18

Family

ID=62704213

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611206690.1A Active CN108241550B (en) 2016-12-23 2016-12-23 Backup and restoration method for operating system

Country Status (1)

Country Link
CN (1) CN108241550B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109101366A (en) * 2018-08-10 2018-12-28 郑州云海信息技术有限公司 A kind of method and system of operating system backup and reduction based on Linux
CN111382006B (en) * 2018-12-27 2023-04-07 中国移动通信集团四川有限公司 Recovery method, device, equipment and medium of operating system
CN109902490B (en) * 2019-02-22 2020-10-30 北京易讯通信息技术股份有限公司 Linux kernel level file system tamper-proof application method
CN111831484B (en) * 2020-07-21 2023-10-20 中科方德软件有限公司 Automatic backup and restoration method for system
CN112416657B (en) * 2020-12-09 2023-05-09 成都傲梅科技有限公司 System cloning method
CN112579361B (en) * 2020-12-25 2024-04-02 深圳市科力锐科技有限公司 Backup data reconstruction method, device, equipment and storage medium
CN113377398A (en) * 2021-06-09 2021-09-10 南宁市研祥特种计算机软件有限公司 Operating system upgrading method
CN116662079B (en) * 2023-07-31 2023-09-29 明阳时创(北京)科技有限公司 Method and system for quickly backing up and restoring ubuntu operating system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103207788A (en) * 2012-01-13 2013-07-17 中兴通讯股份有限公司 Version starting method and version starting device
CN103530144A (en) * 2013-09-04 2014-01-22 国云科技股份有限公司 Method for generating virtual machine images from legacy system
CN105242986A (en) * 2015-09-11 2016-01-13 金步国 Method for backing up and restoring Windows operating system
CN105786504A (en) * 2016-02-29 2016-07-20 陶雨露 Method for achieving installation and guided repair of various operation systems through U-disk

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103207788A (en) * 2012-01-13 2013-07-17 中兴通讯股份有限公司 Version starting method and version starting device
CN103530144A (en) * 2013-09-04 2014-01-22 国云科技股份有限公司 Method for generating virtual machine images from legacy system
CN105242986A (en) * 2015-09-11 2016-01-13 金步国 Method for backing up and restoring Windows operating system
CN105786504A (en) * 2016-02-29 2016-07-20 陶雨露 Method for achieving installation and guided repair of various operation systems through U-disk

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
CloneZilla(再生龙)整盘备份和恢复;https://jingyan.baidu.com/article/20095761baf253cb0721b40a.html;《百度经验》;20150107;正文全文 *
使用tar或dd等完成Linux系统备份恢复;无明时空;《开源中国》;20130308;正文全文 *

Also Published As

Publication number Publication date
CN108241550A (en) 2018-07-03

Similar Documents

Publication Publication Date Title
CN108241550B (en) Backup and restoration method for operating system
US11789823B2 (en) Selective processing of file system objects for image level backups
US10067835B2 (en) System reset
CN109558215B (en) Backup method, recovery method and device of virtual machine and backup server cluster
US10503532B2 (en) Creating a virtual machine clone of the host computing device and handling of virtual machine clone requests via an I/O filter
US8738883B2 (en) Snapshot creation from block lists
US10911065B2 (en) Computer system and method including selectively compressing data files and directories based on an operator indication and representing the amount of available free space
US8302091B2 (en) Installation of a bootable image for modifying the operational environment of a computing system
US8566640B2 (en) Systems, methods, and computer program products for instant recovery of image level backups
US10296423B2 (en) System and method for live virtual incremental restoring of data from cloud storage
JP5113700B2 (en) Firmware update apparatus and method
US20160378528A1 (en) Propagating changes from a virtual machine clone to a physical host device
US20110208929A1 (en) In-place virtualization during operating system installation
US20140372799A1 (en) System Differential Upgrade Method, Apparatus, and Mobile Terminal
EP3769224B1 (en) Configurable recovery states
US10102083B1 (en) Method and system for managing metadata records of backups
US20120260039A1 (en) Method and a removable device for backing up and restoring a host device
CN106250172A (en) A kind of Android double startup method of shared kernel subregion
CN116048644B (en) System migration method, device and readable storage medium
CN111694585A (en) Method, system, terminal and storage medium for replacing system partition file
CN110928624A (en) Cloud desktop calling method and device for user terminal and terminal
KR100792786B1 (en) Method for os restoring of computer using backup image file
KR100851305B1 (en) Method for replacement of file system in mobile terminal
CN117492920A (en) Control method, device, equipment and medium of cloud platform
CN115421762A (en) BMC (baseboard management controller) firmware upgrading method, device, equipment and medium

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
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20230707

Address after: 518057 1701, Yanxiang science and technology building, 31 Gaoxin middle Fourth Road, Maling community, Yuehai street, Nanshan District, Shenzhen City, Guangdong Province

Patentee after: Shenzhen Yanxiang Smart Technology Co.,Ltd.

Address before: 518107 5th floor, No.1, Yanxiang Zhigu chuangxiangdi, No.11, Gaoxin Road, Guangming New District, Shenzhen City, Guangdong Province

Patentee before: EVOC INTELLIGENT TECHNOLOGY Co.,Ltd.