Sunday, September 3, 2023

Steps to resize a Linux FS (XFS)

Steps to resize a Linux FS (XFS):

Candidate FS: /oraarch
Current: 4G
Target: 6G

1. Check the FS size current and filesystem format

df -Th /oraarch

Actual output:

[root@vcentos79-oracle-ggsrc ~]# df -Th /oraarch
Filesystem                          Type  Size  Used Avail Use% Mounted on
/dev/mapper/appdata--vg-oraarch--lv xfs   4.0G  2.9G  1.2G  71% /oraarch
[root@vcentos79-oracle-ggsrc ~]#


2. Login as root check if you have space in vg

vgs

Actual output:

[root@vcentos79-oracle-ggsrc ~]# vgs
  VG          #PV #LV #SN Attr   VSize   VFree
  appdata-vg    1   3   0 wz--n-  74.98g   25.98g
  centos        1   2   0 wz--n- <19.00g       0
  ostmpswp-vg   1   2   0 wz--n-   7.98g 1008.00m
[root@vcentos79-oracle-ggsrc ~]#

[root@vcentos79-oracle-ggsrc ~]# lsblk
NAME                        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda                           8:0    0   20G  0 disk
├─sda1                        8:1    0    1G  0 part /boot
└─sda2                        8:2    0   19G  0 part
  ├─centos-root             253:0    0   17G  0 lvm  /
  └─centos-swap             253:1    0    2G  0 lvm
sdb                           8:16   0    8G  0 disk
└─sdb1                        8:17   0    8G  0 part
  ├─ostmpswp--vg-osswap--lv 253:2    0    3G  0 lvm  [SWAP]
  └─ostmpswp--vg-ostmp--lv  253:3    0    4G  0 lvm  /tmp
sdc                           8:32   0   75G  0 disk
└─sdc1                        8:33   0   75G  0 part
  ├─appdata--vg-oradata--lv 253:4    0   15G  0 lvm  /oradata
  ├─appdata--vg-oraarch--lv 253:5    0    4G  0 lvm  /oraarch
  └─appdata--vg-u01--lv     253:6    0   30G  0 lvm  /u01
sr0                          11:0    1 50.6M  0 rom
[root@vcentos79-oracle-ggsrc ~]#
[root@vcentos79-oracle-ggsrc ~]#

lvdisplay to double confirm the vg name:

  --- Logical volume ---
  LV Path                /dev/appdata-vg/oraarch-lv
  LV Name                oraarch-lv
  VG Name                appdata-vg <<<< appdata-vg
  LV UUID                Qbg3Mu-2GIc-HePY-kcg0-HwQB-Af1R-DA5g6S
  LV Write Access        read/write
  LV Creation host, time vcentos79-oracle-ggsrc, 2023-07-16 10:25:15 +0100
  LV Status              available
  # open                 1
  LV Size                4.00 GiB
  Current LE             256
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:5




3. Increase the size using lvextend

lvextend -L +2G /dev/mapper/appdata--vg-oraarch--lv

df -Th /oraarch

Actual output:

[root@vcentos79-oracle-ggsrc ~]# lvextend -L +2G /dev/mapper/appdata--vg-oraarch--lv
  Size of logical volume appdata-vg/oraarch-lv changed from 4.00 GiB (256 extents) to 6.00 GiB (384 extents).
  Logical volume appdata-vg/oraarch-lv successfully resized.
[root@vcentos79-oracle-ggsrc ~]# echo $?
0
[root@vcentos79-oracle-ggsrc ~]#
[root@vcentos79-oracle-ggsrc ~]# df -Th /oraarch
Filesystem                          Type  Size  Used Avail Use% Mounted on
/dev/mapper/appdata--vg-oraarch--lv xfs   4.0G  2.9G  1.2G  71% /oraarch
[root@vcentos79-oracle-ggsrc ~]#


4. Resize the FS based on fs format, it will change.
ext*: resize2fs
xfs: xfs_growfs
xfs_growfs /dev/mapper/appdata--vg-oraarch--lv
df -Th /oraarch
Actual output:
[root@vcentos79-oracle-ggsrc ~]# xfs_growfs /dev/mapper/appdata--vg-oraarch--lv
meta-data=/dev/mapper/appdata--vg-oraarch--lv isize=512    agcount=4, agsize=262144 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=1048576, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 1048576 to 1572864
[root@vcentos79-oracle-ggsrc ~]#
[root@vcentos79-oracle-ggsrc ~]# df -Th /oraarch
Filesystem                          Type  Size  Used Avail Use% Mounted on
/dev/mapper/appdata--vg-oraarch--lv xfs   6.0G  2.9G  3.2G  47% /oraarch
[root@vcentos79-oracle-ggsrc ~]#


YouTube Video:



Thanks

No comments:

Post a Comment

Flashback data archive steps

 Objective: Ways to track DML changes in a table Detailed objective: We should be able to track the changes in the table at any point in tim...