Extend partition from VMWare in Oracle Linux – part 2


The client uses VMWare as virtualization platform for the Oracle Database VMs (yes, he is aware of the License implications).

The VM is running out of space in two partitions. The VMWare Admin extended the disks on their platform. Now I need to make this extension visible in Oracle Linux. This things we do once every 10 years, when versions, filesystems and tools already changed.

For this post in 2025, I’m using Oracle Linux 9, xfs filesystems. All operation are online, with databases running.

I divide this post in two parts:

Extend a mountpoint within several partitions in a block device

oracle@vmware-vm01 MIG01C $ cat /etc/system-release 
Oracle Linux Server release 9.6

The partition tree is below, and I need to increase the /u01 from 50G to 100G. The disk is /dev/sda

[root@vmware-vm01 ~]# lsblk
NAME                             MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda                                8:0    0   774G  0 disk 
├─sda1                             8:1    0   250M  0 part /boot/efi
├─sda2                             8:2    0     1G  0 part /boot
└─sda3                             8:3    0    77G  0 part 
  ├─ol_vmware-vm02-root          252:0    0    10G  0 lvm  /
  ├─ol_vmware-vm02-swap          252:1    0     4G  0 lvm  [SWAP]
  ├─ol_vmware-vm02-var_log_audit 252:2    0     1G  0 lvm  /var/log/audit
  ├─ol_vmware-vm02-u01           252:3    0    50G  0 lvm  /u01
  ├─ol_vmware-vm02-home          252:4    0     5G  0 lvm  /home
  ├─ol_vmware-vm02-var_log       252:5    0     2G  0 lvm  /var/log
  └─ol_vmware-vm02-var           252:6    0     5G  0 lvm  /var
sdb                                8:16   0   100G  0 disk 
└─sdb1                             8:17   0   100G  0 part 
  └─vg_u02-lv_u02                252:7    0   100G  0 lvm  /u02

First thing to do in a VMWare environment is to rescan the device, after that the disk was extended by VMWare admins.

[root@vmware-vm01 ~]# echo 1>/sys/class/block/sda/device/rescan

Now we can already see that the /dev/sda device is 600GB, which can be used for all partitions under it

[root@vmware-vm01 ~]# parted /dev/sda print
Model: VMware Virtual disk (scsi)
Disk /dev/sda: 644GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name                  Flags
 1      1049kB  263MB   262MB   fat16        EFI System Partition  boot, esp
 2      263MB   1337MB  1074MB  xfs
 3      1337MB  84.0GB  82.7GB                                     lvm

[root@vmware-vm01 ~]# lsblk /dev/sda
NAME                             MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
sda                                8:0    0  600G  0 disk 
├─sda1                             8:1    0  250M  0 part /boot/efi
├─sda2                             8:2    0    1G  0 part /boot
└─sda3                             8:3    0   77G  0 part 
  ├─ol_vmware-vm01-root          252:0    0   10G  0 lvm  /
  ├─ol_vmware-vm01-swap          252:1    0    4G  0 lvm  [SWAP]
  ├─ol_vmware-vm01-var_log_audit 252:3    0    1G  0 lvm  /var/log/audit
  ├─ol_vmware-vm01-home          252:4    0    5G  0 lvm  /home
  ├─ol_vmware-vm01-var           252:5    0    5G  0 lvm  /var
  ├─ol_vmware-vm01-var_log       252:6    0    2G  0 lvm  /var/log
  └─ol_vmware-vm01-u01           252:7    0   50G  0 lvm  /u01

The key element from the output above is, I need to increase the partition where the /u01 mountpoint is located. In my case it is the third partition /dev/sda3 which has now 77GB. The parted command shows the size (82.7GB) and the end point of the partition (84GB). The resize command lets to change the end point. I decide to move it to 150G.

[root@vmware-vm01 ~]# parted /dev/sda "resizepart 3 150G"
Information: You may need to update /etc/fstab.

