For increasing the volume group size create another partation in the same disk or in a separate disk,
# vgdisplay
--- Volume group ---
VG Name vg-ctechz
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 16
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 2
Act PV 2
VG Size 1.04 GB
PE Size 4.00 MB
Total PE 266
Alloc PE / Size 188 / 752.00 MB
Free PE / Size 78 / 312.00 MB
VG UUID ui4JTr-JOwC-VCvG-5Evc-poOD-3Klr-hM3feq
[root@localhost ~]# vgs
VG #PV #LV #SN Attr VSize VFree
vg-ctechz 2 1 0 wz--n- 1.04G 312.00M
# fdisk -l
Disk /dev/sda: 31.8 GB, 31890341888 bytes
255 heads, 63 sectors/track, 3877 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 3315 26627706 83 Linux
/dev/sda2 3316 3446 1052257+ 82 Linux swap/Solaris
/dev/sda3 3447 3520 594405 8e Linux LVM
/dev/sda4 3521 3582 498015 8e Linux LVM
# fdisk /dev/sda
The number of cylinders for this disk is set to 3877.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
e
Selected partition 2
First cylinder (3316-3877, default 3316):
Using default value 3316
Last cylinder or +size or +sizeM or +sizeK (3316-3446, default 3446): +600M
Command (m for help): p
Disk /dev/sda: 31.8 GB, 31890341888 bytes
255 heads, 63 sectors/track, 3877 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 3315 26627706 83 Linux
/dev/sda2 3316 3389 594405 5 Extended
/dev/sda3 3447 3520 594405 8e Linux LVM
/dev/sda4 3521 3582 498015 8e Linux LVM
Command (m for help):
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
# partprobe
then create the new partition inside the extended partition,
# fdisk /dev/sda2
# fdisk -l
Disk /dev/sda: 31.8 GB, 31890341888 bytes
255 heads, 63 sectors/track, 3877 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 3315 26627706 83 Linux
/dev/sda2 3316 3389 594405 5 Extended
/dev/sda3 3447 3520 594405 8e Linux LVM
/dev/sda4 3521 3582 498015 8e Linux LVM
/dev/sda5 3316 3352 297171 83 Linux
sda5 is the new partation,
# pvcreate /dev/sda5
Writing physical volume data to disk "/dev/sda5"
Physical volume "/dev/sda5" successfully created
# vgs
VG #PV #LV #SN Attr VSize VFree
vg-ctechz 2 1 0 wz--n- 1.04G 312.00M
to extend vg # vgextend oldvgname /dev/newvgname
# vgextend vg-ctechz /dev/sda5
Volume group "vg-ctechz" successfully extended
# vgs
VG #PV #LV #SN Attr VSize VFree
vg-ctechz 3 1 0 wz--n- 1.32G 600.00M
Check the old vgsize and new vgsize here its extended
from 1.04G to 1.32G
# vgdisplay
--- Volume group ---
VG Name vg-ctechz
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 16
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 2
Act PV 2
VG Size 1.04 GB
PE Size 4.00 MB
Total PE 266
Alloc PE / Size 188 / 752.00 MB
Free PE / Size 78 / 312.00 MB
VG UUID ui4JTr-JOwC-VCvG-5Evc-poOD-3Klr-hM3feq
[root@localhost ~]# vgs
VG #PV #LV #SN Attr VSize VFree
vg-ctechz 2 1 0 wz--n- 1.04G 312.00M
# fdisk -l
Disk /dev/sda: 31.8 GB, 31890341888 bytes
255 heads, 63 sectors/track, 3877 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 3315 26627706 83 Linux
/dev/sda2 3316 3446 1052257+ 82 Linux swap/Solaris
/dev/sda3 3447 3520 594405 8e Linux LVM
/dev/sda4 3521 3582 498015 8e Linux LVM
# fdisk /dev/sda
The number of cylinders for this disk is set to 3877.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
e
Selected partition 2
First cylinder (3316-3877, default 3316):
Using default value 3316
Last cylinder or +size or +sizeM or +sizeK (3316-3446, default 3446): +600M
Command (m for help): p
Disk /dev/sda: 31.8 GB, 31890341888 bytes
255 heads, 63 sectors/track, 3877 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 3315 26627706 83 Linux
/dev/sda2 3316 3389 594405 5 Extended
/dev/sda3 3447 3520 594405 8e Linux LVM
/dev/sda4 3521 3582 498015 8e Linux LVM
Command (m for help):
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.
# partprobe
then create the new partition inside the extended partition,
# fdisk /dev/sda2
# fdisk -l
Disk /dev/sda: 31.8 GB, 31890341888 bytes
255 heads, 63 sectors/track, 3877 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 3315 26627706 83 Linux
/dev/sda2 3316 3389 594405 5 Extended
/dev/sda3 3447 3520 594405 8e Linux LVM
/dev/sda4 3521 3582 498015 8e Linux LVM
/dev/sda5 3316 3352 297171 83 Linux
sda5 is the new partation,
# pvcreate /dev/sda5
Writing physical volume data to disk "/dev/sda5"
Physical volume "/dev/sda5" successfully created
# vgs
VG #PV #LV #SN Attr VSize VFree
vg-ctechz 2 1 0 wz--n- 1.04G 312.00M
to extend vg # vgextend oldvgname /dev/newvgname
# vgextend vg-ctechz /dev/sda5
Volume group "vg-ctechz" successfully extended
# vgs
VG #PV #LV #SN Attr VSize VFree
vg-ctechz 3 1 0 wz--n- 1.32G 600.00M
Check the old vgsize and new vgsize here its extended
from 1.04G to 1.32G
No comments:
Post a Comment