[linux-lvm] LVM snapshot: in memory COW table

Stuart Gathman stuart at gathman.org
Thu Jan 26 00:50:45 UTC 2017


On 01/25/2017 09:38 AM, Mike Snitzer wrote:
> On Wed, Jan 25 2017 at  8:46am -0500,
> Francois Blondel <fblondel at intelliad.de> wrote:
>
>> Hi all,
>>
>> We currently use LVM snapshot as a solution to backups block devices.
>> The snapshot is not active for a long time, only for the time during
>> which we need to upload the backup to the backup server.
>>
>> As I could read, for example here: http://www.nikhef.nl/~dennisvd/lvmcrap.html
>> snapshots multiply the IO needs of the origin Logical Volume.
>> We would like to avoid that.
> The old dm-snapshot target has "transient" snapshot store already.
> See drivers/md/dm-snap-transient.c
>
> Use of transient isn't going to change the fact that you'll still need N
> snapshot stores; and that any write will trigger an N-way copy-out
> penality when N snapshots of the origin exist.  All you'd be doing with
> transient is getting implicit improved performance of memory speeds.
The transient snapshots seem to only store metadata in memory.  I think
what OP is proposing is to allocate, say, 2G of ram for the snapshot,
instead of allocating a 2G snapshot LV on disk.  The snapshot would
simply disappear if the system crashes or reboots. 

You could kludge this up now by adding a ramdisk PV to the volume group,
somehow avoid allocating normal LVs on the ramdisk PV, and force the
selected snapshot to be allocated on the ramdisk PV.   Adding the
ramdisk to the VG immediately before allocating the snapshot on it (and
using up all the extents) would prevent normal LVs from getting
allocated on it.

The drawback to the above kludge is that on crash or reboot, the ramdisk
PV will be gone - requiring an extra step to remove it from the VG and
undo the snapshot remapping.

A special "use me for snapshots only" flag for PVs would be one way to
start implementing it.





More information about the linux-lvm mailing list