[Novalug] LVM Snapshots
James Ewing Cottrell 3rd
JECottrell3 at Comcast.NET
Sun Dec 19 01:21:34 EST 2010
On 12/18/2010 11:26 PM, Peter Larsen wrote:
> 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.
OK, I'll blame it on the medium then. How can anyone expect anything of
quality to come out of a phone?
>> 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.
My question was about running on a snapshot; Labels vs UUIDs is a side
> 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.
Yes, I misremembered what I had done. See my followup posting to him.
>> 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.
Labels are as unique as the person who makes them. And yes, I forgot to
change them. But ultimately, grub picked one, and booted off that. And
while that decision may be a surprising one, it doesn't change whether
it was safe or not.
Remember, my complaint was that I lost files from BOTH filesystems! And
while its possible that I simply deleted them, I had that other incident
with snapshots earlier this year. Of course, that one was on top of
Metadisk Mirrors, and Bryan warned against that, altho I never
understood why that was bad.
>> 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.
UUIDs are ugly...they are Numbers...like MAC addresses. I want NAMES
that *I* choose.
>> 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.
You covered very little. Perhaps it all didn't get posted?
And where did you infer anything about Virtual Machines?
>> 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.
The question was "Is It Safe?", not "How Efficient is it?".
And why would anyone snapshot swap space?!?
> 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.
One of the claims of the benefits of LVM goes something like "well, you
can just make a snapshot and experiment, and if it doesn't go well you
can simply come back to your original state". Well, it's a bit more
complex unless you can either  switch to the snapshot or  delete
the original and switch to the snapshot later if things go bad. Reality
is Trickier than the Cool Idea!
More information about the Novalug