How to expand striped volume in azure linux VM

striped volume in azure linux VM

Before increase the size of a striped logical volume, it must have enough free space on the underlying physical volumes that make up the volume group to support the stripe. Let’s see how to expand stripped volume in Azure Linux VM.

For instance, if you have a two-way striped VG, adding a single physical volume to the VG will not allow you to extend the striped volume. You must need to add at least two physical volumes to the VG.

Let’s understand with the below example

Azure Managed Disk

Below is the VG1

# vgs   

VG            #PV #LV #SN     Attr   VSize   VFree 
vg1           2   0   0       wz--n- 271.31G 271.31G

 

You can create a stripe using the entire amount of space in the volume group.

# lvcreate -n stripe1 -L 271.31G -i 2 vg1
  Using default stripesize 64.00 KB
  Rounding up size to full physical extent 271.31 GB
  Logical volume "stripe1" created
# lvs -a -o +devices
  LV      VG  Attr   LSize   Snap% Copy% Devices
  stripe1 vg1 -wi-a- 271.31G             /dev/sda1(0),/dev/sdb1(0)

Note that VG1 now has no more free space.

# vgs

VG     #PV #LV #SN Attr   VSize   VFree

vg1     2   1   0   wz--n- 271.31G    0

Suppose we added a new LUN /dev/sdc1 of size 135G and extending VG.

# vgextend vg1 /dev/sdc1

  Volume group "vg1" successfully extended
# vgs

  VG     #PV #LV #SN Attr   VSize   VFree

  vg1     3   1   0 wz--n- 406.97G 135.66G

You will not be able to extend the striped logical volume to the full size of the volume group because two underlying devices are needed in order to stripe the data.

# lvextend vg1/stripe1 -L 406G
Using stripesize of last segment 64.00 KB
Extending logical volume stripe1 to 406.00 GB
Insufficient suitable allocatable extents for logical volume stripe
1: 34480 more required

So if you do not have enough underlying physical devices to extend the striped logical volume, it is possible to extend the volume anyway if it does not matter that the extension is not striped, which may result in an uneven performance.

When adding space to the logical volume, the default operation is to use the same striping parameters of the last segment of the existing logical volume, but you can override those parameters.

The following example extends the existing striped logical volume to use the remaining free space after the initial lvextend command fails.

# lvextend -i1 -l+100%FREE vg1/stripe1  

But it is not the correct way as stated above you need to have stripped LV to extend to avoid performance issues or it will waste the whole objective of using stripped volumes for better performance.

To extend the striped logical volume, add another physical volume, and then extend the logical volume. We have added another LUN, having added two physical volumes to the volume group we can extend the logical volume to the full size of the volume group.

# vgextend vg1 /dev/sdd1
Volume group "vg1" successfully extended
# vgs
VG     #PV #LV #SN Attr   VSize   VFree
vg1     4   1   0   wz--n- 542.62G 271.31G
# lvextend vg1/stripe1 -L 542G
Using stripesize of last segment 64.00 KB
Extending logical volume stripe1 to 542.00 GB
Logical volume stripe1 successfully resized

In this article, it was explained the better way to expand stripped volumes in linux.it is all about how to expand striped volume in azure linux VM.

Please note stripped LV is used to get good performance if you are using either standard storage or premium storage in azure if you do not want to use high-end costly storage like SSD.

Thanks for keep going through the above procedure. If you like you can subscribe to our newsletter to get the latest tips, tricks, and how-to steps to accomplish a specific task. Please do not hesitate to share this with all possible social accounts where ever you have a presence.

Other Related Readings you may like it…

How to increase file system in Azure without resing

How to create a Veritas file system in Solaris