openebs / lvm-localpv

Dynamically provision Stateful Persistent Node-Local Volumes & Filesystems for Kubernetes that is integrated with a backend LVM2 data storage stack.
Apache License 2.0
235 stars 92 forks source link

lvm archive eats lot of space when creating thousands of volumes #236

Open frasmarco opened 1 year ago

frasmarco commented 1 year ago

Linux LVM by default saves the previus copy of lvm configuration in /etc/lvm/archive/, this is perfectly fine normally but could become a problem when crrating thousand of LVs. As a workaround we built a copy of the container disabling LVM archive feature:

FROM docker.io/openebs/lvm-driver:1.0.0

RUN sed -i -e '/^\sarchive\s=/s/1/0/' /etc/lvm/lvm.conf

abhilashshetty04 commented 11 months ago

@frasmarco , Thanks for raising this. Can you provide more details on the issue. This seems like a requirement that you were able to handle yourself.

frasmarco commented 11 months ago

@abhilashshetty04 , sure I've been able to handle myself but we had to build a custom lvm-driver container, it should be included upstream, who ever cares or will be looking at lvm.conf archives in the localpv driver container?

abhilashshetty04 commented 10 months ago

@frasmarco , This could be a good add-on to the product. Would like to know if you want to contribute?

frasmarco commented 10 months ago

Yes, sure

abhilashshetty04 commented 10 months ago

@frasmarco , Thanks in advance!

orville-wright commented 3 months ago

@frasmarco and @abhilashshetty04 - I am moving this issues / feature request into the LocalPV-LVM repo and it will then get tracked and picked up by the new unified Mayastor project. Which will get activate very soon.

It sounds like this feature request will be useful for LocalPV-LVM, and its a great candidate for community contribution since @frasmarco has already built to solution / code.

@frasmarco are you still interested in working with us to contribute you code into openebs?

ToroNZ commented 1 month ago

This doesn't seem to be present on the 1.5.0 (latest right now) anymore:

# Using tag 1.0.0
$ sudo docker run --rm -ti --entrypoint "/bin/bash" openebs/lvm-driver:1.0.0
bash-5.0# cat /etc/lvm/lvm.conf | grep "archive ="
    archive = 1

# Using tag 1.5.0
$ sudo docker run --rm -ti --entrypoint "/bin/bash" openebs/lvm-driver:1.5.0
71465669ba7b:/# cat /etc/lvm/lvm.conf | grep "archive ="
    # archive = 1

In fact, the 1.5.0 tag doesn't have much config at all (compared to the 1.0.0 tag):

# 1.5.0
2956c3348436:/# cat /etc/lvm/lvm.conf | grep -v '^\s*#\|^\s*$'
config {
}
devices {
}
allocation {
}
log {
}
backup {
}
shell {
}
global {
    library_dir="/lib/device-mapper"
}
activation {
}
dmeventd {
}
# 1.0.0
bash-5.0# cat /etc/lvm/lvm.conf | grep -v '^\s*#\|^\s*$'
config {
    checks = 1
    abort_on_errors = 0
    profile_dir = "/etc/lvm/profile"
}
devices {
    dir = "/dev"
    scan = [ "/dev" ]
    obtain_device_list_from_udev = 1
    external_device_info_source = "none"
    cache_dir = "/etc/lvm/cache"
    cache_file_prefix = ""
    write_cache_state = 1
    sysfs_scan = 1
    scan_lvs = 0
    multipath_component_detection = 1
    md_component_detection = 1
    fw_raid_component_detection = 0
    md_chunk_alignment = 1
    data_alignment_detection = 1
    data_alignment = 0
    data_alignment_offset_detection = 1
    ignore_suspended_devices = 0
    ignore_lvm_mirrors = 1
    disable_after_error_count = 0
    require_restorefile_with_uuid = 1
    pv_min_size = 2048
    issue_discards = 0
    allow_changes_with_duplicate_pvs = 0
}
allocation {
    maximise_cling = 1
    use_blkid_wiping = 1
    wipe_signatures_when_zeroing_new_lvs = 1
    mirror_logs_require_separate_pvs = 0
    cache_pool_metadata_require_separate_pvs = 0
    thin_pool_metadata_require_separate_pvs = 0
}
log {
    verbose = 0
    silent = 0
    syslog = 1
    overwrite = 0
    level = 0
    indent = 1
    command_names = 0
    prefix = "  "
    activation = 0
    debug_classes = [ "memory", "devices", "io", "activation", "allocation", "lvmetad", "metadata", "cache", "locking", "lvmpolld", "dbus" ]
}
backup {
    backup = 1
    backup_dir = "/etc/lvm/backup"
    archive = 1
    archive_dir = "/etc/lvm/archive"
    retain_min = 10
    retain_days = 30
}
shell {
    history_size = 100
}
global {
    umask = 077
    test = 0
    units = "r"
    si_unit_consistency = 1
    suffix = 1
    activation = 1
    proc = "/proc"
    etc = "/etc"
    locking_type = 1
    wait_for_locks = 1
    fallback_to_clustered_locking = 1
    fallback_to_local_locking = 1
    locking_dir = "/run/lock/lvm"
    prioritise_write_locks = 1
    library_dir="/lib/device-mapper"
    abort_on_internal_errors = 0
    metadata_read_only = 0
    mirror_segtype_default = "raid1"
    raid10_segtype_default = "raid10"
    sparse_segtype_default = "thin"
    use_lvmetad = 0
    use_lvmlockd = 0
    system_id_source = "none"
    use_lvmpolld = 0
    notify_dbus = 1
}
activation {
    checks = 0
    udev_sync = 1
    udev_rules = 1
    verify_udev_operations = 0
    retry_deactivation = 1
    missing_stripe_filler = "error"
    use_linear_target = 1
    reserved_stack = 64
    reserved_memory = 8192
    process_priority = -18
    raid_region_size = 2048
    readahead = "auto"
    raid_fault_policy = "warn"
    mirror_image_fault_policy = "remove"
    mirror_log_fault_policy = "allocate"
    snapshot_autoextend_threshold = 100
    snapshot_autoextend_percent = 20
    thin_pool_autoextend_threshold = 100
    thin_pool_autoextend_percent = 20
    use_mlockall = 1
    monitoring = 1
    polling_interval = 15
    activation_mode = "degraded"
}
dmeventd {
    mirror_library = "libdevmapper-event-lvm2mirror.so"
    snapshot_library = "libdevmapper-event-lvm2snapshot.so"
    thin_library = "libdevmapper-event-lvm2thin.so"
}