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

Screen Shot 2012-12-31 at 1.02.46 AM

Choose Hard Disk (SCSI) menu to increase the size of an availabe virtual disk (in this case your root file system disk)

Screen Shot 2012-12-31 at 1.07.12 AMGrow your virtual disk to a proper size (In this case I grow it form 28GB to 34GB)

Screen Shot 2012-12-31 at 1.07.23 AM

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

  1. fdisk /dev/sda
  2. d (to delete)
  3. 2 (to delete partition 2)
  4. n (to create a new partition)
  5. p (to create a new partition with primary type)
  6. 2 (to create a new primary partition with id 2)
  7. Accept all defaults (to create a new primary partition with default offset and fully covering virtual disk you have already provisioned)
  8. 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

resize2fs /dev/VolGroup00/LogVol00

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.

About these ads

About kocakahin

Just a computer engineer

Posted on December 31, 2012, in Linux and tagged , . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 173 other followers

%d bloggers like this: