You are here:>>>How To Increase Virtual Hard Disk Size On Oracle Linux Virtual Machine

How To Increase Virtual Hard Disk Size On Oracle Linux Virtual Machine

Video Tutorial

Step By Step Instructions

In this post I will show you how to increase Virtual Hard Disk Size on Oracle Linux 6 Virtual Machine.

As you can see my current size of my virtual hard disk is 20 GB. I want to increase it to 60 GB for some of my product installations.

  • Expand the virtual disk size to 60GB in virtual machine settings by clicking on Expand button in virtual machine settings.

Re-partition Virtual Hard Disk

  • Login to virtual machine as root
  • Execute below command to check the disk space
fdisk -l
  • Execute the commands in the below sequence.

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

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
switch off the mode (command 'c') and change display units to
sectors (command 'u').

Command (m for help): n
Command action
e extended
p primary partition (1-4)
Partition number (1-4): 3
First cylinder (2611-7832, default 2611):
Using default value 2611
Last cylinder, +cylinders or +size{K,M,G} (2611-7832, default 7832):
Using default value 7832

Command (m for help): t
Partition number (1-4): 3
Hex code (type L to list codes): 8e
Changed system type of partition 3 to 8e (Linux LVM)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
[root@localhost ~]#

  • Reboot the system
  • Now we need to create physical & logical volumes.
  • Execute below command to create physical volume
pvcreate /dev/sda3
  • Execute below command to get the name of current Volume Group
  • Execute below command to extend the Volume Group with /dev/sda3
vgextend VolGroup /dev/sda3
  • Execute below command to get Logical Volume path.
  • Execute below command to extend the Logical Volume with /dev/sda3
lvextend /dev/VolGroup/lv_root /dev/sda3
  • Execute below command to update the Logical Volume
resize2fs /dev/VolGroup/lv_root
  • Check for the new disk space
df -h
  • Thats it !! You have now increased your disk space to 60 GB.

About the Author:

I am a Senior Cloud Professional specialized in AWS Cloud with 11 years of IT experience. I am enthusiastic about Serverless Architecture. I am an expert in Oracle Fusion Middleware.

One Comment

  1. Jan February 10, 2017 at 8:56 PM - Reply

    Hello Prasad,
    It is very nice article and video. I’m coming from windows.
    Assume we have ESXi VM:
    What to do in case that you want to increase disk space but you already have 4 primary partitions?
    Adding another HDD to VM is not an option.

    Is it possible to extend existing partition without problems?

    Thank you

Leave A Comment