Skip to contentSkip to conversation

how to online resize pv?

linux-lvm Stefan Priebe 6 participants 12 messages Jul 30, 2012 – Jul 31, 2012 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

Hello list,

i'm able to resize my block device online. The kernel also shows the correct new size in blockdev --getsize64.

But then i got stuck to extend the pv as i'm unable to extend my partition table without reboot.

Disk /dev/vda: 48,3GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name       Flags
 1      1049kB  2097kB  1049kB               GRUB_BOOT  bios_grub
 2      2097kB  32,2GB  32,2GB               Linux LVM  lvm

If i delete 2 and recreate it starting at the same sector i can't reread the part. table.

Is there a way todo online resizing?

Greets
Stefan

#1 lore raw

partprobe ?

Quoted 30 lines · Stefan Priebe

Hello list,

i'm able to resize my block device online. The kernel also shows the correct new size in blockdev --getsize64.

But then i got stuck to extend the pv as i'm unable to extend my partition table without reboot.

Disk /dev/vda: 48,3GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name       Flags
 1      1049kB  2097kB  1049kB               GRUB_BOOT  bios_grub
 2      2097kB  32,2GB  32,2GB               Linux LVM  lvm

If i delete 2 and recreate it starting at the same sector i can't reread the part. table.

Is there a way todo online resizing?

Greets
Stefan

______________________________**_________________
linux-lvm mailing list
[email protected]
https://www.redhat.com/**mailman/listinfo/linux-lvm<https://www.redhat.com/mailman/listinfo/linux-lvm>
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-**HOWTO/<http://tldp.org/HOWTO/LVM-HOWTO/>

#2 lore raw

Am 30.07.2012 21:25, schrieb Scott Merrilees:

Quoted 1 line

partprobe ?

does not work when the partition is mounted

Stefan

#3 lore raw

how about

- create new part on other drive
- add that to vg
- pvmove part 2 to other drive
- remove part2 from vg
- pvremove part 2
- delete part 2
- create new (larger) part 2
- partprobe
- then add new part to vg and 'pvmove' back

andreas

Quoted 12 lines · Stefan Priebe

Am 30.07.2012 21:25, schrieb Scott Merrilees:

Quoted 1 line

partprobe ?

does not work when the partition is mounted

Stefan

_______________________________________________
linux-lvm mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

#4 lore raw

Yes that's a workaround - i just wanted to know if this is the only way and if it is correct that there's no other way. Am 31.07.2012 12:02, schrieb andreas nastke:

Quoted 33 lines

how about

- create new part on other drive
- add that to vg
- pvmove part 2 to other drive
- remove part2 from vg
- pvremove part 2
- delete part 2
- create new (larger) part 2
- partprobe
- then add new part to vg and 'pvmove' back

andreas

Quoted 5 lines · Stefan Priebe

Am 30.07.2012 21:25, schrieb Scott Merrilees:

Quoted 1 line

partprobe ?

does not work when the partition is mounted

Quoted 7 lines

Stefan

_______________________________________________
linux-lvm mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

_______________________________________________
linux-lvm mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

#5 lore raw
In reply to Stefan Priebe

On Jul 30, Stefan Priebe transmitted in part:

Quoted 7 lines

Number Start End Size File system Name Flags

1      1049kB  2097kB  1049kB               GRUB_BOOT  bios_grub
2      2097kB  32,2GB  32,2GB               Linux LVM  lvm

If i delete 2 and recreate it starting at the same sector i can't reread the part. table.

Is there a way todo online resizing?

Only when no partition is open. That is one reason why LVM is an improvement over partition tables. You don't have to use a partition table, just use the entire device as a PV. However, most admins use a partition table with a single partition so that other OSes will recognize the disk as in use (and hopefully not overwrite without warning if accidentally presented).

If you have multiple drives, you might be able to migrate stuff off, remove the PV, resize, add the PV back to the VG.

I use software RAID1/RAID10. You can remove the partition from the RAID array, resize, then add it back and resync. Repeat for other mirror legs to actually use the space.

#6 lore raw

Am 30.07.2012 22:25, schrieb Stuart D Gathman:

Quoted 6 lines

On Jul 30, Stefan Priebe transmitted in part:

Quoted 4 lines

Number Start End Size File system Name Flags

1      1049kB  2097kB  1049kB               GRUB_BOOT  bios_grub
2      2097kB  32,2GB  32,2GB               Linux LVM  lvm
Quoted 8 lines
Quoted 4 lines

If i delete 2 and recreate it starting at the same sector i can't reread the part. table.

Is there a way todo online resizing?

Only when no partition is open. That is one reason why LVM is an improvement over partition tables. You don't have to use a partition table, just use the entire device as a PV.

that was my idea too but grub2 then refuses to install onto /dev/vda. It says it cannot find a filesystem on hd0 which is /dev/vda.

