[linux-lvm] LVM2 snapshotting and new blocks

Stuart D Gathman stuart at bmsi.com
Mon Jul 23 14:22:29 UTC 2012

Long ago, Nostradamus foresaw that on 07/23/2012 09:27 AM, Fred van
Zwieten would write:
> I have a question. I am used to the NetApp snapshotting
> implementation. These are what I call "new block" aware. This means a
> block is only held in a snapshot when the changed block was already in
> use. This means when new blocks are written they will not get snapped.
> This is a great feature.
> I have done some tests with LVM2 snapshots on Fedora17 and this seems
> not to be the case in the LVM2 implementation. Can someone confirm
> this?
No need for any tests.  That feature requires detailed knowledge of the
filesystem in use.  LVM is filesystem agnostic, and doesn't care what
kind of filesystem you put on your logical volumes. 

Btrfs provides snapsnots with the feature you want - but, of course, you
have to use the btrfs filesystem.

There is a tradeoff.  Being filesystem agnostic means that *any*
filesystem, including one that you just invented and are currently
developing, works.  But there are certainly efficiency gains to be had
from knowledge of and cooperation with the filesystem.

That said, there is currently the DISCARD API, which lets filesystems
tell the underlying block device (including LVM) that we don't care
about a block anymore (which makes for more efficient recycling on flash
devices among other things).

1) can the "new block" feature be implemented by having a filesystem
DISCARDing a block before writing it the first time?

2) failing that, would a NEWBLOCK API that filesystems could use make sense?

More information about the linux-lvm mailing list