Allow setting/growing/shrinking LVM size by absolute values

  • Hi!

    With the lvm2 plugin, you always have to set the size of a LV to a percentage of the VG's total capacity when creating or resizing a LV.
    This is not very straight forward for me to use and feels like quite an odd decision.


    A few scenarios to proof my point:

    I create an LVM VG with two PVs, totalling to a size of 1.20 TiB or 314712 extends with 4 MiB each.


    I now want to store my movie collection on this VG, so I need to create a LV. The collection currently has 689 GiB, so adding some safety margin, I want to create a LV with a size of 890 GiB.. As I need to specify the volume as a percentage of the whole VG, I need to first figure out how much total space ,my VG has and then fire up a calculator. 1.2 TiB = 1228.8 GiB. So 890 TiB / 1228.8 TiB = 0.7243, so I need to specify 72%.

    My movie collection grows and I'm running out of space. I have added another disk to my VG in the meantime. So I have to first determine the new size of my VG, which is 2.2 TiB (=2252.8 GiB) or 576716 physical extents now.


    When I open the grow dialog on the LV and get presented with that percentage slider again. If I slide it to 10% and hit apply, it will call the lvextend utility and a brief error message which is fading away too quickly to really make sense out of it, but I could make out, that it tries to set the LV size to a value lower than it is right now, which the lvextend command does not allow.


    I want to add 200 GiB to the LV. so I'm heading back to my calculator. 890 GiB (current size) + 100 GiB = 990 GiB, 990 GiB / 2252.8 Gib = 0.439, so I need to move the slider to 44 % to get the required size.

    lvextend

    supports multiple ways of specifying the size:


    -L  allows you to specify the new size in regular size units (e.g. "1M", "50G", "2T", "400K", etc.)

    -l allows you to specify the new size in extents or percent.


    Both options allow for prefixing the value with a "+" sign, to enlarge the LV by that amount.


    Some usage examples:


    Code
    # lvextend -L +100G /dev/vg0/lv0     # add 100 GiB to the volume
    # lvextend -L 200G /dev/vg0/lv0      # set the volume size to the absolute value of 200 GiB regardless of it's current size
    # lvextend -l +400 /dev/vg9/lv0      # add 400 extents to the LV. This is probably not the most useful as extent sizes could vary between VGs, but as there is no option for specifying it when creating the VG, it is most likely always the default with 4 MiB
    # lvextend -l +100%FREE /dev/vg0/lv0 # Add all the remaining available space to the volume

    I propose to enhance the GUI to allow specifying the size of a LV as absolute size or number of extents when creating it and also when growing it. For both operations, an optional percentage slider makes sense, but mostly only when using the %FREE option. So one could for example add half of the remaining space to a LV.

    If a LV is making up 70% of a VG it doesn't make sense to "grow" it to 50% of the total size. However, it makes a lot of sense to add 50% of the remaining free space.


    If I should rather file this as an issue on github, let me know please. I'm happy to do so.


    Cheers

    nomike

    • Offizieller Beitrag

    Thanks for your explanation. The UI is implemented as it is because the UI elements are not that reactive as it should be to support that features. Using sliders and percentage values was the only compromise that is possible. If you or someone else has the feeling that the UI should be dramatically improved here, the project is happy to get code contributions. But i can tell you that i tried my best already, so this will not be an easy way to go.


    Personally i do not want to invest any time into the LVM plugin anymore because if the UI does not meet the requirements of a user they can be easily go to CLI as a fallback and create the LVM setup there.


    Keep in mind that such a configuration can be very complex and the UI can not reflect all the existing ways LVM userland tools allow users to create and manage a LVM. The UI is meant for users that do not have any knowledge about LVM. It was and is not intended to create a full-featured user interface that meets all demands and expectations.

  • votdev

    Hat das Label OMV 6.x hinzugefügt.
    • Offizieller Beitrag

    To give some insight about the "Why is OMV doing it that way".


    The whole UI is implemented in a declarative manner, you can call it no-code. This innovativ approach has been choosen to simplify the plugin implementation. Plugin devs do not need to be familar with a specific UI framework. Sadly this declarativ approach has a disadvantage that the number and features of the available UI controls is limited, e.g. it is not possible to add a read-only input form field that displays the target volume size based on the current slider position in the LV create page.


    You'll understand when you see how this page is implemented:

    This is pure YAML which is renderd during runtime. This makes it complicated to impossible to implement things that react on user input. OMV supports something called "modifiers" which can be used to disable/enable controls or modify their value based on a specified constraint. But that's it. This feature set fits to 99% of the requirements of the pages that are implemented in OMV. In situations like the LVM plugin it is a compromise between "I want that functionality" and "what is possible" with the framework.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!