LVM snapshots create an exact copy of an existing logical volume. They are useful for backups, application testing, and deploying VMs (Virtual Machines). The original state of the snapshot is kept as the block map.
Snapshots only use space for storing deltas:
- When the original logical volume changes, original data blocks are copied to the snapshot
- If data is added to snapshot, it is stored only there
To create a snapshot of an existing logical volume use this command:
$ sudo lvcreate -l 128 -s -n mysnap /dev/vg/mylvm
To then make a mount point and mount the snapshot run the following command:
$ mkdir /mysnap
$ mount -o ro /dev/vg/mysnap /mysnap
To use the snapshot and to remove the snapshot do:
$ sudo umount /mysnap
$ sudo lvremove /dev/vg/mysnap
Always be sure to remove the snapshot when you are through with it. If you do not remove the snapshot and it fills up because of changes, it will be automatically disabled. A snapshot with the size of the original will never overflow.
No hay comentarios:
Publicar un comentario