Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(feat): Resize Logical Volumes #13

Merged
merged 3 commits into from
May 24, 2024
Merged

(feat): Resize Logical Volumes #13

merged 3 commits into from
May 24, 2024

Conversation

lasith-kg
Copy link
Collaborator

This PR is to add the ability to detect whether a Logical Volume needs to be resized. Rather than following the threshold approach from Physical Volumes, we implement a tolerance approach.

When ebs-bootstrap creates a Logical Volume, it specifies how much percent of the Volume Group it should use. This value is retrieved from lvmConsumption.

cat /etc/ebs-bootstrap/config.yml
devices:
  /dev/sdb:
    fs: ext4
    lvm: ifmx-var
    resizeFs: true
    lvmConsumption: 45

# ebs-bootstrap issues the following command
# lvcreate -l 45%VG -n ifmx-var ifmx-var

When we check how much percent of the Volume Group that the Logical Volume has consumed, we see that it is not exactly the value that we specified.

$ sudo lvs --units b -o lv_name,vg_name,lv_size,vg_size --nosuffix
  LV        VG        LSize       VSize      
  ifmx-var  ifmx-var   7243563008 16101933056

# % usage = (7243563008 / 16101933056) * 100 = 44.9857 %

Process

  • We generate a window of allowed usage amounts from a tolerance: (45 ± 0.1)%
  • We only resize a logical volume if the current usage is less then (45 - 0.1)%
  • We produce an error if the current usage of a Logical Volume is greater than (45 + 0.1)%. This would imply that somebody is attempting to shrink a logical volume. This is a disallowed operation

@lasith-kg lasith-kg merged commit 356f194 into main May 24, 2024
4 checks passed
@lasith-kg lasith-kg deleted the feature/lvm-lv-resize branch May 24, 2024 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants