[linux-lvm] multiple levels of snapshots

Boris Ostrovsky baostr at gmail.com
Thu Apr 26 14:00:08 UTC 2007


At Alasdair suggestion, I am posting to the list steps that I executed
to make this work,
in case someone else is interested in doing something like this as well.

Here is the hierarchy  that I was trying to create:

             base
                |
             child1
              /     \
       child2.1  child2.2
                       |
                     child3

I used 1GB volume for base and gave 1GB to each COW volume (you can give less
than that if you don't expect too many dirty writes):

# lvcreate -L 1G -n base vg
# lvcreate -L 1G -n cow1 vg
# lvcreate -L 1G -n cow2.1 vg
# lvcreate -L 1G -n cow2.2 vg
# lvcreate -L 1G -n cow3 vg
# echo 0 $(blockdev --getsize /dev/mapper/vg-base) snapshot \
/dev/mapper/vg-base /dev/mapper/vg-cow1 p 8 | dmsetup create vg-child1
# echo 0 $(blockdev --getsize /dev/mapper/vg-child1) snapshot \
/dev/mapper/vg-child1 /dev/mapper/vg-cow2.1 p 8 | dmsetup create vg-child2.1
# echo 0 $(blockdev --getsize /dev/mapper/vg-child1) snapshot \
/dev/mapper/vg-child1 /dev/mapper/vg-cow2.2 p 8 | dmsetup create vg-child2.2
# echo 0 $(blockdev --getsize /dev/mapper/vg-child1) snapshot \
/dev/mapper/vg-child2.2 /dev/mapper/vg-cow3 p 8 | dmsetup create vg-child3

If you now mount /dev/mapper/vg-child2.1, you will see contents of
base and child1.
Mounting /dev/mapper/vg-child3 will additionally provide you with contents of
child2.2.

-boris

Alasdair G Kergon wrote:
>
> On Mon, Apr 23, 2007 at 02:54:37PM -0400, Boris Ostrovsky wrote:
> > From what I can see, LVM tools don't allow creating multiple levels of
> > snapshots (i.e. creating a
> > snapshot of a snapshot). Is this a fundamental property of LVM/device
> > mapper architecture
> > or is it that this feature simply hasn't made it to LVM (yet)?
>
> You could indeed set it up outside LVM using dmsetup.




More information about the linux-lvm mailing list