DEV Community

Hisyam Johan
Hisyam Johan

Posted on

Extend Block Volume on OCI Instance

How to Extend Boot Volume Storage in Oracle Cloud (OCI) Instance with LVM

When you increase the boot volume size of an OCI instance from the console, the new space is added to the disk, but your OS won’t automatically use it. You need to manually extend the partition, LVM physical volume, and filesystem.

This guide walks you through the steps.


1. Extend the Boot Volume in OCI Console

First, go to your OCI Instance → Boot Volume → Edit → Resize and set the desirable new size (e.g., from 50GB → 100GB).


2. Discover the New Volume Size

Run the lsblk command to verify the new size:

lsblk

Example output after resize:

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 100G 0 disk
├─sda1 8:1 0 100M 0 part /boot/efi
├─sda2 8:2 0 1G 0 part /boot
└─sda3 8:3 0 45.5G 0 part
├─ocivolume-root 252:0 0 35.5G 0 lvm /
└─ocivolume-oled 252:1 0 10G 0 lvm /var/oled

Here:

Disk sda = 100G (boot volume)

Partition sda3 = 45.5G

Inside sda3 → LVM (ocivolume-root mounted at /, ocivolume-oled at /var/oled)

At this point, the disk grew but the partition didn’t.


3. Grow Partition sda3

Install growpart utility:

sudo dnf install -y cloud-utils-growpart

Grow the partition:

sudo growpart /dev/sda 3

Verify with:

lsblk

Now sda3 should show around 99G.


4. Grow the LVM Physical Volume

sudo pvresize /dev/sda3

Check:

sudo pvs


5. Extend the Logical Volume

Currently / = ocivolume-root = 35.5G.
To extend it and use all available free space:

sudo lvextend -l +100%FREE /dev/ocivolume/root


6. Grow the Filesystem

If using XFS (default for Oracle Linux 8):

sudo xfs_growfs /

If using ext4, run instead:

sudo resize2fs /dev/ocivolume/root


7. Verify the New Size

df -h

Your / should now be close to 90G, depending on how much space you allocated.

Top comments (0)