summaryrefslogtreecommitdiff
path: root/scripts
Commit message (Collapse)AuthorAgeFilesLines
* tests: cleanup some shellcheck warnsZdenek Kabelac2023-02-101-2/+2
| | | | | | | | | | | | | | | Reduce shellcheck warnings about missing {} for possible array dereference. Make sure we are not loosing error code when assigning local vars and explicitely ignore 'errors' from standalone lines when needed. Add some missing quotes. Use $() instead of ancient `` Avoid writing some temporary data into /tmp - test need to store files within its own 'testdir' - so it can be properly discarded.
* lvresize_fs_helper: cleanup shellcheck warnsZdenek Kabelac2023-02-101-35/+19
| | | | | Use commands directly in 'if cmd; then'. Use shell vars in $(( )) in recommended way.
* lvresize: fix cryptsetup resize in helperDavid Teigland2023-01-031-1/+1
| | | | | | | | typo used "cryptresize" as command name this affects cases where the file system is resized independently, and then the lvresize command is used which only needs to resize the crypt device and the LV.
* make: Fix build in chrootdev-mcsontos-lib-tools-dependencyMarian Csontos2022-09-201-0/+1
| | | | When building in a buildroot, must create libexec directory explicitly.
* lvresize: add new options and defaults for fs handlingDavid Teigland2022-09-133-2/+472
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new option "--fs String" for lvresize/lvreduce/lvextend controls the handling of file systems before/after resizing the LV. --resizefs is the same as --fs resize. The new option "--fsmode String" can be used to control mounting and unmounting of the fs during resizing. Possible --fs values: checksize Only applies to reducing size; does nothing for extend. Check the fs size and reduce the LV if the fs is not using the affected space, i.e. the fs does not need to be shrunk. Fail the command without reducing the fs or LV if the fs is using the affected space. resize Resize the fs using the fs-specific resize command. This may include mounting, unmounting, or running fsck. See --fsmode to control mounting behavior, and --nofsck to disable fsck. resize_fsadm Use the old method of calling fsadm to handle the fs (deprecated.) Warning: this option does not prevent lvreduce from destroying file systems that are unmounted (or mounted if prompts are skipped.) ignore Resize the LV without checking for or handling a file system. Warning: using ignore when reducing the LV size may destroy the file system. Possible --fsmode values: manage Mount or unmount the fs as needed to resize the fs, and attempt to restore the original mount state at the end. nochange Do not mount or unmount the fs. If mounting or unmounting is required to resize the fs, then do not resize the fs or the LV and fail the command. offline Unmount the fs if it is mounted, and resize the fs while it is unmounted. If mounting is required to resize the fs, then do not resize the fs or the LV and fail the command. Notes on lvreduce: When no --fs or --resizefs option is specified: . lvextend default behavior is fs ignore. . lvreduce default behavior is fs checksize (includes activating the LV.) With the exception of --fs resize_fsadm|ignore, lvreduce requires the recent libblkid fields FSLASTBLOCK and FSBLOCKSIZE. FSLASTBLOCK*FSBLOCKSIZE is the last byte used by the fs on the LV, which determines if reducing the fs is necessary.
* vdo: fix conversion of vdo_slab_size_mb 2ndZdenek Kabelac2022-07-111-1/+1
| | | | | | | Patch 1b070f366ba57a6eb24df03241284732db5047e9 should have been already fixing this issue but since it the incorrect patch rebasing the change to vdo_slabSize got lost. So again now with explicit one-line patch.
* vdo: fix conversion of vdo_slab_size_mbZdenek Kabelac2022-06-071-12/+3
| | | | | | | | | | | | When converting VDO volume, the parameter vdo_slabSize was incorrectly copied as vdo_blockMapCacheSize, however this parameter is then no longer used for any table line creation so the wrong value was only stored in metadata. Also use just single get_kb_size_with_unit_ and remove it's duplicate functionality with get_mb_size_with_unit_. Use $VERB for vdo remove call.
* remove static autoactivationDavid Teigland2022-01-275-470/+2
| | | | | | | | | event based autoactivation is now the only method that lvm provides for autoactivation. Setting lvm.conf event_activation=0 can still be used to disable event based autoactivation commands, but doing so will no longer enable static autoactivation.
* vdo: ensure VDO config is removedAndrew Walsh2021-12-201-0/+6
| | | | | | | Make sure to remove the VDO config after conversion of LVM-backed VDO. Addresses point 3 in rhbz#1987024#c5
* lvm2-pvscan: include --autoactivation eventDavid Teigland2021-11-041-1/+1
| | | | | in the pvscan --cache -aay command so that the use of the command for event activation is explicit.
* new udev autoactivationDavid Teigland2021-10-071-1/+0
| | | | | | | | | | | | | | new udev rule 69-dm-lvm.rules replaces 69-dm-lvm-meta.rules and lvm2-pvscan.service udev rule calls pvscan directly on the added device pvscan output indicates if a complete VG can be activated udev env var LVM_VG_NAME_COMPLETE is used to pass complete VG name from pvscan to the udev rule udev rule uses systemd-run to run vgchange -aay <vgname>
* shellcheck: warning enhancementsZdenek Kabelac2021-09-211-1/+1
|
* cleanup: better wordingZdenek Kabelac2021-09-201-1/+1
| | | | Follow-up advice of native speaker.
* cleanup: typo fixZdenek Kabelac2021-09-171-1/+1
|
* lvm_import_vdo: --dry-run automatically verboseZdenek Kabelac2021-09-171-2/+2
| | | | Dry-run is way more usable when it's verbose.
* vdo: prompt with no return failureZdenek Kabelac2021-09-131-1/+1
| | | | Exit 1 (failure) when prompt for conversion is answered as 'No'.
* vdo: lvm_import_vdo script needs to continue when vgname does not existZdenek Kabelac2021-09-131-1/+1
| | | | When the script cannot find vgname - it needs to continue to run.
* vdo: more lvm_import_vdo fixesZdenek Kabelac2021-09-061-7/+41
| | | | | | | | | | | Do not call 'dmsetup info' for non-dm devices. Better handling for VGNAME and LVNAME - so when convering LV as backend device automatically recognize it and reuse LV name for VDOLV. Add prompt for final confirmation before actual conversion is started (once confirmed, lvm2 commands no longer prompts to avoid leaving conversion in the middle of its process.)
* vdo: better message for missing deviceZdenek Kabelac2021-09-061-9/+10
| | | | | Show readable message when passed device cannot be accessed. And use STAT shell var wrapper to call 'stat' command.
* vdo: lvm_import_vdo fix max_discard sizeZdenek Kabelac2021-09-061-1/+1
| | | | Use correct 4K units in lvm2 for max_discard VDO option.
* vdo: fixesZdenek Kabelac2021-08-311-17/+53
| | | | | | Better identify VDO device with major:minor. Handle different LV name from originally converted origin LV. Improve --dry-run handling.
* vdo: rename vdoimport to lvm_import_vdoZdenek Kabelac2021-08-262-5/+5
| | | | Missed bits in previous rename commits.
* vdo: Rename vdoimport to lvm_import_vdo.Marian Csontos2021-08-262-2/+2
|
* vdo: add vdoimport supportZdenek Kabelac2021-07-092-0/+380
| | | | | | | | | | | | | Add tool 'vdoimport' to support easy conversion of an existing VDO manager managed VDO volumes into lvm2 managed VDO LV. When physical converted volume is already a logical volume, conversion happens with the VG itself, just with validation for extent_size, so the virtually sized logical VDO volume size can be expressed in extents. Example of basic simple usage: vdoimport --name vg/vdolv /dev/mapper/vdophysicalvolume
* shellcheck: updatesZdenek Kabelac2021-04-233-8/+8
| | | | Ehance some shellcheck reported issues.
* fsadm: handle error from blkidZdenek Kabelac2021-03-241-1/+1
| | | | | | Fsadm wants to print its own error message when it can't detect type of the filesystem on a block device. Otherwise fsadm exits with no message on an unused block device.
* fsadm: fix condition when using --getsize64Zdenek Kabelac2021-03-241-1/+1
| | | | | | | When blocksize --getsize64 gives empty result we want to fallback to ancient --getsize * --getss calculation (RHBZ #1942486). Reported by: ajschorr@alumni.princeton.edu
* git: update .gitignoreZdenek Kabelac2021-03-191-2/+3
| | | | Hide some files from older builds.
* shellcheck: avoid assign warningsZdenek Kabelac2021-03-152-45/+45
| | | | Shellcheck seems to be happier when assigning variables with quotes.
* makefiles: better loggingZdenek Kabelac2021-03-021-5/+5
| | | | | Show only filename instead of full path name when building in builddir != srcdir
* fsadm: avoid access to unbound variableZdenek Kabelac2021-02-231-1/+1
|
* fsadm: fix unbound variable usageZdenek Kabelac2020-12-081-2/+6
| | | | | | | When 'fsadm resize vg/lv' is used without size, it should just resize filesystem to match device - but since we now check for unbound variable in bash - the previous usage no longer works and needs explicit check.
* fsadm: better check for getsize64 supportZdenek Kabelac2020-10-261-8/+5
| | | | | | | | | | Older blockdev tool return failure error code with --help, and since now the tool abort on command failure, lets detect missing --getsize64 support directly by running command and check if it returns something usable. It's likely very hard to have the system with such old blockdev tool and newer lvm2 compiled.
* fsadm: enhance error handlingZdenek Kabelac2020-10-241-19/+28
| | | | | | | Set more secure bash failure mode for pipilines. Avoid using unset variables. Enhnace error reporting for failing command. Avoid using error via 'case..esac || error'.
* fsadm: handle fsck return 1 for corrected fsZdenek Kabelac2020-10-241-7/+18
|
* fsadm: use NULLZdenek Kabelac2020-10-241-10/+10
| | | | Use consistently $NULL as in other places.
* blkdeactivate: add missing VDO_AVAILABLE check in deactivate_vdoPeter Rajnoha2020-06-081-0/+6
|
* Fix scripts/lvmlocks.service.in using nonexistent --lock-opt autowaitMaxim Plotnikov2020-04-211-1/+1
| | | | | | The --lock-opt autowait was dropped back in 9ab6bdce01, and attempting to specify it has quite an opposite effect: no waiting is done, which makes the unit almost useless.
* blkdeactivate: add support for VDO in blkdeactivate scriptPeter Rajnoha2020-04-091-1/+47
| | | | | | Make it possible to tear down VDO volumes with blkdeactivate if VDO is part of a device stack (and if VDO binary is installed). Also, support optional -o|--vdooptions configfile=file.
* systemd: put back DefaultDependencies=no for lvmpolld socket unitPeter Rajnoha2019-04-111-0/+2
| | | | | | Previous commit 0cab341e1d0e8f9089d3c62d3adbec24dfd5e124 removed this by mistake - we have to keep the DefaultDependencies=no - the sockets.target is after sysinit.target.
* systemd: add missing Before=shutdown.target to LVM2 services to fix shutdown ↵Peter Rajnoha2019-04-096-4/+6
| | | | | | | | | | ordering We already used Conflicts=shutdown target to stop LVM2 services on shutdown. But we still missed the ordering - the shutdown.target should be reached only after all the services are really stopped. Reported here: https://github.com/lvmteam/lvm2/issues/17
* gitignore: updateZdenek Kabelac2019-03-201-0/+3
|
* pvscan service: use StartLimitIntervalSecDavid Teigland2019-02-281-1/+1
| | | | systemd changed the name
* generators: avoid contacting syslog with generatorsZdenek Kabelac2019-01-081-0/+3
| | | | | | | | | | | | | | | | The systemd generators are executed very early during the switch from initramfs to system partition and the syslog is not yet fully operational - it may cause blocking, if some debug logging is enabled at the same time in /etc/lvm/lvm.conf log{} section. To avoid timeouting and killing this generator - rather enhance lvm code to suppress any syslog communication when LVM_SUPPRESS_SYSLOG envvar is set. Use of this envvar is needed since the parsing of i.e. cmdline options that could eventually override lvm.conf setting happens in this case way too late and number of lines could have been already streamed to syslog.
* scripts: lvm2-activation-generator fix lvmconfig callPeter Rajnoha2019-01-082-6/+12
| | | | | | | | | | | Fix a scenario where global/event_activation setting is not found. In this case we need to take default value just like lvm tools do when executed. So use "lvmconfig --type full". Also, if we fail to execute lvmconfig for whatever reason, fallback to generating the activation units as failsafe action. Reported by: Bastian Blank <waldi debian org>
* cleanup: missing copyright headerZdenek Kabelac2018-12-211-0/+14
|
* scripts: simplify including for generatorZdenek Kabelac2018-12-212-20/+2
| | | | Uses included .c file as primary header includer.
* scripts: avoid voiding write resultZdenek Kabelac2018-12-211-1/+2
| | | | Gcc doesn't want to ignore write() return code.
* makefiles: correcting login of makefileZdenek Kabelac2018-12-171-2/+2
| | | | | | Fixing some ordering issue with inclusion of common make.tmpl. Correcting dependency calculation Simplifying inclusive makefile
* makefiles: missing cleaningZdenek Kabelac2018-12-171-0/+1
|