CentOS 7 System upgrade Backup recovery experiment record

Source: Internet
Author: User

First, the system version

1) CentOS 7.1.1503

2) CentOS 7.2.1511

Second, back up the current operating system with the TAR command

#tar cvpzf/mnt/linuxbackup.tgz--exclude=/proc--exclude=/lost+found--exclude=/mnt/linuxbackup.tgz--exclude=/ MNT--exclude=/sys/

Command explanation:

Tar:linux Common packaging procedures

CVPZF: Is the parameter of tar

C-Create a new document

Output related information during V-processing

P-means keep the same permissions

Z-Call gzip to compress the archive, and invoke gzip to complete the decompression with-X

F-to-normal file operations

LINUXBACKUP.TGZ: The file name to package into

--exclude=/proc: Exclude/proc directory, do not package this directory, followed by the same, remember to exclude the file name of the package itself

/: Means to pack all files of the Linux root directory, of course excluded files are not included

The whole process is understood to mean, create a new file name linuxbackup.tgz compressed file, it saves the file from the specified directory, and save the original permission settings, here you must write down the directory you excluded, restore the need to manually create. Specifically which directories to exclude, this root feel different environment and work need to choose just. After execution wait for a certain time, copy this linuxbackup.tgz to other place, the backup is complete.

The key point is: Do not do anything during the packaging process, otherwise you will modify some files, tar will prompt the error after the backup, recovery is the same.

Third, upgrade the OS version to CentOS 7.2.1511 with the yum command

#mount-T Iso9660-o Loop Xxx.iso/mnt/iso # # #挂载ISO镜像文件至/mnt/iso

#vim/etc/yum.repos.d/centos-base.repo

[Local-source]

name=centos-$releasever-base

Baseurl=file:///mnt/iso

Gpgcheck=1

Enabled=1

Gpgkey=file:///mnt/iso/rpm-gpg-key-centos-7

#yum Clean

#yum update-y

Four, after reboot the system smoothly upgrade to CentOS 7.2.1511

Five, now restore the system to the CentOS 7.1.1503 before upgrade, restore the files we backed up with the tar command

# tar Xvpfz/mnt/linuxbackup.tgz-c/

After the execution, don't worry about the system, remember to create a directory that was excluded at the time of backup, manually created, such as the above we exclude, we need to create

#mkdir/proc

#mdkir/lost+found

#mkdir/mnt

#mkdir/sys

Six, restart the system, found the system boot card in the last step, the graphical interface can not be fully displayed, via SSH connection is also rejected.

Mount the disc, enter rescue mode, mount the hard disk partition to/mnt, and modify the system boot level to 3 (character interface).

#mount/dev/mapper/centos-root/mnt/root

#cd/mnt/root/etc/systemd/system/

#rm Default.target

# Ln-sf/lib/systemd/system/multi-user.target Default.target

# # #systemd使用链接来指向默认的运行级别, determined by the/etc/systemd/system/default.target file.

After reboot, display character user login interface, but user cannot log in, prompt password error.

Nine, start the single user mode, modify the root user password.

1) Start the system and press the E key to enter edit mode

2) in linux16/vmlinuz-3.10.0-229.el7.x86_64 root=/dev/mapper/centos-root rord.lvm.lv=centos/root rd.lvm.lv=centos/ Swap Crashkernel=auto RHGB Quietlang=en_us. UTF-8 Add the following at the end of the parameter line: init=/bin/sh

3) Press Ctrl+x to start the shell

4) Mount file system to writable mode: Mount–o REMOUNT,RW/

5) Run passwd and follow the prompts to change the root password.
6) How to enable SELinux before the system, you must run the following command, otherwise the system will not boot properly: #touch/.autorelabel. Because I am a personal experimental system, I shut down the SELinux directly.

7) Run command Exec/sbin/init to start normally, or restart with command exec/sbin/reboot

Ten, after restarting the successful login through the new password, the system prompts some errors, follow the prompt one by one to perform a command repair success, the execution of StartX start graphical interface successfully, the system has been successfully restored to the CentOS 7.1.1503.

Xi. Restore the system boot level to 5 (graphical interface)

#systemctl Set-default Graphical.target


This article is from "You!" I! All Mortals! "Blog, be sure to keep this provenance http://daibaiyang119.blog.51cto.com/3145591/1733972

CentOS 7 System upgrade Backup recovery experiment record

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.