Re: lvm: creating a snapshot
Don Armstrong <don@debian.org> writes:
> On Tue, 07 Oct 2014, lee wrote:
>> Don Armstrong <don@debian.org> writes:
>> > Doesn't matter. It just has to be a block device that you can add as
>> > a physical volume to the volume group.
>>
>> Isn't a logical volume of a volume group "just" a block device? The
>> VMs have their LVs as block devices just fine.
>
> Sure.
Ok, so I could abuse the swap partition for this. How would I remove
the swap partition from the VG once I've made and backed up the
snapshots?
>> > This is actually one of the many reasons why lvm is awesome. You can
>> > migrate whole servers from one set of drives to another with no
>> > downtime by using vgextend/pvmove/vgreduce.
>>
>> Provided that you have free space on your disks?
>
> You're swapping drives, so presumably one whole set of drives is empty.
Well, who can afford that? Someone who can doesn't need to swap drives.
>> Besides the swap partition, the only block device I have available is
>> a LVM logical volume which belongs to a different VG than the VG I
>> want to backup LVs of.
>>
>> The logical path would be to add the free LV from the other VG to the
>> VG that has LVs which I want to make snapshots of in order to back
>> them up because that's the only available block device.
>
> On Tue, 07 Oct 2014, lee wrote:
>> Can I merge multiple volume groups into one?
>
> Yes, using vgmerge, assuming one of the VG is inactivated.
Ok, I could do that. And apparently I could split the VG once I'm done.
How do I merge VGs that have different extent sizes?
VG Name vg_mydata
PE Size 256.00 MiB
VG Name vg_guests
PE Size 16.00 MiB
>> The VG is like this:
>
> [...]
>
> Lets back up here. What is the output of sudo pvs; sudo lvs; sudo vgs; ?
root@heimdall:~# pvs
PV VG Fmt Attr PSize PFree
/dev/sda3 vg_guests lvm2 a-- 36.25g 0
/dev/sdb vg_mydata lvm2 a-- 3.64t 84.00g
root@heimdall:~# lvs
LV VG Attr LSize Pool Origin Data% Move Log Copy% Convert
lv_acheron vg_guests -wi-ao-- 10.00g
lv_charon vg_guests -wi-ao-- 6.00g
lv_gulltop vg_guests -wi-ao-- 10.25g
lv_jarl vg_guests -wi-ao-- 4.00g
lv_jupiter vg_guests -wi-ao-- 6.00g
lv_DATA vg_mydata -wi-ao-- 3.40t
lv_opt vg_mydata -wi-ao-- 32.00g
lv_squid vg_mydata -wi-ao-- 128.00g
root@heimdall:~# vgs
VG #PV #LV #SN Attr VSize VFree
vg_guests 1 5 0 wz--n- 36.25g 0
vg_mydata 1 3 0 wz--n- 3.64t 84.00g
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.
> Do I understand you correctly that you want to snapshot a logical
> volume, but currently don't have the space on the volume group that your
> logical volume is on?
yes
>> It's very well possible that this VG doesn't reside on a partition but
>> on the device itself. How would I convert that into two partitions
>> without losing data?
>
> 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.
> You can't change the underlying partitioning scheme under a physical
> volume which is in use, but if you have enough space, you can migrate
> things out to make a phsyical volume unused.
/dev/sdb is not partitioned. There was no need to do that. 84GB is
free, which is plenty for the snapshots, so it's perfect.
--
Hallowed are the Debians!
Reply to: