1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

Use 'lvm lvresize' instead of 'lvresize' in fsadm.

Do not use '-n' realine option in fsadm for busybox compatiblity.
This commit is contained in:
Zdenek Kabelac 2009-06-09 15:31:36 +00:00
parent 6efacee75c
commit 33048414d4
2 changed files with 15 additions and 7 deletions

View File

@ -1,5 +1,7 @@
Version 2.02.48 - Version 2.02.48 -
=============================== ===============================
Use 'lvm lvresize' instead of 'lvresize' in fsadm.
Do not use '-n' realine option in fsadm for busybox compatiblity.
Update vgrename, vgsplit, and vgcreate to use vg_lock_newname. Update vgrename, vgsplit, and vgcreate to use vg_lock_newname.
Add vg_lock_newname() library function. Add vg_lock_newname() library function.
Round up requested readahead to at least one page and print warning. Round up requested readahead to at least one page and print warning.

View File

@ -48,7 +48,8 @@ READLINK_E="-e"
FSCK=fsck FSCK=fsck
XFS_CHECK=xfs_check XFS_CHECK=xfs_check
LVRESIZE=lvresize # user may override lvm location by setting LVM_BINARY
LVM=${LVM_BINARY-lvm}
YES= YES=
DRY=0 DRY=0
@ -66,6 +67,9 @@ MOUNTED=
REMOUNT= REMOUNT=
IFS_OLD=$IFS IFS_OLD=$IFS
# without bash $'\n'
NL='
'
tool_usage() { tool_usage() {
echo "${TOOL}: Utility to resize or check the filesystem on a device" echo "${TOOL}: Utility to resize or check the filesystem on a device"
@ -124,7 +128,7 @@ cleanup() {
# start LVRESIZE with the filesystem modification flag # start LVRESIZE with the filesystem modification flag
# and allow recursive call of fsadm # and allow recursive call of fsadm
unset FSADM_RUNNING unset FSADM_RUNNING
test "$DO_LVRESIZE" -eq 2 && exec $LVRESIZE $VERB -r -L$(( $NEWSIZE / 1048576 )) $VOLUME test "$DO_LVRESIZE" -eq 2 && exec $LVM lvresize $VERB -r -L$(( $NEWSIZE / 1048576 )) $VOLUME
exit ${1:-0} exit ${1:-0}
} }
@ -155,7 +159,9 @@ decode_size() {
# dereference device name if it is symbolic link # dereference device name if it is symbolic link
detect_fs() { detect_fs() {
VOLUME=${1#/dev/} VOLUME=${1#/dev/}
VOLUME=$($READLINK $READLINK_E -n "/dev/$VOLUME") || error "Cannot get readlink $1" VOLUME=$($READLINK $READLINK_E "/dev/$VOLUME") || error "Cannot get readlink $1"
# strip newline from volume name
VOLUME=${VOLUME%%$NL}
# use /dev/null as cache file to be sure about the result # use /dev/null as cache file to be sure about the result
# not using option '-o value' to be compatible with older version of blkid # not using option '-o value' to be compatible with older version of blkid
FSTYPE=$($BLKID -c /dev/null -s TYPE "$VOLUME") || error "Cannot get FSTYPE of \"$VOLUME\"" FSTYPE=$($BLKID -c /dev/null -s TYPE "$VOLUME") || error "Cannot get FSTYPE of \"$VOLUME\""
@ -324,8 +330,7 @@ resize() {
#if [ -n "$NEWSIZE" -a $NEWSIZE < #if [ -n "$NEWSIZE" -a $NEWSIZE <
test -z "$NEWSIZE" && NEWSIZE=${DEVSIZE}b test -z "$NEWSIZE" && NEWSIZE=${DEVSIZE}b
trap cleanup 2 trap cleanup 2
#IFS=$'\n' # don't use bash-ism ?? IFS=$NL
IFS="$(printf \"\\n\")" # needed for parsing output
case "$FSTYPE" in case "$FSTYPE" in
"ext3"|"ext2"|"ext4") resize_ext $NEWSIZE ;; "ext3"|"ext2"|"ext4") resize_ext $NEWSIZE ;;
"reiserfs") resize_reiser $NEWSIZE ;; "reiserfs") resize_reiser $NEWSIZE ;;
@ -359,10 +364,11 @@ test -n "$FSADM_RUNNING" && exit 0
test -n "$TUNE_EXT" -a -n "$RESIZE_EXT" -a -n "$TUNE_REISER" -a -n "$RESIZE_REISER" \ test -n "$TUNE_EXT" -a -n "$RESIZE_EXT" -a -n "$TUNE_REISER" -a -n "$RESIZE_REISER" \
-a -n "$TUNE_XFS" -a -n "$RESIZE_XFS" -a -n "$MOUNT" -a -n "$UMOUNT" -a -n "$MKDIR" \ -a -n "$TUNE_XFS" -a -n "$RESIZE_XFS" -a -n "$MOUNT" -a -n "$UMOUNT" -a -n "$MKDIR" \
-a -n "$RMDIR" -a -n "$BLOCKDEV" -a -n "$BLKID" -a -n "$GREP" -a -n "$READLINK" \ -a -n "$RMDIR" -a -n "$BLOCKDEV" -a -n "$BLKID" -a -n "$GREP" -a -n "$READLINK" \
-a -n "$FSCK" -a -n "$XFS_CHECK" -a -n "LVRESIZE" \ -a -n "$FSCK" -a -n "$XFS_CHECK" -a -n "LVM" \
|| error "Required command definitions in the script are missing!" || error "Required command definitions in the script are missing!"
$($READLINK -e -n / >/dev/null 2>&1) || READLINK_E="-f" $LVM version >/dev/null 2>&1 || error "Could not run lvm binary '$LVM'"
$($READLINK -e / >/dev/null 2>&1) || READLINK_E="-f"
TEST64BIT=$(( 1000 * 1000000000000 )) TEST64BIT=$(( 1000 * 1000000000000 ))
test $TEST64BIT -eq 1000000000000000 || error "Shell does not handle 64bit arithmetic" test $TEST64BIT -eq 1000000000000000 || error "Shell does not handle 64bit arithmetic"
$(echo Y | $GREP Y >/dev/null) || error "Grep does not work properly" $(echo Y | $GREP Y >/dev/null) || error "Grep does not work properly"