Senin, 16 Desember 2019

How to extend logical volume disk on linux centos 7

  Tidak ada komentar
Check the disk size
[[email protected] ~]# 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
[[email protected] ~]#
Check the volume group size
[[email protected] ~]# 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
[[email protected] ~]#
Check the volume group vgdata size
[[email protected] ~]# vgdislpay vgdata
-bash: vgdislpay: command not found
[[email protected] ~]# lsvg vgdata
-bash: lsvg: command not found
[[email protected] ~]# 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

[[email protected] ~]#
Check the logical volume size
[[email protected] ~]# 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
[[email protected] ~]#
Extend the logical volume (data lv)
[[email protected] ~]# 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.
[[email protected] ~]#
Resize the disk / logical volume
[[email protected] ~]# 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.

[[email protected] ~]#
Check the disk size
[[email protected] ~]# 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
[[email protected] ~]#
List of pv, vg dan lv
[[email protected] ~]# 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
[[email protected] ~]# 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
[[email protected] ~]# pvs
  PV         VG     Fmt  Attr PSize     PFree
  /dev/sda2  centos lvm2 a--     48.00g    0
  /dev/sdb1  vgdata lvm2 a--  <1024.00g    0
[[email protected] ~]#st

Tidak ada komentar :

Posting Komentar