How to increase more space in root filesystem?

Firstly - make sure you have additional unpartitioned storage. Then:

  1. Use fdisk to create new partition (safer than expanding existing one)

  2. Use pvcreate to create physical LVM volume:

    pvcreate /dev/sdxx
    
  3. Use vgextend to extend existing LVM group using new physical volume:

    vgextend groupname /dev/sdxx
    

    You can get group names with vgdisplay

  4. Use lvextend on lvm mapper to expand lvm volume:

    lvextend -l +100%FREE /dev/mapper/xxx
    
  5. Grow the filesystem:

    xfs_growfs /dev/mapper/xxx
    

    Or

    resize2fs /dev/mapper/xxx


[root@shsdbdr01 ~]# df -h

Filesystem             Size  Used Avail Use% Mounted on

/dev/mapper/rhel-root  8.0G  7.9G  106M  99% /

devtmpfs               966M     0  966M   0% /dev

tmpfs                  982M     0  982M   0% /dev/shm

tmpfs                  982M   11M  972M   2% /run

tmpfs                  982M     0  982M   0% /sys/fs/cgroup

/dev/sda1             1014M  179M  836M  18% /boot

tmpfs                  197M  4.0K  197M   1% /run/user/42

/dev/sdc1              9.8G   36M  9.2G   1% /tmp

/dev/sdb1               59G   45G   12G  79% /orastage

tmpfs                  197M   32K  197M   1% /run/user/10008

tmpfs                  197M     0  197M   0% /run/user/0



[root@shsdbdr01 ~]# lvdisplay

  --- Logical volume ---

  LV Path                /dev/rhel/swap

  LV Name                swap

  VG Name                rhel

  LV UUID                agp3JU-lLsG-7XDQ-IDgs-08Sa-d2qI-0m8zFR

  LV Write Access        read/write

  LV Creation host, time localhost, 2019-03-12 17:07:42 +0530

  LV Status              available

  # open                 2

  LV Size                1.00 GiB

  Current LE             256

  Segments               1

  Allocation             inherit

  Read ahead sectors     auto

  - currently set to     8192

  Block device           253:1


  --- Logical volume ---

  LV Path                /dev/rhel/root

  LV Name                root

  VG Name                rhel

  LV UUID                p8jSae-IFCO-TfXZ-rNwx-4spw-4ViP-AWgtr2

  LV Write Access        read/write

  LV Creation host, time localhost, 2019-03-12 17:07:43 +0530

  LV Status              available

  # open                 1

  LV Size                <8.00 GiB

  Current LE             2047

  Segments               1

  Allocation             inherit

  Read ahead sectors     auto

  - currently set to     8192

  Block device           253:0


Add 60 GB disk in the vmware DB Virtual Machine.


[root@shsdbdr01 ~]# fdisk -l


Disk /dev/sda: 10.7 GB, 10737418240 bytes, 20971520 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk label type: dos

Disk identifier: 0x000d0979


   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *        2048     2099199     1048576   83  Linux

/dev/sda2         2099200    20971519     9436160   8e  Linux LVM


Disk /dev/sdb: 64.4 GB, 64424509440 bytes, 125829120 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk label type: dos

Disk identifier: 0x7aa0ed84


   Device Boot      Start         End      Blocks   Id  System

/dev/sdb1            2048   125829119    62913536   83  Linux


Disk /dev/sdc: 10.7 GB, 10737418240 bytes, 20971520 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk label type: dos

Disk identifier: 0x006d7be8


   Device Boot      Start         End      Blocks   Id  System

/dev/sdc1            2048    20971519    10484736   83  Linux


Disk /dev/mapper/rhel-root: 8585 MB, 8585740288 bytes, 16769024 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes



Disk /dev/mapper/rhel-swap: 1073 MB, 1073741824 bytes, 2097152 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes



[root@shsdbdr01 ~]# pvcreate /dev/sdd

  Physical volume "/dev/sdd" successfully created.

[root@shsdbdr01 ~]# vgdisplay

  --- Volume group ---

  VG Name               rhel

  System ID

  Format                lvm2

  Metadata Areas        1

  Metadata Sequence No  3

  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               <9.00 GiB

  PE Size               4.00 MiB

  Total PE              2303

  Alloc PE / Size       2303 / <9.00 GiB

  Free  PE / Size       0 / 0

  VG UUID               YN2CWR-KBWI-Benz-M9aC-3UGs-u6aZ-SmQUsj


[root@shsdbdr01 ~]# vgextend rhel /dev/sdd

  Volume group "rhel" successfully extended

[root@shsdbdr01 ~]# vgdisplay

  --- Volume group ---

  VG Name               rhel

  System ID

  Format                lvm2

  Metadata Areas        2

  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                2

  VG Size               68.99 GiB

  PE Size               4.00 MiB

  Total PE              17662

  Alloc PE / Size       2303 / <9.00 GiB

  Free  PE / Size       15359 / <60.00 GiB

  VG UUID               YN2CWR-KBWI-Benz-M9aC-3UGs-u6aZ-SmQUsj




[root@shsdbdr01 dev]# cd mapper/

[root@shsdbdr01 mapper]# ls -ltr

total 0

crw-------. 1 root root 10, 236 Aug 20 17:48 control

lrwxrwxrwx. 1 root root       7 Aug 20 17:48 rhel-swap -> ../dm-1

lrwxrwxrwx. 1 root root       7 Aug 20 17:48 rhel-root -> ../dm-0

[root@shsdbdr01 mapper]# pwd

/dev/mapper

[root@shsdbdr01 mapper]# lvextend -l +100%FREE /dev/mapper/rhel-root

  Size of logical volume rhel/root changed from <8.00 GiB (2047 extents) to 67.99 GiB (17406 extents).

  Logical volume rhel/root successfully resized.

[root@shsdbdr01 mapper]# xfs_growfs /dev/mapper/rhel-root

meta-data=/dev/mapper/rhel-root  isize=512    agcount=4, agsize=524032 blks

         =                       sectsz=512   attr=2, projid32bit=1

         =                       crc=1        finobt=0 spinodes=0

data     =                       bsize=4096   blocks=2096128, 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 2096128 to 17823744

[root@shsdbdr01 mapper]# df -h

Filesystem             Size  Used Avail Use% Mounted on

/dev/mapper/rhel-root   68G  7.9G   61G  12% /

devtmpfs               966M     0  966M   0% /dev

tmpfs                  982M     0  982M   0% /dev/shm

tmpfs                  982M   11M  972M   2% /run

tmpfs                  982M     0  982M   0% /sys/fs/cgroup

/dev/sda1             1014M  179M  836M  18% /boot

tmpfs                  197M   12K  197M   1% /run/user/42

tmpfs                  197M     0  197M   0% /run/user/0

/dev/sdb1               59G   45G   12G  79% /orastage

/dev/sdc1              9.8G   36M  9.2G   1% /tmp

Comments

Popular posts from this blog

How to fix Oracle SQL Developer connection issue "Got minus one from a read call"

How to troubleshoot Long Running Concurrent Request in EBS 12.2

Few Important steps of Oracle Database Clone