[linux-lvm] faster snapshot creation?

Zdenek Kabelac zkabelac at redhat.com
Wed Feb 26 10:01:26 UTC 2020

Dne 25. 02. 20 v 22:35 Eric Toombs napsal(a):
> I tried thin pools and got the same snapshot creation time, about .45s.

As it has been said - lvm2  is NOT only sending couple ioctl() to create snapshot.

Every lvm2 command essentially does a full system validation with respect to 
currently configured set of metadata - this exec-time  by faaaaaar exceeds
the actual snapshot creation time.
(Also snapshot monitoring is pretty 'time expensive' operation on its own)

> I also tried creating the entire vg in memory with losetup and that
> didn't change the creation time either.

lvm2 was never optimized towards 'hyper fast' manipulation with a single 
device - after all you are impacting your system resources in a major way - 
thus couple milliseconds here and there for majority of users doesn't really 

What is the most important in terms of speed is the 'minimal' delay which can 
be observed on origin being in use (aka 'suspend-resume' time-frame of origin 
takes short amount of time to block actual usage of the origin device - user 
should not see big latency...)

If you are aspiring of creating tens of snapshot per second - you probably 
have very unusual workflow/requirement and mostly likely lvm2 is not the right 
tool for such task ATM.

There used to exist 'slight' optimization where lvm2 executed as 'lvm shell' 
(so you basically stream lvm command though a pipe to such lvmshell) was 
'sharing' some cached content between runs of individual commands - but this 
was mostly lost and most likely would not squeeze a lot the time you refer.

So my advice - if you really need to use and create old snaps in very fast way 
is to developed your very own tool working in you restricted environment where 
you  might probably not care about meta/data consistencies, deal with speed of 
udev and gazillion other issues - you can run your small 'ioctl()' stream much 
more efficiently.

On the other hand it's well beyond my imagination what is good for 'very fast' 
creation of a snapshot when the overall performance of the system is then 
degraded by 50% or more...  but user can choice...


More information about the linux-lvm mailing list