summaryrefslogtreecommitdiff
path: root/scripts/fsadm.sh
Commit message (Collapse)AuthorAgeFilesLines
* lvresize: add new options and defaults for fs handlingDavid Teigland2022-09-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* shellcheck: updatesZdenek Kabelac2021-04-231-1/+1
| | | | 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
* shellcheck: avoid assign warningsZdenek Kabelac2021-03-151-27/+27
| | | | Shellcheck seems to be happier when assigning variables with quotes.
* 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.
* fsadm: shellcheck prefer explicit escapingZdenek Kabelac2018-03-231-4/+4
| | | | Backslash is literal in "\t". Prefer explicit escaping: "\\t".
* shellcheck: fsadm cleanupZdenek Kabelac2017-11-071-10/+10
| | | | Use some more "" for bash vars
* fsadm: refactor resize_crypt functionOndrej Kozina2017-10-241-28/+32
| | | | | | | | | split resize_crypt function in two. a) Detect proper dm-crypt device type and count new --size value for cryptsetup resize command. b) Perform the resize
* fsadm: rename local variables to avoid confusionOndrej Kozina2017-10-241-11/+11
|
* fsadm: fix bug in LUKS grow/shrink decision branchOndrej Kozina2017-10-241-1/+1
|
* fsadm: add luks specific error message for small devicesOndrej Kozina2017-10-241-0/+4
|
* fsadm: implement 'check' for a fs on top of LUKSOndrej Kozina2017-10-111-7/+16
|
* fsadm: fail 'check' explicitly on unsupported fs typeOndrej Kozina2017-10-111-2/+5
|
* fsadm: respect DM_DEV_DIR variableOndrej Kozina2017-10-111-3/+3
|
* fsadm: minor fixes for crypt supportOndrej Kozina2017-10-101-2/+2
| | | | | drop useless asterisk expansion enforce matching string prefix by adding ^
* fsadm: add support for crypt devicesOndrej Kozina2017-10-101-4/+138
|
* fsadm: add --helpZdenek Kabelac2017-10-051-1/+1
| | | | | Newer version of blockdev tool needs --help as the tool is no longer printing help without this option like it used to in past.
* tests: scripts double quoteZdenek Kabelac2017-07-101-3/+3
|
* fsadm: make if statement more clearZdenek Kabelac2017-06-291-3/+5
|
* fsadm: add -r to readZdenek Kabelac2017-06-291-3/+3
| | | | read without -r will mangle backslashes
* fsadm: no mixing string and arrayZdenek Kabelac2017-06-291-4/+4
| | | | Argument mixes string and array. Use * or separate argument.
* fsadm: split local var devZdenek Kabelac2017-06-291-4/+8
| | | | | Split defining of local variables from being them assigned at the same time (lossing error code).
* fsadm: remove surrounding $()Zdenek Kabelac2017-06-291-2/+2
| | | | Remove surrounding $() to avoid executing output
* fsadm: fix shell globbingZdenek Kabelac2017-06-291-35/+35
| | | | | Fixing reported issue for shellcheck. Use "" properly to avoid having shell variables split.
* fsadm: restore no answerZdenek Kabelac2017-06-191-0/+1
| | | | | | Commit 1fe4f80e45a6bfcceed5aaab97fc0e27dfcf2b88 in current version introduced regression for a terminal user, as he could not enter 'n' as answer. Add missing break for this case (No whats_new).
* fsadm: avoid hidden --yesZdenek Kabelac2017-05-231-2/+7
| | | | | | | When 'fsadm' was running without terminal (i.e. pipe), it's been automatically working like in '--yes'. Detect terminal and only accept empty "" input in this mode.
* fsadm: enhance detection of already mounted volumesZdenek Kabelac2017-05-221-9/+112
| | | | | | | Add more validation to catch mainly renamed devices, where filesystem utils are not able to handle devices properly, as they are not addressed by major:minor by rather via some symbolic path names which can change over time via rename operation.
* fsadm: always detect mounted fs with extXZdenek Kabelac2017-05-221-1/+4
| | | | | | Since we add more validation to 'detect_mounted' function make sure we always use it even with 'resize' action, so numerous validations are not skipped.
* fsadm: all path define MAJOR MINORZdenek Kabelac2017-05-101-0/+2
|
* fsadm: some cleanupZdenek Kabelac2017-05-101-27/+25
| | | | | | Put some extra "" around vars. Indent. Error messages with dots.
* fsadm: fix test of subshell return valueZdenek Kabelac2017-05-101-6/+12
| | | | | | Subshell is not returning error code value upward thus error results in this case were actually ignored. Also add dots to moved error messages.
* fsadm: use stat to get major:minor pair for non-standard /dev layoutsPeter Rajnoha2016-03-181-0/+7
| | | | | | | If we're using non-standard /dev layout so we can't get the dm-X name easily, we can't also look at the /sys/blocl/dm-X/dev to get the major:minor pair. Use "stat" in this case even though it triggers automounts (but there's no better way for now).
* fsadm: if available, use /proc/self/mountinfo to detect mounted volumePeter Rajnoha2016-03-181-4/+25
| | | | | | | | | | | The /proc/self/mountinfo is not bound to device names like /proc/mounts and it uses major:minor pairs instead. This fixes a situation in which a volume is mounted and then renamed later on - that makes /proc/mounts unreliable when detecting mounted volumes. See also https://bugzilla.redhat.com/show_bug.cgi?id=1196910.
* doc: change fsf addressZdenek Kabelac2016-01-211-1/+1
| | | | | Hmm rpmlint suggest fsf is using a different address these days, so lets keep it up-to-date
* man: fsadmZdenek Kabelac2015-10-061-2/+2
|
* fsadm: avoid using -a in testZdenek Kabelac2014-07-021-7/+7
|
* fsadm: use xfs_repair when availableZdenek Kabelac2014-01-201-2/+13
| | | | | | | | | | | | Since support for xfs_check is going to be obsoleted, replace its usage with xfs_repair -n tool. However this tool needs further intrumentation, since for really small xfs devices (having just 1 allocation group) it needs to pass in flag: "-o force_geometry". As we run the tool with '-n', it should be safe to pass this flag always. FIXME: figure way without always passing this flag.
* locales: use higher prio LC_ALL variableZdenek Kabelac2013-01-221-7/+7
| | | | | | | | | | For reseting locale environment into significantly less memory consuming version 'C' - use LC_ALL instead of LANG since it has higher priority in locale settings. Otherwise we may observe whole locale-archive which might be over 100MB on i.e. Fedora systems locked in memory with some daemons.
* Fix string parsingZdenek Kabelac2012-03-161-8/+12
| | | | | | | | | Fix propagation of -e option - pass it via internal shell variable. Fix parsing of /proc/mounts files (don't check for substrings). as reported by O.Mangold with suggested patch: https://www.redhat.com/archives/linux-lvm/2012-February/msg00030.html Properly pass arguments with spaces ("$@") Add validation for YES and EXTOFF variable content.
* Add support for DM_DEV_DIRZdenek Kabelac2011-09-191-10/+13
| | | | | Follow other commands support this directory setting. Useful for test suite.
* Add support for non /dev devicesZdenek Kabelac2011-09-191-1/+1
| | | | Since test suite is not using /dev - add support for such dirs into fsadm.
* Support different PATH settingZdenek Kabelac2011-09-191-1/+3
| | | | | | | | | When fsadm is test - it needs to execute lvm and fsadm from non-standard path setting. So adding a support in fsadm script when user set LVM_BINARY, then the lvm command invoced from fsadm will have the same PATH setting as before entering fsadm command. Needed for testing.
* Surround all executed commands with quotesZdenek Kabelac2011-09-191-41/+41
| | | | | | | In case someone would use filename paths with spaces when changing this script surround commands with '"'. With default settings there is no change in behavior.
* Fix missing '$' in testZdenek Kabelac2011-09-191-1/+1
|