Resizing a SAN disk using vgmodify only 11.23/11.31

Starting sceneario:

What we have:

1 vg called vgtest
1 san Pv 2 gigs
2 lvols of 1 gig each

What we need:

1 vg called vgtest
1 san PV 5 gigs
2 lvols of 2'5 gigs each

First we need our 2 san gig PV to be extended to 5 gigs, this is done by storage people.

# diskinfo /dev/rdsk/c0t2d0
SCSI describe of /dev/rdsk/c0t2d0:
vendor: HP
product id: Virtual LvDisk
type: direct access
size: 2097152 Kbytes
bytes per sector: 512

# ioscan -f

# diskinfo /dev/rdsk/c0t2d0
SCSI describe of /dev/rdsk/c0t2d0:
vendor: HP
product id: Virtual LvDisk
type: direct access
size: 5177344 Kbytes
bytes per sector: 512

Once we have the disk extended to 5 gigs, we can start:

# vgdisplay -v /dev/vgtest
--- Volume groups ---
VG Name /dev/vgtest
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 2
Open LV 2
Max PV 24
Cur PV 1
Act PV 1
Max PE per PV 500 <----- We can only get a 4 gig disk in
VGDA 2
PE Size (Mbytes) 8
Total PE 254
Alloc PE 250
Free PE 4
Total PVG 0
Total Spare PVs 0
Total Spare PVs in use 0

First we do a review, we get a warning that not all the PEs are going to be available:

# vgmodify -r -v /dev/vgtest
Volume Group configuration for /dev/vgtest has been saved in /etc/lvmconf/vgtest.conf

Current Volume Group settings:
Max LV 255
Max PV 24
Max PE per PV 500
PE Size (Mbytes) 8
VGRA Size (Kbytes) 128
/dev/rdsk/c0t2d0 Warning: Max_PE_per_PV for the volume group (500) too small for this PV (630).
Using only 500 PEs from this physical volume.
"/dev/rdsk/c0t2d0" size changed from 2097152 to 5177344kb
An update to the Volume Group IS required

New Volume Group settings:
Max LV 255
Max PV 24
Max PE per PV 500
PE Size (Mbytes) 8
VGRA Size (Kbytes) 128
Review complete. Volume group not modified

We are going to do it in 2 steps, just so you can see how it works, first we are going to update the lvm data on the disk so it can use the new space:

# vgchange -a n /dev/vgtest
+ vgchange -a n /dev/vgtest
Volume group "/dev/vgtest" has been successfully changed.
#
#
# vgmodify -v /dev/vgtest
+ vgmodify -v /dev/vgtest
Performing "vgchange -a y -l -p -s /dev/vgtest" to collect data
Activated volume group
Volume group "/dev/vgtest" has been successfully activated.
Volume Group configuration for /dev/vgtest has been saved in /etc/lvmconf/vgtest.conf
Deactivating Volume Group "/dev/vgtest"
Volume group "/dev/vgtest" has been successfully deactivated.

Current Volume Group settings:
Max LV 255
Max PV 24
Max PE per PV 500
PE Size (Mbytes) 8
VGRA Size (Kbytes) 128
/dev/rdsk/c0t2d0 Warning: Max_PE_per_PV for the volume group (500) too small for this PV (630).
Using only 500 PEs from this physical volume.
"/dev/rdsk/c0t2d0" size changed from 2097152 to 5177344kb
An update to the Volume Group IS required

New Volume Group settings:
Max LV 255
Max PV 24
Max PE per PV 500
PE Size (Mbytes) 8
VGRA Size (Kbytes) 128
New Volume Group configuration for "/dev/vgtest" has been saved in "/etc/lvmconf/vgtest.conf"
Old Volume Group configuration for "/dev/vgtest" has been saved in "/etc/lvmconf/vgtest.conf.old"
Starting the modification by writing to all Physical Volumes
Applying the configuration to all Physical Volumes from "/etc/lvmconf/vgtest.conf"
Volume Group configuration has been restored to /dev/rdsk/c0t2d0
Completed the modification process.
New Volume Group configuration for "/dev/vgtest" has been saved in "/etc/lvmconf/vgtest.conf.old"
Volume group "/dev/vgtest" has been successfully changed.

We activate the volume to see the changes made:

# vgchange -a y /dev/vgtest
Activated volume group
Volume group "/dev/vgtest" has been successfully changed.
# vgdisplay -v /dev/vgtest
--- Volume groups ---
VG Name /dev/vgtest
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 2
Open LV 2
Max PV 24
Cur PV 1
Act PV 1
Max PE per PV 500
VGDA 2
PE Size (Mbytes) 8
Total PE 500 <---- Now our total PE are 500, but we need to vgmodify to get 640
Alloc PE 250
Free PE 250
Total PVG 0
Total Spare PVs 0
Total Spare PVs in use 0

