Use the snapshot feature of LVM to implement almost hot backup of data

Source: Internet
Author: User

Use the snapshot feature of LVM to implement almost hot backup of data

The snapshot function of LVM can record information at a certain time point to the snapshot area. Therefore, you can use this feature to completely back up data. Then, the new data can be incrementally backed up and restored using the binary log file. Therefore, data can be almost hot-standby in this way.

Use LVM snapshot for Database Backup

To use the snapshot feature of LVM for almost hot backup, the following conditions must be met:

1. Data Files must be on logical volumes

2. The volume group of the logical volume must have enough space to store the snapshot volume.

3. data files and transaction logs must be on the same logical volume.

The implementation steps are as follows:

1. open the session, apply a read lock, lock all tables, and execute log scrolling.

Mysql> flush tables with read lock;

Mysql> flush logs;

2. Open another terminal to save binary log files, locations, and other information.

$ Mysql-uroot-p-e 'show master status \ G'>/path/to/

3. Create a snapshot volume

# Lvcreate-L #-s-p r-n LV_NAME/path/to/source_lv_NAME

4. Release the lock

Mysql> unlock tables;

5. Mount the snapshot volume and copy the data in it

# Mount/path/to/LV_NAME/path/to/dir/

# Cp-a/path/to/dir/*/path/to/otherdir/

6. delete a snapshot volume

# Umount LV_NAME

7. Incremental backup of binary log files

8. Disable the binary log function when restoring binary log files.

Mysql> set global SQL _log_bin = 0;

-------------------------------------- Split line --------------------------------------

Disk management-LVM

Linux Tutorial: Use LVM logical volume manager to manage flexible storage

Configure LVM (logical volume management) in CentOS 6.3)

Linux LVM (Logical Volume Manager) Study Notes

LVM-snapshot: LVM snapshot-based backup preparation

LVM-snapshot: LVM-based snapshot Backup

RHEL5.9 LVM usage

-------------------------------------- Split line --------------------------------------

This article permanently updates the link address:

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: 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.