[linux-lvm] Snapshot question...

Stephane Chazelas stephane.chazelas at emerson.com
Tue Apr 22 10:47:44 UTC 2008


2008-04-22 06:30:44 -0400, Charles Marcus:
[...]
> So, I have allocated 5GB of 'free space' in my volume group for snapshot 
> use.
>
> What I don't understand is... why am I mounting and then backing up the 
> newly created snapshot volume, if it only contains the *changes* to the 
> volume I really want to backup - which in my case is /var/virtual?
>
> If the snapshot volume is only 5GB, how, by backing up *this* volume, am I 
> backing up over 100GB of data that is in a different volume?
[...]

When you create a snapshot, LVM2 does 4 things:

- it allocates a normal (linear) storage COW (copy-on-write)
  volume of the specified size which you don't normally access directly.
- creates a "snapshot" volume which is a virtual volume that
  allows you to access the frozen version of the snaphost
  volume.

(if it hasn't been done before):
- it dupplicates the original volume as xxxx-real
- it changes the original volume to a be "snapshot-origin" type
  which refers to the "real" volume and the "COW" volume.

When you read from the "snapshot" volume (the one you're backing
up), data that hasn't been modified since the snapshot is read
from the "real" volume and from the "COW" volume otherwise.

When you read from your original volume (that has been changed
to be of "snapshot-origin" type), you actually read from the
"real" volume (the original version of the original volume), but
when you write to it, the system makes sure that unless it has
been done already, the block you're modifying are being copied
first from the "real" volume to COW volume before being modified
in the "real" volume.

So to sum up, the "snapshot" volume you are creating is a
"virtual" volume that is a front end to both the snapshot
storage volume ("COW") and the original real volume ("real").

Hope this clarifies a bit,
Stephane




More information about the linux-lvm mailing list