[root@vmware-vm01 ~]# lsblk /dev/sda
NAME                             MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda                                8:0    0   600G  0 disk 
├─sda1                             8:1    0   250M  0 part /boot/efi
├─sda2                             8:2    0     1G  0 part /boot
└─sda3                             8:3    0 138.5G  0 part 
  ├─ol_vmware-vm01-root          252:0    0    10G  0 lvm  /
  ├─ol_vmware-vm01-swap          252:1    0     4G  0 lvm  [SWAP]
  ├─ol_vmware-vm01-var_log_audit 252:3    0     1G  0 lvm  /var/log/audit
  ├─ol_vmware-vm01-home          252:4    0     5G  0 lvm  /home
  ├─ol_vmware-vm01-var           252:5    0     5G  0 lvm  /var
  ├─ol_vmware-vm01-var_log       252:6    0     2G  0 lvm  /var/log
  └─ol_vmware-vm01-u01           252:7    0    50G  0 lvm  /u01

Now I need to make it visible to the physical volume, using pvresize:

[root@vmware-vm01 ~]# pvdisplay /dev/sda3
  --- Physical volume ---
  PV Name               /dev/sda3
  VG Name               ol_vmware-vm01
  PV Size               <77.01 GiB / not usable 4.00 MiB
  Allocatable           yes 
  PE Size               4.00 MiB
  Total PE              19713
  Free PE               1
  Allocated PE          19712
  PV UUID               nc8Cay-LXfL-3eIc-iJSM-cAhh-rh1V-tZ8rba
  

[root@vmware-vm01 ~]# pvresize /dev/sda3
  Physical volume "/dev/sda3" changed
  1 physical volume(s) resized or updated / 0 physical volume(s) not resized

And extend the logical volume associated with /u01 to 100% of the volume group.

[root@vmware-vm01 ~]# lvextend -l 100%VG /dev/mapper/ol_vmware-vm01-u01
  Reducing 100%VG to remaining free space <111.45 GiB in VG.
  Size of logical volume ol_vmware-vm01/u01 changed from 50.00 GiB (12800 extents) to <111.45 GiB (28531 extents).
  Logical volume ol_vmware-vm01/u01 successfully resized.

[root@vmware-vm01 ~]# lsblk /dev/sda
NAME                             MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda                                8:0    0   600G  0 disk 
├─sda1                             8:1    0   250M  0 part /boot/efi
├─sda2                             8:2    0     1G  0 part /boot
└─sda3                             8:3    0 138.5G  0 part 
  ├─ol_vmware-vm01-root          252:0    0    10G  0 lvm  /
  ├─ol_vmware-vm01-swap          252:1    0     4G  0 lvm  [SWAP]
  ├─ol_vmware-vm01-var_log_audit 252:3    0     1G  0 lvm  /var/log/audit
  ├─ol_vmware-vm01-home          252:4    0     5G  0 lvm  /home
  ├─ol_vmware-vm01-var           252:5    0     5G  0 lvm  /var
  ├─ol_vmware-vm01-var_log       252:6    0     2G  0 lvm  /var/log
  └─ol_vmware-vm01-u01           252:7    0 111.4G  0 lvm  /u01

At the end I increase the xfs filesystem of the mountpoint with xfs_growfs:

[root@vmware-vm01 ~]# df -Th /u01
Filesystem                     Type  Size  Used Avail Use% Mounted on
/dev/mapper/ol_vmware-vm01-u01 xfs    50G   47G  3.5G  94% /u01

[root@vmware-vm01 ~]# xfs_growfs /dev/mapper/ol_vmware-vm01-u01
meta-data=/dev/mapper/ol_vmware-vm01-u01 isize=512    agcount=4, agsize=3276800 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=1, rmapbt=0
         =                       reflink=1    bigtime=1 inobtcount=1 nrext64=0
         =                       exchange=0  
data     =                       bsize=4096   blocks=13107200, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1, parent=0
log      =internal log           bsize=4096   blocks=16384, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 13107200 to 29215744

[root@vmware-vm01 ~]# df -Th /u01
Filesystem                     Type  Size  Used Avail Use% Mounted on
/dev/mapper/ol_vmware-vm01-u01 xfs   112G   47G   65G  43% /u01

Leave a comment

Your email address will not be published. Required fields are marked *