| LVM Snapshots |
|
|
|
| Written by Tom Hirt | ||||
| Monday, 18 May 2009 13:10 | ||||
Page 1 of 2
LVM Snapshots OverviewContinuing with our LVM how to series, in this KB, we will build on the knowledge from our LVM Configuration KB, and explore logical volume (LV) snapshots. We will show you how to create a LV snapshot which can then be mounted for a backup or some other purpose. Linux administrators typically use LV snapshots for backups. Often times, running a backup can take anywhere from a couple of minutes to several hours (depending on the amount of data to backup.) Depending on how busy your system, from the time the backup begins to the time it completes, some of your files could have changed with omissions to open files. Snapshots provide a means of obtaining a consistent volume (free of changes) in a matter of seconds. The snapshot (which is a exact copy of the LV taken at the time the snapshot command was run) can then be backed-up without the worry of changes to the file system or need to shutdown running databases or close open files. LVM snapshots can only be taken from logical volumes. Non LV partitions cannot have a snapshot taken of them. Snapshots require only a fraction of the space required by the source LV. Behind the scenes, when a snapshot is taken, the source LV is frozen while the changes to the LV are written to the LV snapshot. Thus, the size of the snapshot only needs to be large enough for the anticipated changes to the file system over the lifetime of the snapshot. So in other words, the size of the source LV has no bearing on the size requirements for the snapshot LV, but rather how many changes will be made to the source LV throughout the lifetime of the existence of the snapshot LV. Once the snapshot is removed, the changes logged in the LV snapshot are written back to the source LV. Should a snapshot LV run out of space, the snapshot will be released. One cautionary note with LV snapshots, they are I/O intensive. I have seen I/O performance hits by more than 50% of the snapshot LV while running with a snapshot. Therefore, you should ensure that you do not run with a snapshot LV any longer than absolutely necessary.
|
||||
| Last Updated on Tuesday, 02 June 2009 10:27 |
