Extending (root) volume on LVM on Pure FlashArray

This post was originally published on this site

My earlier post Online resizing of Oracle volumes on Pure FlashArray was focused on resizing Pure FlashArray volumes that were mounted directly or through Oracle ASM.  What if the volume is part of LVM and you wanted to extend the size of a logical volume?

In this post I will go over how simple it is to extend the Pure volume that is part of a LVM.
There are lot of sites in the web that talks about LVM in Linux and I wouldn’t get into that in this post but will focus on extending a logical volume that is part of a LVM.

The common use case is to extend the logical volume in a root volume to extend the space for /home or swap as the default installation of Linux (Red Hat or Oracle Linux) creates the root volume with 50GB, swap with 4GB and the rest for /home when the underlying volume is at least 50GB.

I recently installed Oracle Linux on a bare metal server with SAN boot.  I had used a Pure FlashArray volume of 200GB to host the boot LUN.  As part of the installation Oracle Linux had created 50GB of root volume, 4 GB of swap space and the remaining 145GB was allocated towards /home.

 

LVM Details

I realized I wanted to increase the size of the swap volume to 20GB instead of 4GB.  There are various ways the swap size can be increased like allocating space from different filesystem and mark it as swap or add a new volume altogether and setup swap.  I chose to extend the logical volume (/dev/ol/swap) from 4GB to 20GB but as you can see, there is no space left in the physical volume to be allocated.

Here is the high level sequence to add space and extend the logical volume.

  1. Extend the pure volume (through GUI or CLI)
  2. Rescan the device on the Linux host to reflect the new size
  3. Add a new partition to the boot lun (in this instance as partition 3)
  4. Create physical volume out of the new partition
  5. Extend the Volume group with the new physical volume
  6. Extend the logical volume

Here is how the updated logical volume will look like pictorially.

What is the benefit with this approach?

One could argue that they can create a new Pure volume altogether, attach to the host, create a physical volume out of it and add it to the volume group, which would work perfectly fine but it means a new change to the operating environment with a new volume.  If you had lot of scripts to manage your operations (be it backup or cloning ) and your existing volume was not part of a protection group, now you have to modify multiple places to reflect the new volume which makes up a logical grouping.  Rather this would make it easier to perform the change without impacting any of these scripts.

Detailed steps

  1. Edit the Pure volume in Pure GUI and increase it from 200GB to 250GB.  You can also do the same through CLI.
  2. Rescan the scsi devices with -s option on the Linux host to reflect the new size.
  3. Multipath command still shows 200G as the size.  To reflect the updated size, run the following command.  As you can see the new size is now reflected at the OS level.Note: boot_lun_nod1 is the alias for the boot lun that is on Pure.
  4. Create a new partition, in this instance the 3rd partition on the boot lun as type 8e (Linux LVM) using fdisk.
  5. As reported by fdisk, the partition table doesn’t reflect the 3rd partition. Run kpartx command to re-read the partition table.
  6. Now create the physical volume using the 3rd partition that we created.
  7. Extend the volume group with the physical volume that we just created.  As you can see vgdisplay shows the free space available as 50GB.
  8. Now we can extend the logical volume by 16G (to get to the total of 20GB) as the underlying volume group has free space available.
  9. In this example, we extended the swap space and to reflect the swap space on the system, perform the following.  If this is on any other logical volume that is mounted, use the appropriate command (like xfs_growfs or resize2fs) to extend the filesystem.

As you can see, Pure Storage has simplified the step 1 (resizing) significantly.  It is not about just resizing but in general Pure Storage has simplified various aspects of storage that Storage Administrators have lot more time in their hand to do other activities including keeping up with the trend.