How to extend logical volume disk on linux centos 7
Check the disk size
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 3.9G 0 3.9G 0% /dev
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 3.9G 17M 3.9G 1% /run
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/mapper/centos-root 43G 1.6G 42G 4% /
/dev/sda1 1014M 157M 858M 16% /boot
/dev/mapper/vgdata-data 886G 669G 174G 80% /data
tmpfs 783M 0 783M 0% /run/user/0
[root@localhost ~]#
Check the volume group size
[root@localhost ~]# vgs
VG #PV #LV #SN Attr VSize VFree
centos 1 2 0 wz--n- 48.00g 0
vgdata 1 1 0 wz--n- <1024.00g <124.00g
[root@localhost ~]#
Check the volume group vgdata size
[root@localhost ~]# vgdislpay vgdata
-bash: vgdislpay: command not found
[root@localhost ~]# lsvg vgdata
-bash: lsvg: command not found
[root@localhost ~]# vgdisplay vgdata
--- Volume group ---
VG Name vgdata
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 5
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 1
Act PV 1
VG Size <1024.00 GiB
PE Size 4.00 MiB
Total PE 262143
Alloc PE / Size 230400 / 900.00 GiB
Free PE / Size 31743 / <124.00 GiB
VG UUID bqYika-posk-M0Af-A4N1-qJyZ-DLJR-GqndQ5
[root@localhost ~]#
Check the logical volume size
[root@localhost ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root centos -wi-ao---- 43.00g
swap centos -wi-ao---- 5.00g
data vgdata -wi-ao---- 900.00g
[root@localhost ~]#
Extend the logical volume (data lv)
[root@localhost ~]# lvextend -l +31743 /dev/vgdata/data
Size of logical volume vgdata/data changed from 900.00 GiB (230400 extents) to <1024.00 GiB (262143 extents).
Logical volume vgdata/data successfully resized.
[root@localhost ~]#
Resize the disk / logical volume
[root@localhost ~]# resize2fs /dev/vgdata/data
resize2fs 1.42.9 (28-Dec-2013)
Filesystem at /dev/vgdata/data is mounted on /data; on-line resizing required
old_desc_blocks = 113, new_desc_blocks = 128
The filesystem on /dev/vgdata/data is now 268434432 blocks long.
[root@localhost ~]#
Check the disk size
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 3.9G 0 3.9G 0% /dev
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 3.9G 17M 3.9G 1% /run
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/mapper/centos-root 43G 1.6G 42G 4% /
/dev/sda1 1014M 157M 858M 16% /boot
/dev/mapper/vgdata-data 1008G 669G 291G 70% /data
tmpfs 783M 0 783M 0% /run/user/0
[root@localhost ~]#
List of pv, vg dan lv
[root@localhost ~]# vgs
VG #PV #LV #SN Attr VSize VFree
centos 1 2 0 wz--n- 48.00g 0
vgdata 1 1 0 wz--n- <1024.00g 0
[root@localhost ~]# lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root centos -wi-ao---- 43.00g
swap centos -wi-ao---- 5.00g
data vgdata -wi-ao---- <1024.00g
[root@localhost ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/sda2 centos lvm2 a-- 48.00g 0
/dev/sdb1 vgdata lvm2 a-- <1024.00g 0
[root@localhost ~]#st