Http://www.tektea.com/archives/2163.html.
In one of the Linux OS backups: Online backup of Linux operating system data using LVM snapshots, we introduce the method of using LVM snapshot to realize the online backup of operational system, and LVM snapshot can realize the backup of the online operating system data, which means that Complete backup of the operating system data without disrupting the business.
Today we present another way to back up the Linux operating system online by using the tar to copy the operating system partition data and completing the operating system backup.
Before proceeding to the next reading, read this article: "The role of Linux Basics Linux system Directories", this article describes the basic Linux directory and its role, and the following backup will refer to these directories.
One sentence explains how this scenario works: Backup/boot (with grub), backup partition table, backup LVM Volume information (if any) back up system files.
The following are specific:
1. Zoning planning
Before implementing this scenario, you need to plan the partitions before you can back up the partitions by using tar.
2. Backup Data definition
The directories and partitions to be backed up are:
/boot boot boot partition
/etc System Core configuration file
/var system run Directory
/home User Master Directory
/root Root User home directory
/OPT User Program Files
/bin System Executable File
/sbin System Executable File
/USR Program installation directory
Directories that do not need to be backed up:
These directory uses refer to the "Linux basic knowledge of Linux system directory of the role of" This article, this is not repeated in the introduction.
/proc
/sys
/dev
/media
/swap
3. Backup
After the partitions and directories have been defined, start the backup with the following steps:
1) Backup partition table. Executive Fdisk-l >/var/partition.cfg
2) Back up the LVM volume meta data. VGCFGBACKUP-V, the command exports the volume information to a file.
3) Backup/boot partition.
4) Use the tar command to back up all of the partitions and data above.
4. Recovery
To restore the backed up data after the backup is complete, the operating system needs to be rebooted.
You can boot the operating system into single-user mode via CD-ROM, or use the memory operating system to enter single-user mode. Using discs is relatively straightforward.
1) After entering single user mode, the backed up data is attached to the operating system.
2) Create a partition based on the partition table that you backed up.
3) Unzip the/boot partition and restore grub via the Grub-install command.
4) Restore the LVM volume. Vgcgfrestore command.
5) Unzip each directory and partition.
5. Performance impact
The compression of the tar command to back up the operating system data, the operating system to run or have a certain performance impact. This depends on the size of the data and needs to be tested in the actual environment.