Friday, July 06, 2007

expanding a volume group on lvm1 metadata with a new physical volume on lvm2 metadata

# pvscan
PV /dev/disk/by-name/360060480000187720574444d36333944p1 VG vg01 lvm1 [33.71 GB / 0 free]
PV /dev/disk/by-name/360060480000190101659533032383041 lvm2 [25.29 GB]
Total: 2 [59.00 GB] / in use: 1 [33.71 GB] / in no VG: 1 [25.29 GB]

# vgconvert -M2 vg01
Volume group vg01 successfully converted

# pvscan
PV /dev/disk/by-name/360060480000187720574444d36333944p1 VG vg01 lvm2 [33.71 GB / 0 free]
PV /dev/disk/by-name/360060480000190101659533032383041 lvm2 [25.29 GB]
Total: 2 [59.00 GB] / in use: 1 [33.71 GB] / in no VG: 1 [25.29 GB]

# pvdisplay /dev/disk/by-name/360060480000190101659533032383041
--- NEW Physical volume ---
PV Name /dev/dm-3
VG Name
PV Size 25.29 GB
Allocatable NO
PE Size (KByte) 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID 7P5VhP-Bt8Z-jJPO-7j7I-0RCo-usbg-4ZRnVK

# vgextend vg01 /dev/dm-3
Volume group "vg01" successfully extended

# vgdisplay vg01
--- Volume group ---
VG Name vg01
System ID PV_IMPwdlbc64r021147289082
Format lvm2
Metadata Areas 2
Metadata Sequence No 2
VG Access read/write
VG Status resizable
MAX LV 256
Cur LV 1
Open LV 1
Max PV 256
Cur PV 2
Act PV 2
VG Size 59.00 GB
PE Size 4.00 MB
Total PE 15103
Alloc PE / Size 8629 / 33.71 GB
Free PE / Size 6474 / 25.29 GB
VG UUID Bf86re-OUES-xts3-LAL7-soW7-HpzU-KftWX4

# lvextend -l +6474 /dev/vg01/lvol1
Extending logical volume lvol1 to 59.00 GB
Logical volume lvol1 successfully resized

# vgdisplay vg01
--- Volume group ---
VG Name vg01
System ID PV_IMPwdlbc64r021147289082
Format lvm2
Metadata Areas 2
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 256
Cur LV 1
Open LV 1
Max PV 256
Cur PV 2
Act PV 2
VG Size 59.00 GB
PE Size 4.00 MB
Total PE 15103
Alloc PE / Size 15103 / 59.00 GB
Free PE / Size 0 / 0
VG UUID Bf86re-OUES-xts3-LAL7-soW7-HpzU-KftWX4

;For SuSE 9.X, an ext3 filesystem needs to be unmounted before it can be extended.

#umount /opt/SANdisk1

#e2fsck /dev/vg01/lvol1

#resize2fs /dev/vg01/lvol1

No comments: