[linux-lvm] How to resize a PV located on a SAN LUN

PeS pes at sandbox.cz
Mon Apr 23 10:06:38 UTC 2007


Thomas Hager wrote:
> On Fri, 2007-04-20 at 13:47 +0200, Micha Holzmann wrote:
>> Hello,
> hi,
> 
>> Now i had to increase the size of partition of sda12 which is a LVM.
> why would you want to do that? if your vg is running out of free
> extents, why not just add a new LUN from the SAN and extend the vg with
> it?

Maybe, because their SAN configuration get bloated with smaller LUNs? 
When SAN enables extending size, why not use it?

>> I am not sure which is the right way. Within the storage managment
>> software i can increase the size of the LUN. After rebooting the machine
>> the additional space is appended at the end of partitions and it is
>> marked as free. How can i now increase the LVM partition. Which
>> tool/programm i do need for this task?
> you can't really increase the physical volume, because there's a swap
> partition between your physical volume and the free space.
> use fdisk to partition the free space as /dev/sda14, create a physical
> volume on the new partition (pvcreate /dev/sda14) and extend the
> volume group with the new physical volume (vgextend yourvg /dev/sda14).

As it's swap partition, he can recreate it. So create new swap partition 
/dev/sda14 at the end of extended disk. Then mkswap /dev/sda14, swapon 
/dev/sda14, swapoff /dev/sda13. Delete /dev/sda13, add size to 
/dev/sda12 using fdisk. Then use pvresize /dev/sda12 (it'll autodetect 
new size). And after this, you can see free PE in vg.

Or better, if you can disable swap partition for some time, switch it 
off, delete sda13, resize sda12, pvresize sda12 and create new LV for 
swap inside VG. With this, next time you add some space, you won't 
move/delete swap partition, just resize(fdisk) and pvresize sda12.

> hth,
> tom.

Hope this helps,
PeS




More information about the linux-lvm mailing list