Problem :
I have the following partitions:
root@test02 [~]# df -l
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/vg_test02-lv_root
119277820 4947592 108274344 5% /
tmpfs 961132 0 961132 0% /dev/shm
/dev/sda1 495844 54380 415864 12% /boot
/dev/sdb1 103211296 714176 97254292 1% /tmp
root@test02 [~]# fdisk -l
Disk /dev/sdb: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000448a6
Device Boot Start End Blocks Id System
/dev/sdb1 1 13055 104856576 83 Linux
Disk /dev/sda: 128.8 GB, 128849018880 bytes
255 heads, 63 sectors/track, 15665 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0000c49e
Device Boot Start End Blocks Id System
/dev/sda1 * 1 64 512000 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 64 13055 104344576 8e Linux LVM
/dev/sda3 13055 15665 20971512+ 8e Linux LVM
Disk /dev/mapper/vg_test02-lv_root: 124.1 GB, 124088483840 bytes
255 heads, 63 sectors/track, 15086 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/mapper/vg_test02-lv_swap: 4227 MB, 4227858432 bytes
255 heads, 63 sectors/track, 514 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
root@test02 [~]# pvdisplay
--- Physical volume ---
PV Name /dev/sda2
VG Name vg_test02
PV Size 99.51 GiB / not usable 3.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 25474
Free PE 0
Allocated PE 25474
PV UUID GS07qb-CYuk-ywp9-A3C5-HoRt-HF9L-tlkJmc
--- Physical volume ---
PV Name /dev/sda3
VG Name vg_test02
PV Size 20.00 GiB / not usable 3.99 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 5119
Free PE 0
Allocated PE 5119
PV UUID dKk7VD-PZfO-9Zji-b8xq-WPP3-2tsG-sGJKFj
root@test02 [~]# vgdisplay
--- Volume group ---
VG Name vg_test02
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 9
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 2
Act PV 2
VG Size 119.50 GiB
PE Size 4.00 MiB
Total PE 30593
Alloc PE / Size 30593 / 119.50 GiB
Free PE / Size 0 / 0
VG UUID kPHRMG-yF75-j7pW-H3fR-cIvb-eQXD-inhdvI
QUESTION:
How can I extend my /dev/mapper/vg_test02-lv_root volume space using /dev/sdb1?
thank you very much
Solution :
For extending the LVM disk, change your sdb type to Linux LVM by fdisk
and then creates a physical volume of that disk:
pvcreate /dev/sdb1
Then you have to extend the volume group which the logical disk is in and the check to extend correctly:
vgextend vg_group /dev/sdb1
vgdisplay
And for extending your logical disk:
lvextend /dev/vg_group/lv_disk /dev/sdb1
There is then one final step which is to resize the file system so that it can take advantage of this additional space, this is done using the resize2fs command.
resize2fs /dev/vg_group/lv_disk