Once again here we go:

with -t shows us a table we can use to select the best choice, or we could use -o and it would optimize to the bes setting automaticly

# vgmodify -tv /dev/vgtest
Volume Group configuration for /dev/vgtest has been saved in /etc/lvmconf/vgtest.conf

Current Volume Group settings:
Max LV 255
Max PV 24
Max PE per PV 500
PE Size (Mbytes) 8
VGRA Size (Kbytes) 128

VGRA space (Kbytes) on Physical Volumes with extents in use:
PV current -n
/dev/rdsk/c0t2d0 8192 896
Summary 8192 896
Volume Group optimized settings (no PEs renumbered):
max_pv(-p) max_pe(-e) Disk size (Mb)
24 41980 335848

with 24 pv the max disk size we can get is 335gigs, more than enough, if you needed more
you can use the -n option, but you need to free the first pe on all the disks in the vg:

We are going to use -e 4348 -p 30 more than enough for our new 5 gig disk:

# vgmodify -v -r -e 4348 -p 30 /dev/vgtest
Volume Group configuration for /dev/vgtest has been saved in /etc/lvmconf/vgtest.conf

Current Volume Group settings:
Max LV 255
Max PV 24
Max PE per PV 500
PE Size (Mbytes) 8
VGRA Size (Kbytes) 128
The current and new Volume Group parameters differ.
Physical Volume "/dev/rdsk/c0t2d0" the current and new settings differ
An update to the Volume Group IS required

New Volume Group settings:
Max LV 255
Max PV 30
Max PE per PV 4348
PE Size (Mbytes) 8
VGRA Size (Kbytes) 1088
Review complete. Volume group not modified
# vgmodify -v -e 4348 -p 30 /dev/vgtest
# vgchange -a n /dev/vgtest
Volume group "/dev/vgtest" has been successfully changed.
# vgmodify -v -e 4348 -p 30 /dev/vgtest
Performing "vgchange -a y -l -p -s /dev/vgtest" to collect data
Activated volume group
Volume group "/dev/vgtest" has been successfully activated.
Volume Group configuration for /dev/vgtest has been saved in /etc/lvmconf/vgtest.conf
Deactivating Volume Group "/dev/vgtest"
Volume group "/dev/vgtest" has been successfully deactivated.

Current Volume Group settings:
Max LV 255
Max PV 24
Max PE per PV 500
PE Size (Mbytes) 8
VGRA Size (Kbytes) 128
The current and new Volume Group parameters differ.
Physical Volume "/dev/rdsk/c0t2d0" the current and new settings differ
An update to the Volume Group IS required

New Volume Group settings:
Max LV 255
Max PV 30
Max PE per PV 4348
PE Size (Mbytes) 8
VGRA Size (Kbytes) 1088
New Volume Group configuration for "/dev/vgtest" has been saved in "/etc/lvmconf/vgtest.conf"
Old Volume Group configuration for "/dev/vgtest" has been saved in "/etc/lvmconf/vgtest.conf.old"
Starting the modification by writing to all Physical Volumes
Applying the configuration to all Physical Volumes from "/etc/lvmconf/vgtest.conf"
Volume Group configuration has been restored to /dev/rdsk/c0t2d0
Completed the modification process.
New Volume Group configuration for "/dev/vgtest" has been saved in "/etc/lvmconf/vgtest.conf.old"
Volume group "/dev/vgtest" has been successfully changed.
# vgchange -a y /dev/vgtest
Activated volume group
Volume group "/dev/vgtest" has been successfully changed.
# vgdisplay -v /dev/vgtest

--- Volume groups ---
VG Name /dev/vgtest
VG Write Access read/write
VG Status available
Max LV 255
Cur LV 2
Open LV 2
Max PV 30
Cur PV 1
Act PV 1
Max PE per PV 4348
VGDA 2
PE Size (Mbytes) 8
Total PE 630 ->> now we have the full 5 gigs to our disposal
Alloc PE 250
Free PE 380
Total PVG 0
Total Spare PVs 0
Total Spare PVs in use 0

--- Logical volumes ---
LV Name /dev/vgtest/lvtest1
LV Status available/syncd
LV Size (Mbytes) 1000
Current LE 125
Allocated PE 125
Used PV 1

LV Name /dev/vgtest/lvtest2
LV Status available/syncd
LV Size (Mbytes) 1000
Current LE 125
Allocated PE 125
Used PV 1

--- Physical volumes ---
PV Name /dev/dsk/c0t2d0
PV Status available
Total PE 630
Free PE 380
Autoswitch On
Proactive Polling On

now you can extend your lvols to 2'5 gigs.

Bye.