Linux Logical Volume Snapshot

A snapshot of a logical volume

Create a logical sequence:
1. creating actual disk partitions or
2. partition into actual physical volume (the pvcreate)
3. The physical volume into the volume group (the vgcreate)
4. logical volume group is converted to ( the lvcreate)
5. The logical volume is formatted and used mount

Increasing the capacity of the logical volume in the order:
1. Create a partition to be added
2. This partition is converted to a physical volume (the pvcreate)
3. added to this physical volume in the volume group (the vgextend)
4. The increase in capacity or PE number,
in order to increase the size of the logical volume (lvresize)
5. the increase in the capacity of this logical file system (resize2fs)

Capacity reduction logical order:
1. First uninstall the logical volume (umount)
2. to perform 'absolute logical path resize2fs -f' of
3 to reduce the capacity of the file system (resize2fs)
4. reducing the number of logical PE the size or capacity of
5. the physical volume in the volume group reduction:
. a first check details of the physical volume (the pvdisplay)
aimed to determine whether to reduce the physical volume are in the
b data if:
the physical volume data moves to the physical volume of PE PE in idle (the pvmove)
C. to reduce the physical volume reduction (the vgreduce)
6. the physical volume into actual this partition (the pvremove)

################################################
1. Create six partitions, each 1.5G
2. use four partitions, create a volume group sunvg, logical sunlv
3. to mount sunlv, mount point / mnt / lvm, and copy / etc, / var / log directory in this mount point

4. Increase the capacity of 3G
5. Reducing the capacity of 1.5G
####################################### #######

LVM snapshot of the system:
Objective: the equivalent of a backup can be used to restore the file system

1. Determine idle the PE (the vgdisplay):
# the vgdisplay
2. If no:
A to create a partition.
B into physical volumes.
C added to volume group.
D LVM snapshots created by using the added capacity.
3. New systems using lvcreate snapshots District
absolute path name of the logical number -s -n snapshot # lvcreate -l PE of

Path snapshot:
name / dev / volume group / snapshot name

  • Snapshots can be mounted use,
  • Content is consistent with the original logical volume content

Time snapshot recovery:
1. Go to the snapshot mount directory (/ mnt / Snapshot):
# cd / mnt / Snapshot
2. compress all the files in the current directory contents:
# tar -jcvf /root/lvm.tar.bz2 *
3. uninstall snapshot mount point :( exit the current directory and then the operation)
# umount / mnt / snapshot
4. deleting a snapshot partition
name # lvremove / dev / volume group / snapshot name
5. uninstall the logical volume:
# umount / dev / sunvg / sunlv
6. the logical format:
# mkfs.ext4 / dev / sunvg / sunlv
7. the logical volume loading:
# Mount / dev / sunvg / sunlv / mnt / LVM
8. the extract the contents of the snapshot to a new hanging carrier point:
# -xf /root/lvm.tar.bz2 the tar -C / mnt / LVM

Published 20 original articles · won praise 18 · views 63

Guess you like

Origin blog.csdn.net/weixin_46575696/article/details/104901081