Stefan

#7 lore raw

Try this<http://epsilon.eridani.nl/2012/06/11/hot-resize-lvm2-lv-in-vmware-linux-gues/>

Fred

Quoted 27 lines · Stefan Priebe

Am 30.07.2012 22:25, schrieb Stuart D Gathman:

Quoted 6 lines

On Jul 30, Stefan Priebe transmitted in part:

Quoted 4 lines

Number Start End Size File system Name Flags

1      1049kB  2097kB  1049kB               GRUB_BOOT  bios_grub
2      2097kB  32,2GB  32,2GB               Linux LVM  lvm
Quoted 8 lines
Quoted 4 lines

If i delete 2 and recreate it starting at the same sector i can't reread the part. table.

Is there a way todo online resizing?

Only when no partition is open. That is one reason why LVM is an improvement over partition tables. You don't have to use a partition table, just use the entire device as a PV.

that was my idea too but grub2 then refuses to install onto /dev/vda. It says it cannot find a filesystem on hd0 which is /dev/vda.

Stefan

_______________________________________________
linux-lvm mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/linux-lvm
read the LVM HOW-TO at http://tldp.org/HOWTO/LVM-HOWTO/

#9 lore raw
Quoted 6 lines · Stefan Priebe

Am 31.07.2012 07:10, schrieb Fred van Zwieten:

Quoted 2 lines

Try this
<http://epsilon.eridani.nl/2012/06/11/hot-resize-lvm2-lv-in-vmware-linux-gues/>

this just guarantees / updates the disk size. THis is not my problem the disk size is correct. I just can't change the partition table.

Reading between the lines in that post the user added a new partition on the newly-allocated region of disk (this is fine - it's only in-use partitions that are a problem) and then extended the VG onto the new partition.

It's an OK workaround if you have no option but I normally prefer to arrange some downtime and enlarge the existing partition rather than end up with multiple PVs on the same disk (the tools work fine I just feel it looks messy).

Bryn.

#10 lore raw

Am 31.07.2012 11:25, schrieb Bryn M. Reeves:

Quoted 13 lines · Stefan Priebe
Quoted 6 lines

Am 31.07.2012 07:10, schrieb Fred van Zwieten:

Quoted 2 lines

Try this
<http://epsilon.eridani.nl/2012/06/11/hot-resize-lvm2-lv-in-vmware-linux-gues/>

this just guarantees / updates the disk size. THis is not my problem the disk size is correct. I just can't change the partition table.

Reading between the lines in that post the user added a new partition on the newly-allocated region of disk (this is fine - it's only in-use partitions that are a problem) and then extended the VG onto the new partition.

Quoted 4 lines

It's an OK workaround if you have no option but I normally prefer to arrange some downtime and enlarge the existing partition rather than end up with multiple PVs on the same disk (the tools work fine I just feel it looks messy).

OK that's right that's why i had the other idea to use the whole disk for LVM but then grub doesn't want to install ;-(

Stefan

A message that is not in the archive (sent off-list or not yet received): [email protected]

#12 lore raw

this does not work for me.

no partition table on vda:

# parted -l
Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/system-root: 21,5GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Number  Start  End     Size    File system  Flags
 1      0,00B  21,5GB  21,5GB  xfs

Model: Linux device-mapper (linear) (dm)
Disk /dev/mapper/system-boot: 210MB
Sector size (logical/physical): 512B/512B
Partition Table: loop

Number  Start  End    Size   File system  Flags
 1      0,00B  210MB  210MB  ext2

Error: /dev/vda: unrecognised disk label

# grub-install /dev/vda
/usr/sbin/grub-setup: error: unable to identify a filesystem in hd0; safety check can't be performed.

sure as there is no filesystem on sda.

Greets
Stefan

Am 30.07.2012 23:47, schrieb Stuart D Gathman:

Quoted 22 lines

On 07/30/2012 04:45 PM, Stefan Priebe expounded in part:

Quoted 8 lines
Quoted 4 lines

Only when no partition is open. That is one reason why LVM is an improvement over partition tables. You don't have to use a partition table, just use the entire device as a PV.

that was my idea too but grub2 then refuses to install onto /dev/vda. It says it cannot find a filesystem on hd0 which is /dev/vda.

Grub2 supports LV boot partition now. Most distro installers do not support this by default, however. I set up my wife's laptop to boot from LV. Here is an outline:

http://forums.fedoraforum.org/showthread.php?t=264174

The key line is adding GRUB_PRELOAD_MODULES=lvm so that grub can find the LV. If your installer doesn't support it, you have to create the LVs, and copy filesystems from an installed system on another drive, then run grub2-install.

I haven't tried Fedora 17 installer, to see if it can install grub2 with no partition table.