Article 57GFV LVM2 : Extending underlying PV's partition

LVM2 : Extending underlying PV's partition

by
dezix
from LinuxQuestions.org on (#57GFV)
Hi!

On a system (Debian) freshly installed on a msdos PT disk with full single ext4 part sda1 (no having other choice),
I start resizing sda1 to 2G and then creating with fdisk a primary sda2 on the free space.

Assuming fdisk creates sda2 with Linux type (83) by default,
then
I create a PV on sda2 (without creating ext4 fs on sda2 first),
after what,
I create a VG with a full set of LV's full-fitting my needs with ext4 fs on them.

At this point, I move system files toward LV's, excepted /boot content moved on sda1.

fstab is edited to mount sda1 on /boot and LV's where they have to.

grub-install in a chroot

reboot works fine !

Now as /boot doesn't need more than 200M, sda1 is reduced to that size.

This freed (1.8G) space I want to add it to my PV on sda2
(to avoid a miss-numbered and unnecessary sda3 between sda1 & sda2).

First I've done the job on a training VBox with GParted in a Live Session => it works !

But in the true life (not VBox) I can't use GParted so I have to do it only with commands.

GParted before to move/resize a part used as PV,
needs "desactivate" it in part's options then there is no difficulty to resize as usual.

Seems that is achieved with :

lvchange -a n vg0

I've tried that way it works following with GParted

I've tried vgchange -a n vg0 too, getting an issue with GParted

GParted doesn't report detailed commands about how it extends/moves sda2
the only I can see, is that it spends time copying/moving datas.

GParted reports only the following commands at the end of its process :

Quote:
lvm pvck -v '/dev/sda2'

lvm pvck -v '/dev/sda2'

lvm pvresize -v '/dev/sda2'


So I've tried :

Code:lvchange -a n vg0

parted /dev/sda resizepart 2 100%

lvm pvck -v '/dev/sda2'

lvm pvresize -v '/dev/sda2'
but it doesn't change nothing at all !

So, should be kind if someone could show me where I'm wrong with that commands, thankslatest?d=yIl2AUoC8zA latest?i=y__wero6d4M:A12lpalE3K8:F7zBnMy latest?i=y__wero6d4M:A12lpalE3K8:V_sGLiP latest?d=qj6IDK7rITs latest?i=y__wero6d4M:A12lpalE3K8:gIN9vFwy__wero6d4M
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments