lvm – shrink lvm partition size

[root@rhelA ~]# findmnt
TARGET                       SOURCE                       FSTYPE      OPTIONS
/                            /dev/mapper/vg_rhela-lv_root ext4        rw,relatime,seclabel,barrier=1,data=ordered
├─/proc                      proc                         proc        rw,relatime
│ ├─/proc/bus/usb            /proc/bus/usb                usbfs       rw,relatime
│ └─/proc/sys/fs/binfmt_misc                              binfmt_misc rw,relatime
├─/sys                       sysfs                        sysfs       rw,relatime,seclabel
├─/selinux                                                selinuxfs   rw,relatime
├─/dev                       devtmpfs                     devtmpfs    rw,relatime,seclabel,size=946208k,nr_inodes=236552,mode=755
│ └─/dev                     devtmpfs                     devtmpfs    rw,relatime,seclabel,size=946208k,nr_inodes=236552,mode=755
│   ├─/dev/pts               devpts                       devpts      rw,relatime,seclabel,gid=5,mode=620,ptmxmode=000
│   └─/dev/shm               tmpfs                        tmpfs       rw,relatime,seclabel
├─/boot                      /dev/sda1                    ext4        rw,relatime,seclabel,barrier=1,data=ordered
├─/home                      /dev/mapper/vg_rhela-lv_home ext4        rw,relatime,seclabel,barrier=1,data=ordered
├─/misc                      /etc/auto.misc               autofs      rw,relatime,fd=7,pgrp=1649,timeout=300,minproto=5,maxproto=5,indirect
└─/net                       -hosts                       autofs      rw,relatime,fd=13,pgrp=1649,timeout=300,minproto=5,maxproto=5,indirect

[root@rhelA ~]# umount /home

[root@rhelA ~]# e2fsck -f /dev/mapper/vg_rhela-lv_home 
e2fsck 1.41.12 (17-May-2010)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/mapper/vg_rhela-lv_home: 656/4300800 files (17.8% non-contiguous), 4124861/17188864 blocks

[root@rhelA ~]# e2fsck -fy /dev/mapper/vg_rhela-lv_home 
e2fsck 1.41.12 (17-May-2010)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/mapper/vg_rhela-lv_home: 656/4300800 files (17.8% non-contiguous), 4124861/17188864 blocks

[root@rhelA ~]# resize2fs /dev/mapper/vg_rhela-lv_home 25G
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/mapper/vg_rhela-lv_home to 6553600 (4k) blocks.
The filesystem on /dev/mapper/vg_rhela-lv_home is now 6553600 blocks long.

[root@rhelA ~]# vgdisplay
  --- Volume group ---
  VG Name               vg_rhela
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               119.51 GiB
  PE Size               4.00 MiB
  Total PE              30594
  Alloc PE / Size       30594 / 119.51 GiB
  Free  PE / Size       0 / 0   
  VG UUID               DOXFrI-vdc8-KjtT-qN4N-oGj3-Yf8K-suupSe

[root@rhelA ~]# lvreduce -L 25G /dev/vg_rhela/lv_home 
  WARNING: Reducing active logical volume to 25.00 GiB
  THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce lv_home? [y/n]: y
  Size of logical volume vg_rhela/lv_home changed from 65.57 GiB (16786 extents) to 25.00 GiB (6400 extents).
  Logical volume lv_home successfully resized
[root@rhelA ~]# resize2fs /dev/mapper/vg_rhela-lv_home 
resize2fs 1.41.12 (17-May-2010)
The filesystem is already 6553600 blocks long.  Nothing to do!

[root@rhelA ~]# mount /dev/mapper/vg_rhela-lv_home /home

[root@rhelA ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_rhela-lv_root
                       50G  4.2G   43G   9% /
tmpfs                 940M  296K  939M   1% /dev/shm
/dev/sda1             477M   42M  410M  10% /boot
/dev/mapper/vg_rhela-lv_home
                       25G   15G  8.7G  63% /home

[root@rhelA ~]# vgdisplay
  --- Volume group ---
  VG Name               vg_rhela
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  5
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               3
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               119.51 GiB
  PE Size               4.00 MiB
  Total PE              30594
  Alloc PE / Size       20208 / 78.94 GiB
  Free  PE / Size       10386 / 40.57 GiB
  VG UUID               DOXFrI-vdc8-KjtT-qN4N-oGj3-Yf8K-suupSe

Advertisements

lvm – extend expand size

# show all after crate fdisk command -----------------------------------
[root@localhost ~]# pvdisplay
  PV Rbyn39-R43F-9dIL-D598-ARv6-HN6C-UNsCzD not recognised. Is the device missing?
  PV Rbyn39-R43F-9dIL-D598-ARv6-HN6C-UNsCzD not recognised. Is the device missing?
  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               rhel
  PV Size               31.51 GiB / not usable 3.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              8066
  Free PE               0
  Allocated PE          8066
  PV UUID               bdaYMp-UQB8-bSFf-UGk1-TYhP-mow6-SLNkuQ
   
  PV Rbyn39-R43F-9dIL-D598-ARv6-HN6C-UNsCzD not recognised. Is the device missing?
  --- Physical volume ---
  PV Name               unknown device
  VG Name               rhel
  PV Size               468.00 GiB / not usable 4.00 MiB
  Allocatable           yes 
  PE Size               4.00 MiB
  Total PE              119807
  Free PE               119807
  Allocated PE          0
  PV UUID               Rbyn39-R43F-9dIL-D598-ARv6-HN6C-UNsCzD
   
  "/dev/sda3" is a new physical volume of "468.00 GiB"
  --- NEW Physical volume ---
  PV Name               /dev/sda3
  VG Name               
  PV Size               468.00 GiB
  Allocatable           NO
  PE Size               0   
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               3ycy21-P5OL-YKYu-zz4c-wnCB-hsx6-vYnaDt

[root@localhost ~]# vgdisplay
  PV Rbyn39-R43F-9dIL-D598-ARv6-HN6C-UNsCzD not recognised. Is the device missing?
  PV Rbyn39-R43F-9dIL-D598-ARv6-HN6C-UNsCzD not recognised. Is the device missing?
  --- Volume group ---
  VG Name               rhel
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                2
  Act PV                1
  VG Size               499.50 GiB
  PE Size               4.00 MiB
  Total PE              127873
  Alloc PE / Size       8066 / 31.51 GiB
  Free  PE / Size       119807 / 468.00 GiB
  VG UUID               TRdEsL-YK5v-0iG7-fMvI-XPyy-Rzpb-LxFbgb
   
[root@localhost ~]# pvscan
  PV Rbyn39-R43F-9dIL-D598-ARv6-HN6C-UNsCzD not recognised. Is the device missing?
  PV Rbyn39-R43F-9dIL-D598-ARv6-HN6C-UNsCzD not recognised. Is the device missing?
  PV /dev/sda2        VG rhel            lvm2 [31.51 GiB / 0    free]
  PV unknown device   VG rhel            lvm2 [468.00 GiB / 468.00 GiB free]
  PV /dev/sda3                           lvm2 [468.00 GiB]
  Total: 3 [967.50 GiB] / in use: 2 [499.50 GiB] / in no VG: 1 [468.00 GiB]

# remove missing from vg ------------------------------------------------
[root@localhost ~]# vgreduce --removemissing --force rhel
  PV Rbyn39-R43F-9dIL-D598-ARv6-HN6C-UNsCzD not recognised. Is the device missing?
  PV Rbyn39-R43F-9dIL-D598-ARv6-HN6C-UNsCzD not recognised. Is the device missing?
  Wrote out consistent volume group rhel

[root@localhost ~]# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               rhel
  PV Size               31.51 GiB / not usable 3.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              8066
  Free PE               0
  Allocated PE          8066
  PV UUID               bdaYMp-UQB8-bSFf-UGk1-TYhP-mow6-SLNkuQ
   
  "/dev/sda3" is a new physical volume of "468.00 GiB"
  --- NEW Physical volume ---
  PV Name               /dev/sda3
  VG Name               
  PV Size               468.00 GiB
  Allocatable           NO
  PE Size               0   
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               3ycy21-P5OL-YKYu-zz4c-wnCB-hsx6-vYnaDt
   
[root@localhost ~]# vgdisplay
  --- Volume group ---
  VG Name               rhel
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  5
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               31.51 GiB
  PE Size               4.00 MiB
  Total PE              8066
  Alloc PE / Size       8066 / 31.51 GiB
  Free  PE / Size       0 / 0   
  VG UUID               TRdEsL-YK5v-0iG7-fMvI-XPyy-Rzpb-LxFbgb

# create pv ------------------------------------------------------------
[root@localhost ~]# pvcreate /dev/sda3
  Physical volume "/dev/sda3" successfully created

[root@localhost ~]# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               rhel
  PV Size               31.51 GiB / not usable 3.00 MiB
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              8066
  Free PE               0
  Allocated PE          8066
  PV UUID               bdaYMp-UQB8-bSFf-UGk1-TYhP-mow6-SLNkuQ
   
  "/dev/sda3" is a new physical volume of "468.00 GiB"
  --- NEW Physical volume ---
  PV Name               /dev/sda3
  VG Name               
  PV Size               468.00 GiB
  Allocatable           NO
  PE Size               0   
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               fl2Lhs-kIpW-9qH9-VS9Y-2xA0-uKr0-GUYZLm

# extend vg ------------------------------------------------------------
[root@localhost ~]# vgextend /dev/rhel /dev/sda3
  Volume group "rhel" successfully extended

[root@localhost ~]# vgdisplay
  --- Volume group ---
  VG Name               rhel
  System ID             
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  6
  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               499.50 GiB
  PE Size               4.00 MiB
  Total PE              127873
  Alloc PE / Size       8066 / 31.51 GiB
  Free  PE / Size       119807 / 468.00 GiB
  VG UUID               TRdEsL-YK5v-0iG7-fMvI-XPyy-Rzpb-LxFbgb

# show lv size ---------------------------------------------------------
[root@localhost ~]# lvdisplay
  --- Logical volume ---
  LV Path                /dev/rhel/swap
  LV Name                swap
  VG Name                rhel
  LV UUID                X0Th3D-SZty-2rDO-JGm3-zuOw-ydoi-QXrzRG
  LV Write Access        read/write
  LV Creation host, time localhost, 2017-05-17 01:55:54 +0700
  LV Status              available
  # open                 2
  LV Size                3.02 GiB
  Current LE             772
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1
   
  --- Logical volume ---
  LV Path                /dev/rhel/root
  LV Name                root
  VG Name                rhel
  LV UUID                kWHVMz-X2Tl-b3vT-vNWG-NSSs-Ihq4-C4vxiD
  LV Write Access        read/write
  LV Creation host, time localhost, 2017-05-17 01:55:54 +0700
  LV Status              available
  # open                 1
  LV Size                28.49 GiB
  Current LE             7294
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

# extend lv size -------------------------------------------------------
[root@localhost ~]# lvextend /dev/rhel/root /dev/sda3
  Extending logical volume root to 496.49 GiB
  Logical volume root successfully resized

# show the new size ----------------------------------------------------
[root@localhost ~]# lvdisplay
  --- Logical volume ---
  LV Path                /dev/rhel/swap
  LV Name                swap
  VG Name                rhel
  LV UUID                X0Th3D-SZty-2rDO-JGm3-zuOw-ydoi-QXrzRG
  LV Write Access        read/write
  LV Creation host, time localhost, 2017-05-17 01:55:54 +0700
  LV Status              available
  # open                 2
  LV Size                3.02 GiB
  Current LE             772
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1
   
  --- Logical volume ---
  LV Path                /dev/rhel/root
  LV Name                root
  VG Name                rhel
  LV UUID                kWHVMz-X2Tl-b3vT-vNWG-NSSs-Ihq4-C4vxiD
  LV Write Access        read/write
  LV Creation host, time localhost, 2017-05-17 01:55:54 +0700
  LV Status              available
  # open                 1
  LV Size                496.49 GiB
  Current LE             127101
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:0

# show with df ---------------------------------------------------------
[root@localhost ~]# df -h
Filesystem             Size  Used Avail Use% Mounted on
/dev/mapper/rhel-root   29G  5.2G   24G  19% /
devtmpfs               123G     0  123G   0% /dev
tmpfs                  123G  128K  123G   1% /dev/shm
tmpfs                  123G  8.9M  123G   1% /run
tmpfs                  123G     0  123G   0% /sys/fs/cgroup
/dev/sda1              497M  119M  379M  24% /boot
/dev/sr0               3.5G  3.5G     0 100% /run/media/exsys/RHEL-7.0 Server.x86_64

#the size only 29GB

# using resize2fs to make use of this space ----------------------------
[root@localhost ~]# resize2fs /dev/rhel/root 
resize2fs 1.42.9 (28-Dec-2013)
resize2fs: Bad magic number in super-block while trying to open /dev/rhel/root
Couldn't find valid filesystem superblock.

# ok error next using xfs_growfs to get free space ---------------------------
[root@localhost ~]# xfs_growfs /dev/rhel/root 
meta-data=/dev/mapper/rhel-root  isize=256    agcount=4, agsize=1867264 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=0
data     =                       bsize=4096   blocks=7469056, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
log      =internal               bsize=4096   blocks=3647, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 7469056 to 130151424

# check lagi -----------------------------------------------------------
[root@localhost ~]# df -h
Filesystem             Size  Used Avail Use% Mounted on
/dev/mapper/rhel-root  497G  5.2G  492G   2% /
devtmpfs               123G     0  123G   0% /dev
tmpfs                  123G  128K  123G   1% /dev/shm
tmpfs                  123G  8.9M  123G   1% /run
tmpfs                  123G     0  123G   0% /sys/fs/cgroup
/dev/sda1              497M  119M  379M  24% /boot
/dev/sr0               3.5G  3.5G     0 100% /run/media/exsys/RHEL-7.0 Server.x86_64

rhel 67 – shrink expand lvm partition

the default rhel 6.7 partition, “/” partition only have 50GB and the “/home” get the rest

if you only have 90GB for rhel, it would split  / to 50GB and /home 40GB. but if you have TeraByte space / get 50GB and /home get TeraByte

problem when you use / for default database storage, which store the data in / partition, 50GB so small for database.

the advantage using lvm partition, you can shrink the partition, and give the free space for other partition

i will try reduce /home space and add it to

# test
[root@rhel67 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_rhel67-lv_root
 50G 1.9G 45G 4% /
tmpfs 1.9G 0 1.9G 0% /dev/shm
/dev/sda1 477M 41M 411M 10% /boot
/dev/mapper/vg_rhel67-lv_home
 45G 52M 43G 1% /home

[root@rhel67 ~]# pvs
  PV         VG        Fmt  Attr PSize  PFree
  /dev/sda2  vg_rhel67 lvm2 a--  99.51g    0 

[root@rhel67 ~]# vgs
  VG        #PV #LV #SN Attr   VSize  VFree
  vg_rhel67   1   3   0 wz--n- 99.51g    0 

[root@rhel67 ~]# lvs
  LV      VG        Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  lv_home vg_rhel67 -wi-ao---- 45.63g                                                    
  lv_root vg_rhel67 -wi-ao---- 50.00g                                                    
  lv_swap vg_rhel67 -wi-ao----  3.88g
  
# step to reduce
[root@rhel67 ~]# umount /home

# check system error
[root@rhel67 ~]# e2fsck -ff /dev/mapper/vg_rhel67-lv_home
e2fsck 1.41.12 (17-May-2010)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/mapper/vg_rhel67-lv_home: 11/2992416 files (0.0% non-contiguous), 233857/11962368 blocks

# now cut the space
[root@rhel67 ~]# resize2fs /dev/mapper/vg_rhel67-lv_home 20G
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/mapper/vg_rhel67-lv_home to 5242880 (4k) blocks.
The filesystem on /dev/mapper/vg_rhel67-lv_home is now 5242880 blocks long.

# resize authority
[root@rhel67 ~]# lvreduce -L -19G /dev/mapper/vg_rhel67-lv_home  
  WARNING: Reducing active logical volume to 26.63 GiB
  THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce lv_home? [y/n]: y
  Size of logical volume vg_rhel67/lv_home changed from 45.63 GiB (11682 extents) to 26.63 GiB (6818 extents).
  Logical volume lv_home successfully resized

[root@rhel67 ~]# lvdisplay /dev/vg_rhel67/lv_home
  --- Logical volume ---
  LV Path                /dev/vg_rhel67/lv_home
  LV Name                lv_home
  VG Name                vg_rhel67
  LV UUID                TG9ipf-EeEA-jKN6-BrG2-J3Gx-mXz2-tylb4X
  LV Write Access        read/write
  LV Creation host, time rhel67, 2017-07-04 04:05:41 +0700
  LV Status              available
  # open                 0
  LV Size                26.63 GiB
  Current LE             6818
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2

[root@rhel67 ~]# bc
bc 1.06.95
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'. 
1024*20
20480
2048/4
512

[root@rhel67 ~]# lvreduce -l -512 /dev/vg_rhel67/lv_home
  WARNING: Reducing active logical volume to 24.63 GiB
  THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce lv_home? [y/n]: y
  Size of logical volume vg_rhel67/lv_home changed from 26.63 GiB (6818 extents) to 24.63 GiB (6306 extents).
  Logical volume lv_home successfully resized

[root@rhel67 ~]# resize2fs /dev/vg_rhel67/lv_home
resize2fs 1.41.12 (17-May-2010)
Resizing the filesystem on /dev/vg_rhel67/lv_home to 6457344 (4k) blocks.
The filesystem on /dev/vg_rhel67/lv_home is now 6457344 blocks long.

[root@rhel67 ~]# mount /dev/vg_rhel67/lv_home /home

[root@rhel67 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_rhel67-lv_root
                       50G  1.9G   45G   4% /
tmpfs                 1.9G     0  1.9G   0% /dev/shm
/dev/sda1             477M   41M  411M  10% /boot
/dev/mapper/vg_rhel67-lv_home
                       25G   44M   23G   1% /home

# now check
[root@rhel67 ~]# vgdisplay
  --- Volume group ---
  VG Name               vg_rhel67
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  6
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               3
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               99.51 GiB
  PE Size               4.00 MiB
  Total PE              25474
  Alloc PE / Size       20098 / 78.51 GiB
  Free  PE / Size       5376 / 21.00 GiB
  VG UUID               DYk8Up-pACU-XZco-ZuEw-iXLL-G98b-gDUSyP
   
[root@rhel67 ~]# pvs
  PV         VG        Fmt  Attr PSize  PFree 
  /dev/sda2  vg_rhel67 lvm2 a--  99.51g 21.00g

[root@rhel67 ~]# lvs
  LV      VG        Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  lv_home vg_rhel67 -wi-ao---- 24.63g                                                    
  lv_root vg_rhel67 -wi-ao---- 50.00g                                                    
  lv_swap vg_rhel67 -wi-ao----  3.88g

# check how much freespace 
[root@rhel67 ~]# pvscan
  PV /dev/sda2   VG vg_rhel67   lvm2 [99.51 GiB / 21.00 GiB free]
  Total: 1 [99.51 GiB] / in use: 1 [99.51 GiB] / in no VG: 0 [0   ]

[root@rhel67 ~]# vgdisplay
  --- Volume group ---
  VG Name               vg_rhel67
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  6
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               3
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               99.51 GiB
  PE Size               4.00 MiB
  Total PE              25474
  Alloc PE / Size       20098 / 78.51 GiB
  Free  PE / Size       5376 / 21.00 GiB
  VG UUID               DYk8Up-pACU-XZco-ZuEw-iXLL-G98b-gDUSyP

# check size partition
[root@rhel67 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_rhel67-lv_root
                       50G  1.9G   45G   4% /
tmpfs                 1.9G     0  1.9G   0% /dev/shm
/dev/sda1             477M   41M  411M  10% /boot
/dev/mapper/vg_rhel67-lv_home
                       25G   44M   23G   1% /home

# now expand the freespace
[root@rhel67 ~]# resize2fs /dev/vg_rhel67/lv_root 
resize2fs 1.41.12 (17-May-2010)
Filesystem at /dev/vg_rhel67/lv_root is mounted on /; on-line resizing required
old desc_blocks = 4, new_desc_blocks = 5
Performing an on-line resize of /dev/vg_rhel67/lv_root to 18612224 (4k) blocks.
The filesystem on /dev/vg_rhel67/lv_root is now 18612224 blocks long.

# check again the size
[root@rhel67 ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_rhel67-lv_root
                       70G  1.9G   65G   3% /
tmpfs                 1.9G     0  1.9G   0% /dev/shm
/dev/sda1             477M   41M  411M  10% /boot
/dev/mapper/vg_rhel67-lv_home
                       25G   44M   23G   1% /home

ubuntu – increase the size of a linux lvm

create LVM partition in new hardisk
===================================

sudo fdisk /dev/sdb
'n' create new partition
'p' primary partition
'1' partition number
[enter] for first cylinder
[enter] for last cylinder(max size)
't' type for paritition
'L' for list all
'8e' for linux.lvm
'w' for write partition

increasing the logical volume
====================================
# create a physical volume for later use by the LVM.

$ sudo pvcreate /dev/sdb1

03-disk-partitioan-create
# shown the name and the current size of it

$ sudo vgdisplay

# pvscan scan all disks for physical volumes

$ sudo pvscan

# increase the logical volume with the lvextend command
# my name volume is “ubuntu-vg”

$ sudo vgextend ubuntu-vg /dev/sdb1

# pvscan scan all disks for physical volumes

$ sudo pvscan

04-vgdisplay-after-extend
#c onfirm the name of the logical volume using lvdisplay.

$ sudo lvdisplay
--- Logical volume ---
LV Path                /dev/ubuntu-vg/root
LV Name                root
VG Name                ubuntu-vg

# The logical volume is then extended using the lvextend command
# We are extending the original logical volume of

#/dev/ubuntu-vg/root over the newer /dev/sdb1

$ sudo lvextend /dev/ubuntu-vg/root /dev/sdb1
Size of logical volume ubuntu-vg/root changed from 4.83 GiB (1236 extents) to 24.82 GiB (6355 extents).
Logical volume root successfully resized

#show vgdisplay

$ sudo vgdisplay
--- Volume group ---
VG Name               ubuntu-vg
...
VG Size               29.75 GiB

# However if you run a “df” command to see available disk space it will not have changed
# yet as there is one final step, we need to resize the file system using the
# resize2fs command in order to make use of this space.

$ sudo resize2fs /dev/ubuntu-vg/root
resize2fs 1.42.12 (29-Aug-2014)
Filesystem at /dev/ubuntu-vg/root is mounted on /; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 2
The filesystem on /dev/ubuntu-vg/root is now 6507520 (4k) blocks long.

#show size with df

$ df -h

07-df-h
# Alternatively if you’re running the XFS file system (default as of RedHat/CentOS 7)
# you can grow the file system with “xfs_growfs /dev/ubuntu-vs/root”.

https://www.rootusers.com/how-to-increase-the-size-of-a-linux-lvm-by-adding-a-new-disk/