DELL server R230 old disk is replaced with a new disk, and the new disk copies the old disk so the data

background

This requirement is because the service life of the company's server has reached four years, and the content on the server is more important. The disk used for four years has a certain risk of being damaged, so it is necessary to copy all the contents of the old disk to the new disk, and insert the new disk for further processing. Use, unplug the old disk for backup.

The first step is to insert a new disk stage

Disk distribution, I only have 0 and 1 drive letter positions, one is empty, just insert a new disk in the empty position
insert image description here

The second step boot

The third step is disk -l to view the new disk

You can check the size of the disk, and the new disk has no partitions, so you can confirm that it is the hard disk, usually /dev/sdb or /dev/sda

The fourth step is to copy

Command (running in the background, it will return a pid, you can use ps -ef |grep pid to view the running process, if it is still copying, it does not mean the copy is complete): dd if=/dev/sda of=/dev/sdb &
1T data 2022-02-02 16:30 to 8:30 the next day when I went to work and found that the copying was over.
Note: Just plug in the new disk, you can view it with fdisk -l, and you don’t need to mount the partition.

Step 5 After the copy is complete, shut down, unplug the old disk, put the new disk in the old disk position and plug in the line

The sixth step is to boot up and encounter problems:

insert image description here

Solution:
Use commands to repair, need to connect monitor, keyboard

fsck -y /dev/sda1

Can be fixed within 10 minutes
insert image description here

Repair completed:
insert image description here

Finally restarted just fine. It is basically the same as the original running program, but there is a problem that redis in gitlab cannot start.

Solution:

#停掉gitlab
gitlab-ctl stop
#删除文件(最好备份下)
rm -rf /var/opt/gitlab/redis/dump.rdb
#启动gitlab
gitlab-ctl start

Guess you like

Origin blog.csdn.net/qq_40351360/article/details/128880947