Technical Blog | 技術博客

易,窮則變,變則通,通則久。是以自天佑之,吉無不利。

[Original] Recovery Linux system (Recovery backup, Protection data, Server migration)

Introduction

In many cases, we need to back up our Linux system and recover it. For example: machine migration, data backup, load balancing.

The current article mainly helps you to restore your Linux system. If you need to back up your system, please click here.
[Original] Backup Linux system (Recovery backup, Protection data, Server migration)

I will use CentOS 7 to demonstrate how to back up a complete system.

It is recommended to use [Original] Network one-click Reinstall CentOS 7 (Official, Pure, Safe, Efficient) system. Because of this system, I optimized the full system migration.

The system I recommend allows you to restore a full system backup between different servers. If it is not my recommended system, you can only restore your server system backup on the same server, otherwise an unknown error may occur.

Let’s start restoring a full system backup

1. Enter recovery mode (recommended) from your service provider’s management panel.

Recovery mode will give you an independent operating environment, more stable. Of course you can also back up in normal mode, but I can’t guarantee that there will be no problems

2. Prepare the backup environment

①. Install LVM Disk Manager (if you have not installed it yet)
yum install lvm2 (CentOS) Or apt-get install lvm2 (Debian/Ubuntu)

②. Activate the LVM volume
vgscan
vgchange -a y centos

3. Start recovering the system now

①. Restore /boot partition (Standard disk)
su
cd /root/
mkdir /resysbak_boot/
mount /dev/sda1 /resysbak_boot/
*You need to upload the backup file [linuxbackup_boot.tgz] to the directory [/resysbak_boot/]
cd /resysbak_boot/
tar xvpfz linuxbackup_boot.tgz -C /

②. Restore / Partition (LVM disk)
su
cd /root/
mkdir /resysbak/
mount /dev/centos/root /resysbak/
*You need to upload the backup file [linuxbackup.tgz] to the directory [/resysbak/]
cd /resysbak/
tar xvpfz linuxbackup.tgz -C /

③. If you backed up other partitions, you need to restore them in the same way as above.

You need to understand

1. Some of the code may require you to modify it to your own disk, you must have the basic capabilities of Linux.
2. Complete system transfer testing between different servers on Online.net and Woot.
3. Data is priceless, so we must back up the data frequently. Back up your data in a variety of ways.
4. Operation is risky, I only provide such a solution, I am very happy to help you. You need to take responsibility for your operation.
5. Migration between different servers is only available for my recommended system.
6. On the same server for recovery, you only need to follow the recovery process.
7. For migration between different servers, you need to follow the steps below.

①. Install my recommended system on the new server.
[Original] Network one-click Reinstall CentOS 7 (Official, Pure, Safe, Efficient)
②. Complete the partition and the same partition as the backup. Ensure that the recovery partition space is larger than the backup file size.
[Original] How to expand Linux hard disk (LVM Disk)
③. Enter recovery mode and follow the recovery tutorial.

Next, you may have two goals to do.

1. (Optional) Delete the backup file on the current system and reboot into normal mode. Because your backup files are already in a safer place.
Your backup file is located
/resysbak/linuxbackup.tgz
/resysbak_boot/linuxbackup_boot.tgz
And other partition backup files that you create yourself.

2. Create a new system backup
[Original] Backup Linux system (Recovery backup, Protection data, Server migration)

Now you have completed the full Linux system restore.

[Technical Blog | Technology Blog] Telegram exchange channel: https://t.me/me_share (TG discussion group please pay attention to TG channel top message)

This article was posted on the [CXT] Technical Blog | 技術博客, if you need to forward the share, please indicate the source.

[Original] Recovery Linux system (Recovery backup, Protection data, Server migration)

点赞