Grow Oracle Linux Root Filesystem
It is always the case that in my Linux VM installations I run out of root file system space and need to grow it (I can hear you experienced admin, I should create another filesystem for my use and not use root file system for my joy). Here are the steps to grow root filesystem for Oracle Linux running on VMware:
Click on the wrench symbol to go to your virtual machine configuration menu
Choose Hard Disk (SCSI) menu to increase the size of an availabe virtual disk (in this case your root file system disk)
Grow your virtual disk to a proper size (In this case I grow it form 28GB to 34GB)
Now you can start your Oracle Linux on VM*.
First step at guest OS (Oracle Linux) is to grow disk partition size using fdisk. Here are the steps assuming that your root file system is on /dev/sda2 partition
- fdisk /dev/sda
- d (to delete)
- 2 (to delete partition 2)
- n (to create a new partition)
- p (to create a new partition with primary type)
- 2 (to create a new primary partition with id 2)
- Accept all defaults (to create a new primary partition with default offset and fully covering virtual disk you have already provisioned)
- w (write partition table)
Once you are done with disk partition modification rebounce Oracle Linux to ensure partition tables are read by Linux.
Once the guest OS is back, resize physical volume using pvresize. We will add 6GB (slightly less maybe) to existing physical partition using pvresize command
pvresize --setphysicalvolumesize 31G /dev/sda2
Now we can grow logical volume by 6GB
lvresize -L +6G /dev/VolGroup00/LogVol00
Final step is to grow file system online using resize2fs
You are done. You can continue filling root file system 🙂
* Before starting it is a good decision to protect your existing VM guest by using VMware snapshots.
VMware Tools for Oracle UEK
If you wish to use VMware Tools with Oracle UEK as the guest OS (you should use it in order to interact guest with the host, proper screen resolution and many other functionality) you need to perform some extra steps unlike some other Linux distros. Such as Ubuntu, which can be automatically configured by VMware
Here is the list of actions you should take for installation:
- Configure yum on your Linux installation
- Using VMware Virtual Machine menu choose Install VMware Tools option which will mount a pseudo device.
- Copy VMwareTools-8.8.4-730257.tar.gz into /tmp and extract it using tar -xzvf VMwareTools-8.8.4-730257.tar.gz
- yum install kernel-headers kernel-uek-devel
- ./vmware-install.pl as root
You are done.