Extending a Logical Volume Group

Introduction

Today I ran into the situation where I needed to extend a logical volume group so I could complete an installation. I’d already installed the Grid Infrastructure, but there wasn’t enough room remaining to install the Oracle kernel on the same device. This is for a test environment which was being built on a VM that had just been created, and performance is not the issue we’re looking at here, so installing the Grid Infrastructure and RDBMS on the same device is not a concern for me. I’ve been around the Oracle database for way too many years, but my sysadmin skills leave a lot to be desired, so I did what anyone in this situation would do – I googled “resize volume linux” and followed someone else’s instructions. 🙂 This post is simply to remind me how it was done in this particular configuration, so I can repeat the exercise without that extra Google step. 🙂 The steps to do this are below. Remember I’m not a sysadmin, so my terminology use etc. may be out of whack with reality.

Current Configuration

The first thing to do is to find out what the current configuration is. The configuration is one physical volume (PV), one volume group (VG) and two logical volumes (LV). We can see that using the pvs (display information about physical volumes), vgs (display information about volume groups), and lvs (display information about logical volumes) commands:

Extending the Logical Volume Group

The extra device I had to add to the logical volume group was a 16 GB device, /dev/sds:

The first step is to initialize the physical volume for later use, using the pvcreate command:

Now let’s look at the physical volume configuration, using the pvs command:

Next, add the physical volume to the volume group, using vgextend:

Let’s check the size of the volume group using the vgs command:

You can check which physical volumes are used to create a specific volume group, using the pvscan command:

You can see I’ve added one physical volume, and it is completely free. Let’s check the current size of each logical volume before expanding it, using the lvdisplay command:

Now I’m going to expand the lv_root partition, in this case using physical extends (I could also have extended using GB instead). To determine the available PE, you can use the vgdisplay command:

You can see from the “Free PE / Size” value there are 5053 free PE available, just under 20 GB. Now we can extend with the PE size, using lvextend:

The final step is to resize the file system using the resize2fs command:

And finally I can see the extra space is available:

Logical volume group successfully extended, now I can go on with my installation!

Pete

After 22 years of working at Oracle in just about every role except Marketing and Support, I am now working as a Senior Managed Services Consultant with Data Intensity, specializing in Oracle Database technology, High Availability and Disaster Recovery solutions. I am also a member of the OakTable Network, and have presented at RMOUG Training Days, Hotsos Symposia, Oracle OpenWorld conferences, and other user group events. I have co-authored the Expert Oracle Enterprise Manager 12c and Practical Oracle Database Appliance books published by Apress, and am one of the authors of the Building Database Clouds in Oracle Database 12c book published by Addison Wesley.

2 Comments:

  1. Could you please remove the HTML formatting from the code blocks? Its quite unreadable like this.

    Kind regards,
    Martien

    • Hmm, that’s bizarre, wasn’t like that when I posted it! Seems a new plugin has broken some of my previous blog posts, so bear with me while I go back and address it. If you see specific posts with lots of nbsp in it, let me know so I can address them! 🙁

Leave a Reply

Your email address will not be published. Required fields are marked *