Extend disk



maelamrani

Member
Credits
323
@f33dm3bits i have a question
For exp if i have a partition with 300 G
And i created a vg with 300 G then i expend the partition with 10G how can i expend the vg with 10 G without create another pv and extend vg with the second partition
 

f33dm3bits

Gold Member
Gold Supporter
Credits
5,879
@f33dm3bits i have a question
For exp if i have a partition with 300 G
And i created a vg with 300 G then i expend the partition with 10G how can i expend the vg with 10 G without create another pv and extend vg with the second partition
I'm not sure I understand you? I will try to explain the correct terminology to you: You partition a disk, you create a physical volume(pv) from that partition, you create a volume group(vg) using a physical volume(pv), you then create a logical volume(lv) in the volume group. You can extend the logical volume(lv) if you have space left in your volume group, if you don't you have to create another partition on your disk or on another disk. You can then create that into another physical volume and add that to the volume group(vg) you want to extend. Once the volume group is extended you can extend the logical volume(lv) of your choice.

So in your example you create a partition of 300G, then you create a physical volume(pv) from that, from that physical volume you create a volume group(vg) so now your volume group(vg) has 300G available. Then you create a logical volume(lv) of 10G in that volume group(vg) ,so now you have a logical volume(lv) of 10G and you have 290G left in your volume group(vg).

Now going back to your question: "How can I extend the volume group(vg) with 10G without creating another physical volume(pv) and extend the volume group(vg) with the second partition.

That doesn't make much sense:
1. You still have 290G left in your volume group(vg) to use to create or extend other logical volumes(lvs)
2. If you do want to extend your volume group(vg), you need to have a partition available, and in order to use that partition in a volume group(vg) it has to be created into a physical volume(pv). So you can't extend the volume group(vg) without having another physical volume(pv), because LVM works with metadata. If the partition isn't created into a physical volume(pv) it doesn't have the lvm metadata so when you would try to add the partition to the volume group(vg) it wouldn't recognize it and it would fail being added to the volume group(vg)

Does that answer your question? If not could you please rephrase your question based on the terminology I just explained.
 
Last edited:

maelamrani

Member
Credits
323
I will explain :
I have an sdc with 300 G
i will a partition sdc1 with 300 G => pvcreate => vgcreate (300G) => then lv it take (300 G)

so i extended the sdc to 400G
then i user parted to resize sdc1 to 400G

how can i extend the VG with 100G that i added to sdc1 ?
there something like vgextend -L +100G ... ???

without using pvcreate again sdc2 (100G)
and vgextend vgname /dev/sdc2
 

f33dm3bits

Gold Member
Gold Supporter
Credits
5,879
Why would you want to resize a partition that is already a physical volume(pv) that is a member of a volume group(vg). That goes against the whole idea of LVM, the whole idea of LVM is that you create new physical volumes from new partitions so that you are then able to extend volume groups and logical volumes without needing to resize partitions. This is because you are able to extend volume groups(vgs) and logical volumes(lvs) while keeping the filesystems online, if you wanted to resize a partition with an existing filesystem the filesystem would have to be offline: LVM Explained
 



Latest posts

Top