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

Re: LVM question



I hope i can ask a question on top of this one,
what if i have a PV which is configured and in use for a while,
but i found out that i forgot to set the pertition type on LVM.

Can i still change this without data loss or risk?
And if i don't will i face issues of another kind?


On Mon, Apr 20, 2015 at 10:33:13AM +0100, Darac Marjal wrote:
> On Mon, Apr 20, 2015 at 09:26:54AM +0200, Petter Adsen wrote:
> > Is it possible to have two VGs on the same PV?
> 
> I don't believe so. The VG is the mapping layer in the LVM stack. It
> maps the LVs to the PVs. If you were to share a PV between VGs, then
> you'd need some way to tell the VGs which parts of the PV they can use
> (letting them battle it out and potentially over-commit the PV is not
> really a good idea). The easiest idea is to split the underlying device
> into multiple PVs (e.g. use partitions).
> 
> > 
> > If so, how can I make a VG with lots of free space smaller? I'm
> > suspecting that the answer to my first question is "no", since this
> > doesn't seem possible from the man pages.
> 
> A quick bit of searching suggests the incantation would be:
>  * Boot from a rescue/live disc
>  * Activate your VG
>  * (You say you've got unallocated space in your VG, so resizing
>     filesystems/LVs won't be covered)
>  * "lvm pvs" should, at this point, indicate some PFree, which is how
>     much you can shrink the PV
>  * Run "lvm pvresize /dev/whatever --setphysicalvolumesize 50G"
>    (Where /dev/whatever is the PV device and 50G is the new size to
>    resize to)
>  * Finally, resize the PV's partition appropriately.
> 
> At this point, you will have a smaller PV and less unallocated space in
> your VG. You can now create another partition, PV that and add it to a
> second VG.
> 
> > 
> > Petter
> > 
> > -- 
> > "I'm ionized"
> > "Are you sure?"
> > "I'm positive."
> 
> 



Reply to: