Linux backup and restore system (similar to ghost backup and restore on windows)

1. Abstract

     After several years of development work on Linux (qt ros), I suddenly discovered that there are now company hardware, laptops and desktops that occupy one system, resulting in a waste of hardware and the inability to use virtual machines (sometimes a physical machine is required to link the hardware) )what to do?

2. Analysis preparation

    Desktop: 

         ​​​​​centos7 development environment,

        Centos stream9 development environment

        Ubuntu 20.04 development environment

         One centos 8. Development environment...

  Laptop: One dual system (windwos + centos7) + a certain demonstration environment A

             Dual system one (Window+ubuntu20.04+a demonstration environment B

   The above computer is a computer with two systems installed, but it still cannot meet the requirements, so we can only think of the following two methods:

1. Virtualize Linux physical machines that are not commonly used today into virtual machine backup environments

2. Back up Linux physical machines that are not commonly used now and create ghost software

3. Search online for Linux physical machine virtualization software

4. Search online for Linux physical machines similar to ghost software

3. Resolution process

   3.1 Linux physical machine ghost software

             Clonezilla has been practiced ok

  3.2 Linux physical machine virtualization software

             ​ ​ ​ ​ ​VirtualBox ​VBoxManage command ​​reports an error during practice, try again later

4. Backup and restore process (Clonezilla)

   4.1 Download

          Clonezilla download

   download link:

https://clonezilla.org/downloads/download.php?branch=alternative

   Introduction to Reborn Dragon 

使用Clonezilla("再生龙")对Linux系统硬盘进行镜像和克隆
Clonezilla和Tuxboot简介
Clonezilla 是一个很好的 系统克隆 工具,它可以说是吸取了 Norton Ghost 和 Partition Image 的优点。即不仅支持对整个系统进行克隆,而且也可以克隆单个的分区,这种灵活性可能更能适应备份者的需要。


Clonezilla详细说明
Clonezilla是一个用于Linux,Free-Net-OpenBSD,Mac OS X,Windows以及Minix的分区和磁盘克隆程序。它支持所有主要的文件系统,包括EXT,NTFS,FAT,XFS,JFS和Btrfs,LVM2,以及VMWare的企业集群文件系统VMFS3和VMFS5。Clonezilla支持32位和64位系统,同时支持旧版BIOS和UEFI BIOS,并且同时支持MBR和GPT分区表。它是一个用于完整备份Windows系统和所有安装于上的应用软件的好工具,而我喜欢用它来为Linux测试系统做备份,以便我可以在其上做疯狂的实验搞坏后,可以快速恢复它们。

Clonezilla也可以使用dd命令来备份不支持的文件系统,该命令可以复制块而非文件,因而不必在意文件系统。简单点说,就是Clonezilla可以复制任何东西。(关于块的快速说明:磁盘扇区是磁盘上最小的可编址存储单元,而块是由单个或者多个扇区组成的逻辑数据结构。)

​ 

clonezilla-live-20230426-lunar-amd64.iso 

  4.2 Burn USB boot disk 

        4.2.1.Ulstra is installed in advance  

                   If there is no Baidu installation, the trial version is enough

        4.2.2 Production process

                  

Specific operations for making a boot disk from a USB flash drive:

  Step 1. Make a boot disk from the USB flash drive. First, right-click the UltraISO icon and "run as administrator".

    

[Create boot disk from USB disk] Step 1

  Step 2. Open the UltraISO window and click "File" - "Open" in the upper left corner.

[Create boot disk from USB disk] Step 2

  Step 3. Browse to the directory where the image file is stored, select the target file, and click the "Open" button.

 

[Create boot disk from USB disk] Step 3

  Step 4. Then return to the UltraISO window again, click "Start" in the menu bar and select "Write Hard Disk Image".

[Create boot disk from USB disk] Step 4

  Step 5. Next, click the "Write" button directly in the pop-up window (Note: Select the writing method as "USB-HDD+". If it is not this mode, the computer may not be able to start normally through the USB disk.)

​ 

[Create boot disk from USB disk] Step 5

  Step 6. Please wait for a moment while the image file data of the installation system is being written to the USB flash drive.

[Create boot disk from USB disk] Step 6

  Step 7. After the writing is completed, a removable storage device will be created in the computer window.

[U disk creation boot disk] completed
 

4.3 Use Reborn Dragon to backup Linux  

    4.3.1 View ubuntu

       It shows that there is actually not much difference between centos and ubuntu. Let’s take ubuntu as an example for now.

           

  Use dr -H to check the partition and usage. Use lsblk to check the hard disk and partition.  

   Be aware of it so that you will not be confused when you use Clonezilla to back up and restore, and know yourself and your enemy.

4.3.2 Insert the USB boot disk (Clonezilla)

     My computer is HP F10. Enter bios and find the USB hard drive and move it to the front.

 Here (different computers may have differences, please analyze the specific situation)

 After saving bios and automatically restarting

Reborn dragon starts

4.3.3 Start backup

      

The choice of What to do, we are Backup or Restore is the default choice

  

   Here you need to find another USB flash drive or mobile hard disk that is large enough for backup storage.

(Special considerations: In the past, ghosts on windows could be stored on the current system disk, and then restored when the system failed. The one-click restoration is quite suitable, but Linux hard disk partitioning is a bit complicated. It seems to be divided into at least multiple partitions, so that is It is said that if you restore, you must change the partition of the current hard disk, so in this case, how to find the original files from the current partition, it is obviously a no-chicken, no-egg model), so we simply prepare an external hard disk Or a large USB disk. Provide amout during the execution of Reborn Dragon

  List the current hard disk and USB disk (we used df -H lsblk to check our hard disk before, so it is clear that the first two are the two partitions of the hard disk we want to back up, and the third one is the one we just inserted. A large USB disk to store the backup files of Reborn Dragon)

   Although the system hard disk we want to back up has a capacity of 1T, the actual file usage rate inside is not high. For example, the largest partition of 888G only uses 5%, so our 500G large U disk should definitely be enough.

 Open below

 

 

 

 

 

 

 

 

 

 

 Backup is done, remember to power off here 

After confirming that the shutdown is successful

Then unplug the startup disk (Regeneration Dragon USB disk) and the storage disk of the backup file.

Reboot the original system and it will be normal

View the backup file in another computer window

 

  Backup file Clonezilla ("Reborn Dragon") backup file.

  We can copy it to a server with a larger capacity and archive it for subsequent use

4.4 Destroy the current system

      In order to demonstrate the restoration of Reborn Dragon, we will use the centos7 boot disk to overwrite the current ubuntu20.04

   

 After the centos 7 boot disk is inserted, the installation will fail by default. However, we can find the drive letter address that needs to be modified through the above

 The above is the interface where we usually start the normal installation after entering the modification again.

 

 

  

Delete the original partition (there have been worries about whether the partition can be restored normally after being deleted in this area, but when restoring afterwards, we found that the partition was regenerated and could restore the original backup, so we didn’t worry about it anymore) 

 The installation is complete, that is, the original operating system is also hard damaged.

4.5 Restore backup files

     4.5.1 Insert the USB boot disk (Reborn Dragon)

                  Clonezilla ("Reborn Dragon") USB boot disk

    Set bios and enter as follows after startup:

   

 Backup and restore is a menu

 

Insert the hard drive backed up by our original ubuntu system using Reborn Dragon

 

 Select our restore file

  confirm

Choose again 

  Whether to check before restoring

   Check it out so you don’t have to come back again

Start restore check

 

 Restoring, heartbeat speeding up, must be successful!

 Looks like a success!

Check completed

   After the inspection is completed, ask if it is really restored? Sure, we enter y

 

 ok success poweroff shutdown 

Unplug the USB boot disk and backup disk  

Restart the computer and check whether it is restored to the previous system.

 5. Summary

        In this regard, the backup and restore of the linux operating system using the recycled dragon will be completed. At the same time, I hope to help everyone. In the future, it will record the process of physical machine virtualization. Please pay attention.

Guess you like

Origin blog.csdn.net/wyj372/article/details/132020701