Best Practices for Extending Striped LVM Storage in SAP HANA on AWS
This article provides a step-by-step guide for correctly extending striped LVM configurations used by SAP HANA on Amazon EC2. It addresses a common pitfall where resizing existing EBS volumes leads to linear allocation instead of maintaining the striped layout, causing performance degradation. Covers key prerequisites, the correct procedure for adding physical volumes while preserving stripe consistency, and verification steps to ensure optimal I/O performance.
Introduction
When running SAP HANA on Amazon EC2, storage performance is critical to maintaining optimal database operations. SAP HANA deployments commonly use striped Logical Volume Manager (LVM) configurations across multiple Amazon EBS volumes to achieve the required I/O throughput. However, extending these striped logical volumes requires careful planning to avoid introducing performance degradation.
This article explains the correct procedure for extending a striped LVM used by SAP HANA on Amazon EC2, ensuring that the striping layout is preserved and performance remains consistent.
Problem Statement
A common misconception is that you can simply modify an existing EBS volume's size and then extend the logical volume considering LVM consist of multiple EBS volumes. When you do this on a striped LVM, the newly extended space falls under a linear allocation rather than maintaining the striped layout. This results in SAP HANA performance-related issues due to uneven I/O distribution across the underlying physical volumes.
If a customer inadvertently extends a striped LVM in a linear fashion, the remediation path requires recreating the LVM from scratch, copying the data, and synchronizing with the respective node — a time-consuming and disruptive operation.
Key Considerations
Matching Physical Volume Requirements: In order to increase the size of a striped logical volume, there must be enough free space on the underlying physical volumes that make up the volume group to support the stripe. For example, if you have a four-way stripe that uses up an entire volume group, adding only two physical volumes to the volume group will not enable you to extend the stripe. Instead, you must add at least four physical volumes to the volume group.
Avoiding Linear Extension: If you do not have enough underlying physical devices to extend the striped logical volume, it may be possible to extend the volume anyway — but the extension will not be striped, which results in uneven performance. This approach is NOT recommended due to the performance issues you will likely encounter with SAP HANA workloads.
Default Striping Behavior: 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. You can override those parameters, but maintaining consistency is recommended.
Physical Volume Sizing: All new physical devices used for extending the striped logical volume must be of the same size as each other. However, the new set of physical volumes does not need to match the size of the existing physical volumes in the volume group.
Solution Walkthrough
Step 1: Verify Current LVM Configuration
First, examine the existing physical volumes, volume group, and logical volume layout:
# pvs PV VG Fmt Attr PSize PFree /dev/sdb vghanadata lvm2 a-- <8.00g 0 /dev/sdc vghanadata lvm2 a-- <8.00g 0 /dev/sdd lvm2 --- 8.00g 8.00g <<<== New PV (can be 100 GB) /dev/sde lvm2 --- 8.00g 8.00g <<<== New PV (can be 100 GB; must match /dev/sdd size)# vgs VG #PV #LV #SN Attr VSize VFree vghanadata 2 1 0 wz--n- 15.99g 0# lvs -a -o+lv_layout,lv_role,stripes,devices LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert Layout Role #Str Devices lvhanadata vghanadata -wi-ao---- 15.99g striped public 2 /dev/sdb(0),/dev/sdc(0)This confirms the logical volume
lvhanadata is using a 2-way stripe across /dev/sdb and /dev/sdc .Step 2: Add New Physical Volumes to the Volume Group
Extend the volume group by adding the new physical volumes. Ensure you add at least the same number of physical volumes as the stripe count (in this case, 2):
# vgextend vghanadata /dev/sdd /dev/sde Volume group "vghanadata" successfully extendedVerify the volume group now reflects the additional space:
# vgs VG #PV #LV #SN Attr VSize VFree vghanadata 4 1 0 wz--n- 31.98g 15.99gStep 3: Extend the Logical Volume
Extend the logical volume using all available free space. The
lvextend command will automatically use the same striping parameters from the last segment:# lvextend -l +100%FREE /dev/vghanadata/lvhanadata Using stripesize of last segment 256.00 KiB Size of logical volume vghanadata/lvhanadata changed from 15.99 GiB (4094 extents) to 31.98 GiB (8188 extents). Logical volume vghanadata/lvhanadata successfully resized.Step 4: Grow the Filesystem
Extend the XFS filesystem to utilize the newly available space:
# xfs_growfs /dev/vghanadata/lvhanadatameta-data=/dev/mapper/vghanadata-lvhanadata isize=512 agcount=16, agsize=261952 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=1, sparse=1, rmapbt=0 = reflink=1 bigtime=1 inobtcount=1data = bsize=4096 blocks=4191232, imaxpct=25 = sunit=64 swidth=128 blksnaming =version 2 bsize=4096 ascii-ci=0, ftype=1log =internal log bsize=4096 blocks=16384, version=2 = sectsz=512 sunit=64 blks, lazy-count=1realtime =none extsz=4096 blocks=0, rtextents=0data blocks changed from 4191232 to 8384512Step 5: Verify the Striped Layout
Confirm that the extension maintained the striped layout:
# lvs -a -o+lv_layout,lv_role,stripes,devices LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert Layout Role #Str Devices lvhanadata vghanadata -wi-ao---- 31.98g striped public 2 /dev/sdb(0),/dev/sdc(0) lvhanadata vghanadata -wi-ao---- 31.98g striped public 2 /dev/sdd(0),/dev/sde(0)Both segments show
striped layout with 2 stripes each, confirming the extension preserved the striping configuration.Step 6: Detailed Verification with lvdisplay
For a comprehensive view of the segment layout:
# lvdisplay -am --- Logical volume --- LV Path /dev/vghanadata/lvhanadata LV Name lvhanadata VG Name vghanadata LV UUID hYaTJv-Ti4Z-gcV4-Er9Q-fBoT-j6ok-SWrgT5 LV Write Access read/write LV Creation host, time ip-172-31-44-77.ec2.internal, 2025-05-23 12:08:21 +0000 LV Status available # open 1 LV Size 31.98 GiB Current LE 8188 Segments 2 Allocation inherit Read ahead sectors auto - currently set to 2048 Block device 253:0
--- Segments --- Logical extents 0 to 4093: Type striped Stripes 2 Stripe size 256.00 KiB Stripe 0: Physical volume /dev/sdb Physical extents 0 to 2046 Stripe 1: Physical volume /dev/sdc Physical extents 0 to 2046
Logical extents 4094 to 8187: Type striped Stripes 2 Stripe size 256.00 KiB Stripe 0: Physical volume /dev/sdd Physical extents 0 to 2046 Stripe 1: Physical volume /dev/sde Physical extents 0 to 2046How-to Identify Misconfigured Striped Logical Volume (LVM) Configurations
#findmnt -l#lsblk -f -t -m -o +SERIAL | sed 's/vol/vol-/'#dmsetup table#pvs#vgs#lvs -a -o+lv_layout,lv_role,stripes,devices#lvdisplay -m /dev/<volume_group>/<logical_volume>#dmsetup deps /dev/<volume_group>/<logical_volume>#iostat -h -y -t -N -c -d -x -p ALL 1Summary
When extending striped LVM volumes for SAP HANA on Amazon EC2:
- Do NOT simply resize existing EBS volumes and extend the LVM — this creates linear segments.
- DO add new EBS volumes as physical volumes, matching the stripe count of the existing logical volume.
- Ensure all new physical volumes are the same size as each other (they do not need to match the original PV sizes).
- Verify the striped layout is preserved after extension using
lvsandlvdisplay -am.
- Apply same concept for other SAP workload in terms of extending LVM layout which consist of multiple EBS volumes
Related Resources
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article