Tuesday 27 July 2021

How to increase the size of root( / ) on a linux vmware

 

Increasing the size of a root partition on a Linux VM

[root@cogni01 ~]# df -h

Filesystem           Size  Used Avail Use% Mounted on

devtmpfs             2.4G     0  2.4G   0% /dev

tmpfs                2.4G     0  2.4G   0% /dev/shm

tmpfs                2.4G  9.1M  2.4G   1% /run

tmpfs                2.4G     0  2.4G   0% /sys/fs/cgroup

/dev/mapper/ol-root   51G   51G  656M  99% /

/dev/mapper/ol-home  5.0G   39M  5.0G   1% /home

/dev/sda1            497M  308M  190M  62% /boot

tmpfs                491M     0  491M   0% /run/user/54321




shut down the vm on node1 


cd "c:\Program Files\Oracle\VirtualBox"


vboxmanage list hdds


 vboxmanage modifymedium disk "E:\vmware\Rac01\cogi01\cogi01.vdi" --resize 93488


E:\vmware\Rac02\cogi02\cogi02.vdi



vboxmanage modifymedium disk "E:\vmware\Rac02\cogi02\cogi02.vdi" --resize 93488



fdisk -l


fdisk /dev/sda


[root@cogni02 ~]# fdisk /dev/sda

Welcome to fdisk (util-linux 2.23.2).


Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.



Command (m for help): n

Partition type:

   p   primary (2 primary, 0 extended, 2 free)

   e   extended

Select (default p): p

Partition number (3,4, default 3):

First sector (128960512-191463423, default 128960512):

Using default value 128960512

Last sector, +sectors or +size{K,M,G} (128960512-191463423, default 191463423):

Using default value 191463423

Partition 3 of type Linux and of size 29.8 GiB is set


Command (m for help): t

Partition number (1-3, default 3): 3

Hex code (type L to list all codes): 8e

Changed type of partition 'Linux' to 'Linux LVM'


Command (m for help): w



[root@cogni02 ~]# pvcreate /dev/sda3

  Physical volume "/dev/sda3" successfully created.




[root@cogni02 ~]# pvdisplay

  --- Physical volume ---

  PV Name               /dev/sda2

  VG Name               ol

  PV Size               61.00 GiB / not usable 4.00 MiB

  Allocatable           yes (but full)

  PE Size               4.00 MiB

  Total PE              15616

  Free PE               0

  Allocated PE          15616

  PV UUID               GK7Lru-MwVh-1Lkd-Qosy-ZpKZ-MmbE-d2N6KN


  "/dev/sda3" is a new physical volume of "29.80 GiB"

  --- NEW Physical volume ---

  PV Name               /dev/sda3

  VG Name

  PV Size               29.80 GiB

  Allocatable           NO

  PE Size               0

  Total PE              0

  Free PE               0

  Allocated PE          0

  PV UUID               i7B650-7E7m-3eBi-BLqb-aEaR-ZR3L-dHsnZQ




[root@cogni02 ~]# vgextend ol /dev/sda3


  Volume group "ol" successfully extended


[root@cogni02 ~]# lvdisplay

  --- Logical volume ---

  LV Path                /dev/ol/root

  LV Name                root

  VG Name                ol

  LV UUID                543gTj-HSc3-dKix-b1kV-QJAv-Cl12-2AJrvs

  LV Write Access        read/write

  LV Creation host, time cogni01.localdomain, 2021-06-12 19:49:35 +0530

  LV Status              available

  # open                 1

  LV Size                51.00 GiB

  Current LE             13056

  Segments               1

  Allocation             inherit

  Read ahead sectors     auto

  - currently set to     8192

  Block device           249:0


  --- Logical volume ---

  LV Path                /dev/ol/swap

  LV Name                swap

  VG Name                ol

  LV UUID                wHo57d-I8FE-QygS-i1kc-QgI5-qNe3-hmTkn5

  LV Write Access        read/write

  LV Creation host, time cogni01.localdomain, 2021-06-12 19:49:36 +0530

  LV Status              available

  # open                 2

  LV Size                5.00 GiB

  Current LE             1280

  Segments               1

  Allocation             inherit

  Read ahead sectors     auto

  - currently set to     8192

  Block device           249:1


  --- Logical volume ---

  LV Path                /dev/ol/home

  LV Name                home

  VG Name                ol

  LV UUID                84jXc0-mfRH-h2Zo-c9mA-NdIF-p793-6wkGVx

  LV Write Access        read/write

  LV Creation host, time cogni01.localdomain, 2021-06-12 19:49:36 +0530

  LV Status              available

  # open                 1

  LV Size                5.00 GiB

  Current LE             1280

  Segments               1

  Allocation             inherit

  Read ahead sectors     auto

  - currently set to     8192

  Block device           249:2




lvextend --size +29G --resizefs /dev/ol/root



df -h


[root@cogni01 ~]# df -h

Filesystem           Size  Used Avail Use% Mounted on

devtmpfs             2.4G     0  2.4G   0% /dev

tmpfs                2.4G  644M  1.8G  27% /dev/shm

tmpfs                2.4G  9.6M  2.4G   1% /run

tmpfs                2.4G     0  2.4G   0% /sys/fs/cgroup

/dev/mapper/ol-root   74G   51G   24G  69% /

/dev/mapper/ol-home  5.0G   39M  5.0G   1% /home

/dev/sda1            497M  308M  190M  62% /boot

tmpfs                491M     0  491M   0% /run/user/54321

shared_folder        500G  443G   58G  89% /media/sf_shared_folder

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


Featured post

Postgres commads

 [oracle@Tesdb ~]$ systemctl status postgresql-15 ● postgresql-15.service - PostgreSQL 15 database server    Loaded: loaded (/usr/lib/system...