[Novalug] LVM Snapshots

Peter Larsen plarsen@famlarsen.homelinux.com
Sat Dec 18 23:26:57 EST 2010


On Sat, 2010-12-18 at 22:34 -0500, James Ewing Cottrell 3rd wrote:
> Thanks for the answer, but you really didn't TELL me anything.

I'm pretty sure I did; at least that was the intention.

> When you make a snapshot, the UUIDs are the same too. 

Ahhh - no. But I think I understand what's going on now. I think you've
been focused on the file-system configuration on the volume. Not the
volume itself. Try NOT using the file system at all when using LVM to
identify the volume. Use the volume ID (UUID) instead. This will change
and be different from the master volume. 

As American Dave points out, the UUID on the volume does indeed change.
But you're right too - the UUID of the file system does not. So - don't
use the file system UUID. Don't use the file system label. Not with LVM
at the very least.

> And it's a lot more intuitive to change labels (e2label) than it is to
> change UUIDs. 

Intuitive maybe. But since you're looking for uniqueness a very bad idea
to use labels. 

> I have done it before, but I'd have to look it up. Besides, I
> generally make my labels the same name as the LV, and since I usually
> have only one VG, they *are* unique.

You can definitely define them as such but there's no guarantee by the
system they're unique. If you follow my advice above, you'll never
encounter problems when managing volumes vs. how/where to mount them.

> Yes, snapshots are essentially copy-on-write co-dependent filesystems.

It helps thinking about how the snapshot is implemented to understand
it's possibilities. In essence you're creating a file for each snapshot
(not a file system file) which contains a block change list and the
changed blocks. When you access your snapshot, if the block being
requested is not found in the snapshot log, the original block is
returned. Otherwise it's returned from the snapshot log.

This should then bring you to your next question - about when to use
snapshots. And unfortunately the answer is "it depends". And I thought I
covered that in my original answer.

> But my question still remains....Is It OK to run off a snapshot'ed
> filesystem assuming I wanted to do that?

Remember, as you create snapshots it requires an additional write IO per
snapshot. One to access the snapshot list and/or access the original
block, and one to write the new block. So as you add additional
snapshots your write performance degrades. If you're mostly RO there's
really no penalty. But if you have your swap defined as a snapshot
expect a very slow system indeed.  So you have to consider the nature of
the system before being able to answer your question. 

If you use the snapshot to store the original state, this is indeed what
will happen. One to store the old block (or a pointer to it) - one write
to write the new one.

-- 
Best Regards
  Peter Larsen

Wise words of the day:
Hey, what do you expect from a culture that *drives* on *parkways* and
*parks* on *driveways*?
		-- Gallagher
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <https://lists.firemountain.net/pipermail/novalug/attachments/20101218/80237ca8/attachment.asc>


More information about the Novalug mailing list