[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: lvm: creating a snapshot



Don Armstrong <don@debian.org> writes:

> On Sat, 11 Oct 2014, lee wrote:
>> Well, who can afford that? Someone who can doesn't need to swap
>> drives.
>
> I've upgraded the drive capacity in machines on multiple occasions
> because drives have gotten cheaper... but we don't have enough funding
> to afford replacing the computers at the same time.

Adding some disks is different from swapping them out.  And why would
the computers be replaced to add some disks?

>> How do I merge VGs that have different extent sizes?
>
> Change the extent size using vgchange, and then vgmerge them.

Ah, ok.  LVM is somewhat more flexible than I thought :)

>> The snapshots are to back up guests in vg_guests.  They must go into the
>> free space available in vg_mydata.  Other than that, there's a 16GB swap
>> partition (/dev/sda2) currently used by one of the guests.
>> 
>> Both sda and sdb are logical RAID volumes.  Dom0 is on /dev/sda1.
>> 
>> As you can see, it's a very straightforward and logical set up, except
>> for the swap partition which is way too large for dom0 and thus has been
>> re-assigned to a guest that actually requires it.  The only problem is
>> LVM which doesn't let me make snapshots.
>
> OK. This sounds like you can just disable the swap on /dev/sda2
> (swapoff), pvcreate /dev/sda2; vgextend /dev/mapper/vg_guests /dev/sda2;
>
> Do your snapshots, and whatever else you need, then you can vgreduce
> /dev/mapper/vg_guests /dev/sda2; and reset your swap if you need to.
>
> Alternatively, you can make the physical extents the same (probably
> using vgchange on vg_mydata to make the size 16M), inactivate all of the
> volumes of vg_guests, vgmerge it, and then make snapshots.

Adding the swap partition to vg_guests seems to be the best way.  It's
probably an advantage because when I add it, I can create another LV,
like 8GB, and use that as swap partition for the guest which is using
the partition now.  That would leave me 8GB for snapshots, which should
be enough, and when I don't need snapshots, I can use it to create VMs
for testing purposes, like trying out Funtoo.  I wouldn't need to mix
the data disks with the system disks and would get like 110% usage from
100% resources :)

>> > Volume groups don't reside on partitions or devices. They encompass
>> > physical volumes which do.
>> 
>> Physical volumes do not reside on partitions or devices. They provide
>> them.
>
> This is incorrect. A physical volume (LVM) sits on top of a block
> device, which is usually a partition (or an entire disk).

I meant to say that partitions and devices provide physical volumes.
LVM VGs reside on those, potentially on multiple physical volumes.

I'm somewhat unaware that I refuse to think of logical volumes as
something that stores data.  It's simply not true because the data is
always on the physical device.  No matter how you design the chapters of
your novel, when you remove the pages from the book, you cannot read the
story.


-- 
Hallowed are the Debians!


Reply to: