Linux OS Backup: Using LVM snapshots for online backup of Linux operating system data

Source: Internet
Author: User

Here we discuss the backup of the Linux operating system.
In the production environment, customers will be required to do a system-wide data backup for a recovery after a system crash. This includes backup recovery of operating system data.
As a production environment, customers will require backup uninterrupted business, that is, online backup.

Today we present a way to implement online backup of Linux operating systems using LVM snapshots.

The simple principle of using LVM to implement the online backup of the operating system is that LVM is the volume management software with Linux, LVM supports snapshots, and Linux supports the LVM volume as the operating system partition, so it can use the snapshot function of LVM to realize the online backup of the operating system.

1. Zoning planning

The above principle says that the LVM snapshot backup operating system requires that the operating system partition be installed on the LVM volume, so you need to plan the partition.
We follow a simple example: we have a 300G hard drive to install the operating system, only one root partition, then the partition is as follows:

Attention:
1)/boot,/swap cannot be created on an LVM volume. However, the/boot,/swap does not need to be backed up, so this does not affect the backup.
2) The size of the root partition needs to include the amount of space the snapshot occupies. It will be used later when installing the operating system.

2. Operating system Installation

Operating system installation requires that the partition to be backed up (this is the root partition) be created on top of the LVM volume (LV), and that the other installation process is the same as the normal installation. SuSE's Autoyast tool supports this feature, and you can search online.

When installing an operating system to create an LVM volume, pay attention to two points:
1) The VG needs to reserve the space for the snapshot itself, not all of them are fully occupied.
2) The VG in which the snapshot resides must be the same as the LV being backed up, that is, the location of the snapshot must be stored on the same VG as the volume being photographed. Otherwise, the snapshot fails.

3. Operating system Snapshot Backup

Once the operating system is installed, you can start backing up the operating system. The Backup method is:
1) Execute the snapshot at the time the operating system is running T1.
2) Start performing a backup of the snapshot. The backup operation is simple, which is to mount the snapshot and copy it.
3) At this time, the T2 moment, then, the snapshot record the data changes in the t1~t2 time period, in the case of copying snapshots, to obtain the latest data; if there is no change in the data, the copy snapshot is equivalent to copying the original file.

4) After the snapshot has been copied, the operating system backup is complete. Repeat this operation the next time you need to back up.

4. Operating system Recovery

When the backup is restored, the recovery of the operating system is no different from the normal backup package: Unzip the backup partition to the corresponding partition.

The use of snapshots for online backup of the operating system, can be better to maintain the consistency of the file, do not miss the backup time window changes in the data. But the disadvantage is also obvious, need to use LVM to install the operating system, operation is relatively complex. You have to combine your own project tradeoffs before using them.

Reprint: http://www.tektea.com/archives/2140.html

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.