Technical Blog | 技術博客

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

[Original] Backup 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 backup your Linux system. If you need to restore your system backup, please click here.
[Original] Recovery 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 backing up the full system

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. Now start backing up the partition

①. Backup /boot partition (Standard disk)
su
cd /root/
mkdir /resysbak_boot/
mount /dev/sda1 /resysbak_boot/
cd /resysbak_boot/
tar cvpzf linuxbackup_boot.tgz --exclude=/resysbak_boot/linuxbackup_boot.tgz /resysbak_boot/

②. Backup / Partition (LVM disk)
su
cd /root/
mkdir /resysbak/
mount /dev/centos/root /resysbak/
cd /resysbak/
tar cvpzf linuxbackup.tgz --exclude=/resysbak/linuxbackup.tgz /resysbak/

③. If you have other disks, please follow the above method for backup.

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. Download your system backup file. Save in other safe places.
Your backup file is located
/resysbak/linuxbackup.tgz
/resysbak_boot/linuxbackup_boot.tgz
And backup files for your other partitions.

2. Restore your system backup
[Original] Recovery Linux system (Recovery backup, Protection data, Server migration)

Now you have completed the full Linux system backup.

[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] Backup Linux system (Recovery backup, Protection data, Server migration)

点赞