After the new server (or new hard disk) is installed with the linux system, shut it down, and then use the old hard disk as the disk from the disk to the new server, and boot into the new server (or new hard disk) system.
First look at the partition information of the existing system:
df -Th
Pay attention to the size of /dev/mapper/***-root in order to distinguish the data partition of the old hard disk
Then look at all disk (hard disk) information:
fdisk -l
Generally /dev/sdb (may be other names) is the old hard disk
Generally /dev/mapper/***-root is the data partition of the old hard disk (pay attention to distinguish the data partition of the existing system, all named /dev/mapper/***)
It is assumed that the old data disk is /dev/mapper/centos-root
Create mount directory 2 (it can be other directory names):
mkdir -p /2
Hang the data disk of the old hard disk to the created 2 directory:
mount /dev/mapper/centos-root /2
Check if the mount is successful:
df -Th
In this way, you can access /2 to copy and back up the data in the original hard disk
If the data disk of the old hard disk needs to be unloaded after the data is processed:
umount /2
Note 2 should be adjusted to your actual mount directory name
Since the old hard disk has data, it is recommended that the customer handle it by himself. When we need our help, please explain to the customer. During the mounting process,
We are irresponsible for data loss due to improper operation, and we will help with the customer's consent.