resize lvm partition (NOT: resize logical volume)

Asked by Hans van den Bogert

How do I resize the lvm partition. And I don't mean resizing a physical volume, volume group or logical volume.

scenario
I had a lvm which spanned a whole disc with exception of a 100mb boot partition.

Now i wanted to add a legacy primary partition for a non linux OS (nice euphemism :P )

So I did:
- resize the ext3 partition with (g)parted
- resize the physical volume (because the volume group already had enough free extents)
and now?
The physical volume, in my case /dev/sda3 should have free extents, and it does shows this with
$pvs
!
Yet fdisk/parted does not show free space in my partition table.
Now some site says this is achievable with fdisk, by deleting
the partition and next recreating the partition with less cylinders.

This does work! (I've tested it with my boot partition which I didn't care about if I'd lose the data)

But I always thought that with cropping cylinders of a partition you run the risk of cutting data of the partition because free space doesn't necessarily be at the end of a partition.

Am I right about this? Or are the free extents always on the end of the raw partition?

long story thanks for reading

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Theodotos Andreou
Solved:
Last query:
Last reply:
Revision history for this message
Theodotos Andreou (theodotos) said :
#1

That is true. So you need to know the exact number of units the resized ext3 and physical volume is, and adjust the partition table accordingly with fdisk or cfdisk.

Revision history for this message
Hans van den Bogert (hbogert) said :
#2

what part is true?
that freespace is at the end of a partition when altered with resize2fs and pvresize ?

thanks

Revision history for this message
Best Theodotos Andreou (theodotos) said :
#3

That you need to delete the partition and recreate it with different boundaries.

Revision history for this message
Hans van den Bogert (hbogert) said :
#4

Thanks Theodotos Andreou, that solved my question.