Resizing and Extending Disk Space in Linux – A Comprehensive Guide

  • Post author:
  • Post category:Linux
  • Post last modified:August 21, 2023

We want to extend disk space or root partition volume of our server LINUX/CentOS / Oracle Linux without loosing data.


We found this scenario in our environment that development team complaint that CentOS server mount point space is full and need to add additional space to the mount point /dev/centos/root. Server is deployed under VMWear ESXI architecture.


Whenever  partition becomes full and you wonder if you should delete some data or move to a new VM? Well, its not always necessary to migrate to another VM. You can simply extend the disk space using LVM.

Logical Volume Management (LVM) allows us to group different block devices into a single larger device that can be handled as one.

The kernel LVM module that allows us to use LVM is called lvm-mod. LVM allows you to grow your disk partitions to accommodate growth of data. For LVM to be used to extend your partition, the filesystem type should be Linux LVM (type 8e).

NOTE: For standard partitions, you will end up loosing data in the partition you want to grow as you must reformat it into Linux LVM type.


  1. Shutdown VM from VMware EXSI / hypervisor / virtualbox
  2. Expand the disk capacity from settings with your desired value. Here we choose to expand the VHD with additional 30 GB space.
  3. Start the VM from the VMware EXSI / hypervisor / virtualbox.
  4. Login to virtual machine console as root.
  5. Execute below command to check the disk space.

          [root@oralinuxdev ~]# df -h

Extending Disk Space- df-h

Step 1:

to verify available disk space, use below command

[oracle@oralinuxdev ~]$ fdisk -l

Extending Disk Space- fdisk -l

Step 2:

To verify detail physical drive, use the following command

[root@oralinuxdev ~]# lsblk

Extending Disk Space-lsblk

Step 3:

  1. Now execute this below command to initialize the expanded space and mount it.

[root@oralinuxdev ~]#    fdisk /dev/sda.

  • Type p to select partition

Command (m for help) : p

  • After this enter ‘n’ in the next line for creating new partition.

Select partition type as p (primary)

  • Then assign the partition number you wish based on your existing partition numbering or press enter to select default 3.

Type command “P” .

Command (m for help) : p

  • Then type command “t”

Command (m for help) : p

To select partition number press enter key for default.

  • Type command “L”.
Extending Disk Space- creating partition

Hex Code ) type L to list all codes) : L

  • In the next line choose code ‘8e’ for select the LINUX OS. Message will show “ changed type of partition LINUX to LINUXLVM.
Extending Disk Space-2
  • Type command “m”

Command ( m for help): m

  • Next enter command ‘w’ to proceed further. Then message will show “ the partition table has altered.”

Step 4:

Here see new partition has added with the  name  sda3

[root@oralinuxdev ~]# df -h

  • At this step reboot system

[root@oralinuxdev ~]# reboot

Step 5: Creating Physical Volume

Now we need to create physical & logical volumes execute below command

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

Step 6: Creating volume Group

Execute below command to get the name of current Volume Group

[root@oralinuxdev ~]# Vgdisplay

Step 7: Creating logical volume

Execute below command to extend the Volume Group with /dev/sda3

  [root@oralinuxdev ~]#  vgextend VolGroup /dev/sda3

Execute below command to get Logical Volume path.

  [root@oralinuxdev ~]#  lvdisplay

Step 8: Extending Logical Volume

Execute below command to extend the Logical Volume with /dev/sda3

[root@oralinuxdev ~]#   lvextend /dev/VolGroup/lv_root /dev/sda3

Execute below command to update the Logical Volume

[root@oralinuxdev ~]#  xfs_growfs /dev/VolGroup/lv_root

Step 9: Extend Logical Volume to extended physical Partition

Now extend logical volume to extended physical partition created

Step 10: verify disk space

Finally verify the partition has extended using below command.

 [root@oralinuxdev ~]# df -h

For more in-depth information, you can refer to the official documentation of tools like GParted and LVM.


This guide provides you with a comprehensive understanding of resizing and extend disk space in Linux. By following the step-by-step instructions and expert tips, you can effectively manage your system’s storage and ensure its optimal performance. Don’t let shrinking disk space hold you back—empower yourself with the knowledge to keep your Linux environment running smoothly.

Read More Topics:

Easy Steps to Install Xrdp Server (Remote Desktop) on Oracle Linux 9.2

Leave a Reply