0

I think I understand some of the lvm snapshot concept, but am confused about one last thing. After you take the snapshot, if you don't mount it, will it be active? What I really want to know is will it be written to/changed to match changes made to the original? I am confused about the performance hit due to the writes/copys that occur when you have an active snapshot. Does it mean that the snapshot it basically empty/a direct copy of the original until a write operation, and then the original block from the original logical volume is actually written to the snapshot for the sake of being able to revert?

1 Answers1

1

LVM snapshots are block-level snapshots. So whether you mount them or not, they will have the same impact on the performance of your system

They are, as you guessed, copy-on-write snapshots, so they will never change. When a block changes, a copy is made. This also means that initially a snapshot takes up no addditional space, but as time progresses, space used for keeping the snapshot will grow until the snapshot is destroyed (unmounting does not destroy a snapshot).

Also caused by the copy-on-write is the performance hit caused by all this extra copying (writing a single byte may cause an entire block to be read and copied). Depending on your application's behavior, this performance hit may be acceptable or not, or not even visible at all.

Dennis Kaarsemaker
  • 18,793
  • 2
  • 43
  • 69
  • So if I created a snapshot of a logical volume that contains a KVM guest machine (qcow2 format on an ext4 formatted lvm partition), and after taking the snapshot I mount it, and it shows as active, then users install software on that KVM guest and make changes, all of those changes and softare installs will reflect the origin, but the snapshot remains unchanged, and I can use that snapshot to revert back to when it was taken? What does it mean for a snapshot to be active then, if it doesnt mean that it becomes the origin? –  Apr 13 '13 at 20:29
  • When an LVM logical volume (which can be a snapshot) is active it means it gets an entry in under `/dev/mapper/`. It also means that a logical volume can only be mounted when it is active, because no device file exists for it before. – Daniel Dinnyes Aug 31 '13 at 14:32