"Essay" Linux Server Backup related

Source: Internet
Author: User

The security of server data has always been the most serious of the server's daily management. Linux Server virtualization is known for its highly reliable operating systems, although system failures can still occur. May be due to hardware failure, power outages, or other unforeseen problems. More commonly these problems come from human errors, improper changes, or even deletion of important files.

Restoring a server system by backup is the least expensive way to fix a server error when a problem occurs on the server that is not functioning properly. As a Server Manager, it is important to understand the various server backup scenarios and how to selectively implement backup scenarios in a variety of situations.

Three ways to first describe server data backup: Full, differential, and incremental

  1. Full backup

Backs up all selected folders, and does not rely on the archive properties of the files to determine which files to back up. During the backup process, any existing tags are purged and each file is marked as backed up. In other words, clear the archive property.

A full backup is a complete copy of all data or applications at a given point in time. In practice, a full backup of the entire system, including the system and all data, is done with a single tape. The biggest benefit of this backup approach is that you can recover lost data with just one tape. Therefore, the recovery time of the system or data is greatly accelerated. However, its disadvantage is that the backup data in each full backup tape has a large amount of duplicate information, and because the amount of data that needs to be backed up each time is quite large, the backup takes a long time.

 2. Differential backups (differential backup) 

Backs up data that has changed since the last full backup. During a differential backup, only those selected files and folders that are marked are backed up. It does not clear the tag, which is not marked as a backed up file after backup. In other words, the Archive property is not cleared.

A differential backup is a backup of files that are added or modified during a full backup to a differential backup during the time period. When recovering, we only need to recover the first full backup and the last differential backup.

  3. Incremental backups (Incremental backup)

Backs up data that has changed since the last backup, which contains a full, differential, incremental, backup. During an incremental backup, only the marked selected files and folders are backed up, and it clears the tag, either: Mark the file after backup, in other words, clear the archive attribute.

Incremental backup means that after a full backup or a previous incremental backup, each subsequent backup is only required to back up the files that were added and modified by the previous one. This means that the object of the first incremental backup is the addition and modification of the file that is produced after the full preparation, and the second incremental backup object is the addition and modification of the file resulting from the first incremental backup, and so on.

Through the above concepts we can find that differential backups differ from incremental backups in that they are backed up by different reference points: The reference point of the former is the previous full backup, differential backup, or incremental backup, the latter reference point is the last full backup.

Here are two options to choose from:

  1. Full backup combined with differential backup (recommended)

Taking the weekly data backup plan As an example, we can make a full backup in Monday and make a differential backup from Tuesday to Friday. If the data is destroyed in Friday, then you only need to restore the Monday full backup and the Thursday differential backup. This strategy takes more time to back up the data, but less time is used to restore the data.

  2. Full backup combined with incremental backup

Take a weekly data backup as an example, make a full backup in Monday and make an incremental backup from Tuesday to Friday. If the data is corrupted in Friday, then you need to restore the Monday normal backup and all incremental backups from Tuesday to Friday. This strategy requires less time to back up the data, but it takes more time to restore the data.

So we started thinking about selective backup data.

Server virtualization through the abstraction of the server's physical resources into logical resources, so that a server into several or even hundreds of isolated virtual servers, CPU, memory, disk, I/O and other hardware into a dynamically managed "resource pool" to improve resource utilization, simplify system management, achieve server consolidation, Make it more adaptable to changes in the business, resulting in more applications.

Currently the most used server virtualization vendors provide VMware Data Recovery for Vmware,vmware VMs to back up virtual servers, and of course, you can use the snapshot feature of the virtual machine to save a state of the server, so that when a server problem occurs, Ability to restore the recovery server state.

There is also a method that is not related to the virtualization of the machine itself, but to the system. In a Linux server, you can use the "tar" command to back up your system and data. In fact, the "tar" command is a process of compressing/decompressing.

You can view the description of the tar command through the man command or--help:

  

Here is a generic instruction for backing up the root directory, which needs to be changed according to the situation:

Tar cvpzf backup.tgz/--exclude=/proc--exclude=/lost+found--exclude=/backup.tgz--exclude=/mnt--exclude=/sys

which

Cvpzf means creating a compressed document, giving it permission to save, and compressing it using "gzip" mode. If you want to compress in "Bzip" mode, you can replace "Z" with "J": "Cvpzf" and "CVPJF".

Backup.tgz represents a new backup.tgz file as a compression vector in the current directory

/Indicates the backup directory is the root directory "/"

--exclude= "xxx" means that if you do not want to back up a file or folder xxx, you can use "--exclude= ' xxx '" To remove the directory from the backup directory

The restored commands are:

Tar Xvpfz backup.tgz-c/

If you back up using the "Bzip" method, the command is:

Tar xvpfj backup.tar.bz2-c/

"Essay" Linux Server Backup related

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.