public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2 ./WHATS_NEW scripts/fsadm.sh
@ 2011-09-19 13:43 zkabelac
0 siblings, 0 replies; 15+ messages in thread
From: zkabelac @ 2011-09-19 13:43 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2011-09-19 13:43:50
Modified files:
. : WHATS_NEW
scripts : fsadm.sh
Log message:
Fix missing '$' in test
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2117&r2=1.2118
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/scripts/fsadm.sh.diff?cvsroot=lvm2&r1=1.24&r2=1.25
--- LVM2/WHATS_NEW 2011/09/19 12:48:02 1.2117
+++ LVM2/WHATS_NEW 2011/09/19 13:43:50 1.2118
@@ -1,5 +1,6 @@
Version 2.02.89 -
==================================
+ Fix missing '$' in test for content of "$LVM" in fsadm script.
Move debug message in exec_cmd after sync_local_dev_names.
Fix clvmd processing of invalid request on local socket.
Fix command line option decoding.
--- LVM2/scripts/fsadm.sh 2010/11/11 12:17:15 1.24
+++ LVM2/scripts/fsadm.sh 2011/09/19 13:43:50 1.25
@@ -446,7 +446,7 @@
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 "$RMDIR" -a -n "$BLOCKDEV" -a -n "$BLKID" -a -n "$GREP" -a -n "$READLINK" \
- -a -n "$DATE" -a -n "$FSCK" -a -n "$XFS_CHECK" -a -n "LVM" \
+ -a -n "$DATE" -a -n "$FSCK" -a -n "$XFS_CHECK" -a -n "$LVM" \
|| error "Required command definitions in the script are missing!"
$LVM version >/dev/null 2>&1 || error "Could not run lvm binary '$LVM'"
^ permalink raw reply [flat|nested] 15+ messages in thread
* LVM2 ./WHATS_NEW scripts/fsadm.sh
@ 2012-03-16 12:53 zkabelac
0 siblings, 0 replies; 15+ messages in thread
From: zkabelac @ 2012-03-16 12:53 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2012-03-16 12:53:06
Modified files:
. : WHATS_NEW
scripts : fsadm.sh
Log message:
Fix string parsing
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.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2358&r2=1.2359
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/scripts/fsadm.sh.diff?cvsroot=lvm2&r1=1.29&r2=1.30
--- LVM2/WHATS_NEW 2012/03/16 10:46:25 1.2358
+++ LVM2/WHATS_NEW 2012/03/16 12:53:05 1.2359
@@ -1,5 +1,8 @@
Version 2.02.96 -
================================
+ Fix fsadm propagation of -e option.
+ Fix fsadm parsing of /proc/mounts files (don't check for substrings).
+ Fix fsadm usage of arguments with space.
Fix a regression in handling of lvchange/lvcreate --major/--minor.
Fix name conflicts that prevent down-converting RAID1 when specifying a device
Improve thin_check option passing and use configured path.
--- LVM2/scripts/fsadm.sh 2011/09/19 19:36:53 1.29
+++ LVM2/scripts/fsadm.sh 2012/03/16 12:53:06 1.30
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# Copyright (C) 2007-2010 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2007-2012 Red Hat, Inc. All rights reserved.
#
# This file is part of LVM2.
#
@@ -62,7 +62,7 @@
DRY=0
VERB=
FORCE=
-EXTOFF=0
+EXTOFF=${_FSADM_EXTOFF:-0}
DO_LVRESIZE=0
FSTYPE=unknown
VOLUME=unknown
@@ -121,7 +121,7 @@
return 0
fi
verbose "Executing $@"
- $@
+ "$@"
}
cleanup() {
@@ -141,7 +141,8 @@
# start LVRESIZE with the filesystem modification flag
# and allow recursive call of fsadm
_FSADM_YES=$YES
- export _FSADM_YES
+ _FSADM_EXTOFF=$EXTOFF
+ export _FSADM_YES _FSADM_EXTOFF
unset FSADM_RUNNING
test -n "$LVM_BINARY" && PATH=$_SAVEPATH
dry exec "$LVM" lvresize $VERB $FORCE -r -L${NEWSIZE}b "$VOLUME_ORIG"
@@ -200,10 +201,10 @@
detect_mounted() {
test -e "$PROCMOUNTS" || error "Cannot detect mounted device \"$VOLUME\""
- MOUNTED=$("$GREP" ^"$VOLUME" "$PROCMOUNTS")
+ MOUNTED=$("$GREP" "^$VOLUME[ \t]" "$PROCMOUNTS")
# for empty string try again with real volume name
- test -z "$MOUNTED" && MOUNTED=$("$GREP" ^"$RVOLUME" "$PROCMOUNTS")
+ test -z "$MOUNTED" && MOUNTED=$("$GREP" "^$RVOLUME[ \t]" "$PROCMOUNTS")
# cut device name prefix and trim everything past mountpoint
# echo translates \040 to spaces
@@ -212,8 +213,8 @@
# for systems with different device names - check also mount output
if test -z "$MOUNTED" ; then
- MOUNTED=$(LANG=C "$MOUNT" | "$GREP" ^"$VOLUME")
- test -z "$MOUNTED" && MOUNTED=$(LANG=C "$MOUNT" | "$GREP" ^"$RVOLUME")
+ MOUNTED=$(LANG=C "$MOUNT" | "$GREP" "^$VOLUME[ \t]")
+ test -z "$MOUNTED" && MOUNTED=$(LANG=C "$MOUNT" | "$GREP" "^$RVOLUME[ \t]")
MOUNTED=${MOUNTED##* on }
MOUNTED=${MOUNTED% type *} # allow type in the mount name
fi
@@ -484,6 +485,9 @@
shift
done
+test "$YES" = "-y" || YES=
+test "$EXTOFF" -eq 1 || EXTOFF=0
+
if [ -n "$CHECK" ]; then
check "$CHECK"
elif [ -n "$RESIZE" ]; then
^ permalink raw reply [flat|nested] 15+ messages in thread
* LVM2 ./WHATS_NEW scripts/fsadm.sh
@ 2011-09-19 14:52 zkabelac
0 siblings, 0 replies; 15+ messages in thread
From: zkabelac @ 2011-09-19 14:52 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2011-09-19 14:52:33
Modified files:
. : WHATS_NEW
scripts : fsadm.sh
Log message:
Add support for non /dev devices
Since test suite is not using /dev - add support for such dirs into fsadm.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2120&r2=1.2121
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/scripts/fsadm.sh.diff?cvsroot=lvm2&r1=1.27&r2=1.28
--- LVM2/WHATS_NEW 2011/09/19 13:51:09 1.2120
+++ LVM2/WHATS_NEW 2011/09/19 14:52:33 1.2121
@@ -1,5 +1,6 @@
Version 2.02.89 -
==================================
+ Add support for non /dev device paths into fsadm script.
Support different PATH setting for fsadm script testing.
Surround all executed commands with quotes in fsadm script.
Fix missing '$' in test for content of "$LVM" in fsadm script.
--- LVM2/scripts/fsadm.sh 2011/09/19 13:51:10 1.27
+++ LVM2/scripts/fsadm.sh 2011/09/19 14:52:33 1.28
@@ -177,7 +177,7 @@
detect_fs() {
VOLUME_ORIG=$1
VOLUME=${1#/dev/}
- VOLUME=$("$READLINK" $READLINK_E "/dev/$VOLUME") || error "Cannot get readlink $1"
+ VOLUME=$("$READLINK" $READLINK_E "/dev/$VOLUME") || VOLUME=$("$READLINK" $READLINK_E "$VOLUME_ORIG") || error "Cannot get readlink \"$1\""
RVOLUME=$VOLUME
case "$RVOLUME" in
/dev/dm-[0-9]*)
^ permalink raw reply [flat|nested] 15+ messages in thread
* LVM2 ./WHATS_NEW scripts/fsadm.sh
@ 2011-09-19 13:51 zkabelac
0 siblings, 0 replies; 15+ messages in thread
From: zkabelac @ 2011-09-19 13:51 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2011-09-19 13:51:10
Modified files:
. : WHATS_NEW
scripts : fsadm.sh
Log message:
Support different PATH setting
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.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2119&r2=1.2120
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/scripts/fsadm.sh.diff?cvsroot=lvm2&r1=1.26&r2=1.27
--- LVM2/WHATS_NEW 2011/09/19 13:47:37 1.2119
+++ LVM2/WHATS_NEW 2011/09/19 13:51:09 1.2120
@@ -1,5 +1,6 @@
Version 2.02.89 -
==================================
+ Support different PATH setting for fsadm script testing.
Surround all executed commands with quotes in fsadm script.
Fix missing '$' in test for content of "$LVM" in fsadm script.
Move debug message in exec_cmd after sync_local_dev_names.
--- LVM2/scripts/fsadm.sh 2011/09/19 13:47:38 1.26
+++ LVM2/scripts/fsadm.sh 2011/09/19 13:51:10 1.27
@@ -31,6 +31,7 @@
TOOL=fsadm
+_SAVEPATH=$PATH
PATH=/sbin:/usr/sbin:/bin:/usr/sbin:$PATH
# utilities
@@ -140,9 +141,10 @@
_FSADM_YES=$YES
export _FSADM_YES
unset FSADM_RUNNING
+ test -n "$LVM_BINARY" && PATH=$_SAVEPATH
dry exec "$LVM" lvresize $VERB $FORCE -r -L${NEWSIZE}b "$VOLUME_ORIG"
fi
-
+
# error exit status for break
exit ${1:-1}
}
^ permalink raw reply [flat|nested] 15+ messages in thread
* LVM2 ./WHATS_NEW scripts/fsadm.sh
@ 2011-09-19 13:47 zkabelac
0 siblings, 0 replies; 15+ messages in thread
From: zkabelac @ 2011-09-19 13:47 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2011-09-19 13:47:38
Modified files:
. : WHATS_NEW
scripts : fsadm.sh
Log message:
Surround all executed commands with quotes
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.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2118&r2=1.2119
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/scripts/fsadm.sh.diff?cvsroot=lvm2&r1=1.25&r2=1.26
--- LVM2/WHATS_NEW 2011/09/19 13:43:50 1.2118
+++ LVM2/WHATS_NEW 2011/09/19 13:47:37 1.2119
@@ -1,5 +1,6 @@
Version 2.02.89 -
==================================
+ Surround all executed commands with quotes in fsadm script.
Fix missing '$' in test for content of "$LVM" in fsadm script.
Move debug message in exec_cmd after sync_local_dev_names.
Fix clvmd processing of invalid request on local socket.
--- LVM2/scripts/fsadm.sh 2011/09/19 13:43:50 1.25
+++ LVM2/scripts/fsadm.sh 2011/09/19 13:47:38 1.26
@@ -127,7 +127,7 @@
test "$MOUNTPOINT" = "$TEMPDIR" && MOUNTPOINT="" temp_umount
if [ -n "$REMOUNT" ]; then
verbose "Remounting unmounted filesystem back"
- dry $MOUNT "$VOLUME" "$MOUNTED"
+ dry "$MOUNT" "$VOLUME" "$MOUNTED"
fi
IFS=$IFS_OLD
trap 2
@@ -140,7 +140,7 @@
_FSADM_YES=$YES
export _FSADM_YES
unset FSADM_RUNNING
- dry exec $LVM lvresize $VERB $FORCE -r -L${NEWSIZE}b $VOLUME_ORIG
+ dry exec "$LVM" lvresize $VERB $FORCE -r -L${NEWSIZE}b "$VOLUME_ORIG"
fi
# error exit status for break
@@ -175,7 +175,7 @@
detect_fs() {
VOLUME_ORIG=$1
VOLUME=${1#/dev/}
- VOLUME=$($READLINK $READLINK_E "/dev/$VOLUME") || error "Cannot get readlink $1"
+ VOLUME=$("$READLINK" $READLINK_E "/dev/$VOLUME") || error "Cannot get readlink $1"
RVOLUME=$VOLUME
case "$RVOLUME" in
/dev/dm-[0-9]*)
@@ -184,7 +184,7 @@
esac
# 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
- 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\""
FSTYPE=${FSTYPE##*TYPE=\"} # cut quotation marks
FSTYPE=${FSTYPE%%\"*}
verbose "\"$FSTYPE\" filesystem found on \"$VOLUME\""
@@ -193,12 +193,12 @@
# check if the given device is already mounted and where
# FIXME: resolve swap usage and device stacking
detect_mounted() {
- test -e $PROCMOUNTS || error "Cannot detect mounted device $VOLUME"
+ test -e "$PROCMOUNTS" || error "Cannot detect mounted device \"$VOLUME\""
- MOUNTED=$($GREP ^"$VOLUME" $PROCMOUNTS)
+ MOUNTED=$("$GREP" ^"$VOLUME" "$PROCMOUNTS")
# for empty string try again with real volume name
- test -z "$MOUNTED" && MOUNTED=$($GREP ^"$RVOLUME" $PROCMOUNTS)
+ test -z "$MOUNTED" && MOUNTED=$("$GREP" ^"$RVOLUME" "$PROCMOUNTS")
# cut device name prefix and trim everything past mountpoint
# echo translates \040 to spaces
@@ -207,8 +207,8 @@
# for systems with different device names - check also mount output
if test -z "$MOUNTED" ; then
- MOUNTED=$(LANG=C $MOUNT | $GREP ^"$VOLUME")
- test -z "$MOUNTED" && MOUNTED=$(LANG=C $MOUNT | $GREP ^"$RVOLUME")
+ MOUNTED=$(LANG=C "$MOUNT" | "$GREP" ^"$VOLUME")
+ test -z "$MOUNTED" && MOUNTED=$(LANG=C "$MOUNT" | "$GREP" ^"$RVOLUME")
MOUNTED=${MOUNTED##* on }
MOUNTED=${MOUNTED% type *} # allow type in the mount name
fi
@@ -219,12 +219,12 @@
# get the full size of device in bytes
detect_device_size() {
# check if blockdev supports getsize64
- $BLOCKDEV 2>&1 | $GREP getsize64 >/dev/null
+ "$BLOCKDEV" 2>&1 | "$GREP" getsize64 >/dev/null
if test $? -eq 0; then
- DEVSIZE=$($BLOCKDEV --getsize64 "$VOLUME") || error "Cannot read size of device \"$VOLUME\""
+ DEVSIZE=$("$BLOCKDEV" --getsize64 "$VOLUME") || error "Cannot read size of device \"$VOLUME\""
else
- DEVSIZE=$($BLOCKDEV --getsize "$VOLUME") || error "Cannot read size of device \"$VOLUME\""
- SSSIZE=$($BLOCKDEV --getss "$VOLUME") || error "Cannot block size read device \"$VOLUME\""
+ DEVSIZE=$("$BLOCKDEV" --getsize "$VOLUME") || error "Cannot read size of device \"$VOLUME\""
+ SSSIZE=$("$BLOCKDEV" --getss "$VOLUME") || error "Cannot block size read device \"$VOLUME\""
DEVSIZE=$(($DEVSIZE * $SSSIZE))
fi
}
@@ -237,14 +237,14 @@
}
temp_mount() {
- dry $MKDIR -p -m 0000 "$TEMPDIR" || error "Failed to create $TEMPDIR"
- dry $MOUNT "$VOLUME" "$TEMPDIR" || error "Failed to mount $TEMPDIR"
+ dry "$MKDIR" -p -m 0000 "$TEMPDIR" || error "Failed to create $TEMPDIR"
+ dry "$MOUNT" "$VOLUME" "$TEMPDIR" || error "Failed to mount $TEMPDIR"
}
temp_umount() {
- dry $UMOUNT "$TEMPDIR" || error "Failed to umount $TEMPDIR"
- dry $RMDIR "${TEMPDIR}" || error "Failed to remove $TEMPDIR"
- dry $RMDIR "${TEMPDIR%%m}" || error "Failed to remove ${TEMPDIR%%m}"
+ dry "$UMOUNT" "$TEMPDIR" || error "Failed to umount \"$TEMPDIR\""
+ dry "$RMDIR" "${TEMPDIR}" || error "Failed to remove \"$TEMPDIR\""
+ dry "$RMDIR" "${TEMPDIR%%m}" || error "Failed to remove \"${TEMPDIR%%m}\""
}
yes_no() {
@@ -263,7 +263,7 @@
}
try_umount() {
- yes_no "Do you want to unmount \"$MOUNTED\"" && dry $UMOUNT "$MOUNTED" && return 0
+ yes_no "Do you want to unmount \"$MOUNTED\"" && dry "$UMOUNT" "$MOUNTED" && return 0
error "Cannot proceed with mounted filesystem \"$MOUNTED\""
}
@@ -277,13 +277,13 @@
####################################
resize_ext() {
verbose "Parsing $TUNE_EXT -l \"$VOLUME\""
- for i in $(LANG=C $TUNE_EXT -l "$VOLUME"); do
+ for i in $(LANG=C "$TUNE_EXT" -l "$VOLUME"); do
case "$i" in
"Block size"*) BLOCKSIZE=${i##* } ;;
"Block count"*) BLOCKCOUNT=${i##* } ;;
esac
done
- validate_parsing $TUNE_EXT
+ validate_parsing "$TUNE_EXT"
decode_size $1 $BLOCKSIZE
FSFORCE=$FORCE
@@ -293,14 +293,14 @@
if test -n "$MOUNTED" ; then
# Forced fsck -f for umounted extX filesystem.
case "$-" in
- *i*) dry $FSCK $YES -f "$VOLUME" ;;
- *) dry $FSCK -f -p "$VOLUME" ;;
+ *i*) dry "$FSCK" $YES -f "$VOLUME" ;;
+ *) dry "$FSCK" -f -p "$VOLUME" ;;
esac
fi
fi
verbose "Resizing filesystem on device \"$VOLUME\" to $NEWSIZE bytes ($BLOCKCOUNT -> $NEWBLOCKCOUNT blocks of $BLOCKSIZE bytes)"
- dry $RESIZE_EXT $FSFORCE "$VOLUME" $NEWBLOCKCOUNT
+ dry "$RESIZE_EXT" $FSFORCE "$VOLUME" $NEWBLOCKCOUNT
}
#############################
@@ -312,19 +312,19 @@
detect_mounted && verbose "ReiserFS resizes only unmounted filesystem" && try_umount
REMOUNT=$MOUNTED
verbose "Parsing $TUNE_REISER \"$VOLUME\""
- for i in $(LANG=C $TUNE_REISER "$VOLUME"); do
+ for i in $(LANG=C "$TUNE_REISER" "$VOLUME"); do
case "$i" in
"Blocksize"*) BLOCKSIZE=${i##*: } ;;
"Count of blocks"*) BLOCKCOUNT=${i##*: } ;;
esac
done
- validate_parsing $TUNE_REISER
+ validate_parsing "$TUNE_REISER"
decode_size $1 $BLOCKSIZE
verbose "Resizing \"$VOLUME\" $BLOCKCOUNT -> $NEWBLOCKCOUNT blocks ($NEWSIZE bytes, bs: $NEWBLOCKCOUNT)"
if [ -n "$YES" ]; then
- echo y | dry $RESIZE_REISER -s $NEWSIZE "$VOLUME"
+ echo y | dry "$RESIZE_REISER" -s $NEWSIZE "$VOLUME"
else
- dry $RESIZE_REISER -s $NEWSIZE "$VOLUME"
+ dry "$RESIZE_REISER" -s $NEWSIZE "$VOLUME"
fi
}
@@ -341,18 +341,18 @@
temp_mount || error "Cannot mount Xfs filesystem"
fi
verbose "Parsing $TUNE_XFS \"$MOUNTPOINT\""
- for i in $(LANG=C $TUNE_XFS "$MOUNTPOINT"); do
+ for i in $(LANG=C "$TUNE_XFS" "$MOUNTPOINT"); do
case "$i" in
"data"*) BLOCKSIZE=${i##*bsize=} ; BLOCKCOUNT=${i##*blocks=} ;;
esac
done
BLOCKSIZE=${BLOCKSIZE%%[^0-9]*}
BLOCKCOUNT=${BLOCKCOUNT%%[^0-9]*}
- validate_parsing $TUNE_XFS
+ validate_parsing "$TUNE_XFS"
decode_size $1 $BLOCKSIZE
if [ $NEWBLOCKCOUNT -gt $BLOCKCOUNT ]; then
verbose "Resizing Xfs mounted on \"$MOUNTPOINT\" to fill device \"$VOLUME\""
- dry $RESIZE_XFS $MOUNTPOINT
+ dry "$RESIZE_XFS" $MOUNTPOINT
elif [ $NEWBLOCKCOUNT -eq $BLOCKCOUNT ]; then
verbose "Xfs filesystem already has the right size"
else
@@ -387,7 +387,7 @@
# only one supported
####################################
diff_dates() {
- echo $(( $($DATE -u -d"$1" +%s 2>/dev/null) - $($DATE -u -d"$2" +%s 2>/dev/null) ))
+ echo $(( $("$DATE" -u -d"$1" +%s 2>/dev/null) - $("$DATE" -u -d"$2" +%s 2>/dev/null) ))
}
###################
@@ -404,7 +404,7 @@
"ext2"|"ext3"|"ext4")
IFS_CHECK=$IFS
IFS=$NL
- for i in $(LANG=C $TUNE_EXT -l "$VOLUME"); do
+ for i in $(LANG=C "$TUNE_EXT" -l "$VOLUME"); do
case "$i" in
"Last mount"*) LASTMOUNT=${i##*: } ;;
"Last checked"*) LASTCHECKED=${i##*: } ;;
@@ -424,11 +424,11 @@
esac
case "$FSTYPE" in
- "xfs") dry $XFS_CHECK "$VOLUME" ;;
+ "xfs") dry "$XFS_CHECK" "$VOLUME" ;;
*) # check if executed from interactive shell environment
case "$-" in
- *i*) dry $FSCK $YES $FORCE "$VOLUME" ;;
- *) dry $FSCK $FORCE -p "$VOLUME" ;;
+ *i*) dry "$FSCK" $YES $FORCE "$VOLUME" ;;
+ *) dry "$FSCK" $FORCE -p "$VOLUME" ;;
esac
esac
}
@@ -449,12 +449,12 @@
-a -n "$DATE" -a -n "$FSCK" -a -n "$XFS_CHECK" -a -n "$LVM" \
|| error "Required command definitions in the script are missing!"
-$LVM version >/dev/null 2>&1 || error "Could not run lvm binary '$LVM'"
-$($READLINK -e / >/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 ))
-test $TEST64BIT -eq 1000000000000000 || error "Shell does not handle 64bit arithmetic"
-$(echo Y | $GREP Y >/dev/null) || error "Grep does not work properly"
-test $($DATE -u -d"Jan 01 00:00:01 1970" +%s) -eq 1 || error "Date translation does not work"
+test "$TEST64BIT" -eq 1000000000000000 || error "Shell does not handle 64bit arithmetic"
+$(echo Y | "$GREP" Y >/dev/null) || error "Grep does not work properly"
+test $("$DATE" -u -d"Jan 01 00:00:01 1970" +%s) -eq 1 || error "Date translation does not work"
if [ "$#" -eq 0 ] ; then
^ permalink raw reply [flat|nested] 15+ messages in thread
* LVM2 ./WHATS_NEW scripts/fsadm.sh
@ 2010-11-10 16:14 zkabelac
0 siblings, 0 replies; 15+ messages in thread
From: zkabelac @ 2010-11-10 16:14 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2010-11-10 16:14:03
Modified files:
. : WHATS_NEW
scripts : fsadm.sh
Log message:
fsadm fix for downsize of unmounted fs
Fix for the last commit as $MOUNTED is not only used as bool flag,
but also store mounted location for remount - so parsing output
from mount differently then from /proc/mounts.
Prefix calls of 'tunefs' tools with LANG=C to be sure we always do get
some nonlocalized strings.
Avoid using forced 'resize2fs' for cleanly unmounted filesystems and
run regular fsck -f for this case as required by resize2fs.
'fsadm check' uses date difference for extX filesystems between
the last mount and last check of 'fsck -f' execution and if the mount
was later run 'fsck' with -f so resize2fs is happy and user does not
need to pass '-f' flag.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1794&r2=1.1795
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/scripts/fsadm.sh.diff?cvsroot=lvm2&r1=1.22&r2=1.23
--- LVM2/WHATS_NEW 2010/11/10 10:05:27 1.1794
+++ LVM2/WHATS_NEW 2010/11/10 16:14:02 1.1795
@@ -1,6 +1,7 @@
Version 2.02.77 -
===================================
- Fix regression in detection of mounted filesystem for older systems (2.0.75).
+ Fix fsadm need of using '-f' for downsize of unmounted filesystem.
+ Fix fsadm regression in detection of mounted filesystem for older systems (2.0.75).
Extend cling allocation policy to recognise PV tags (cling_by_tags).
Add allocation/cling_tag_list to lvm.conf.
Regenerate configure with 'autoreconf' for --enable-ocf. (2.02.76)
--- LVM2/scripts/fsadm.sh 2010/11/10 10:03:07 1.22
+++ LVM2/scripts/fsadm.sh 2010/11/10 16:14:03 1.23
@@ -199,14 +199,19 @@
# for empty string try again with real volume name
test -z "$MOUNTED" && MOUNTED=$($GREP ^"$RVOLUME" $PROCMOUNTS)
- # for systems with different device names - check also mount output
- test -z "$MOUNTED" && MOUNTED=$($MOUNT | $GREP ^"$VOLUME")
- test -z "$MOUNTED" && MOUNTED=$($MOUNT | $GREP ^"$RVOLUME")
-
# cut device name prefix and trim everything past mountpoint
# echo translates \040 to spaces
MOUNTED=${MOUNTED#* }
MOUNTED=$(echo -n -e ${MOUNTED%% *})
+
+ # for systems with different device names - check also mount output
+ if test -z "$MOUNTED" ; then
+ MOUNTED=$(LANG=C $MOUNT | $GREP ^"$VOLUME")
+ test -z "$MOUNTED" && MOUNTED=$(LANG=C $MOUNT | $GREP ^"$RVOLUME")
+ MOUNTED=${MOUNTED##* on }
+ MOUNTED=${MOUNTED% type *} # allow type in the mount name
+ fi
+
test -n "$MOUNTED"
}
@@ -271,7 +276,7 @@
####################################
resize_ext() {
verbose "Parsing $TUNE_EXT -l \"$VOLUME\""
- for i in $($TUNE_EXT -l "$VOLUME"); do
+ for i in $(LANG=C $TUNE_EXT -l "$VOLUME"); do
case "$i" in
"Block size"*) BLOCKSIZE=${i##* } ;;
"Block count"*) BLOCKCOUNT=${i##* } ;;
@@ -284,8 +289,13 @@
if [ "$NEWBLOCKCOUNT" -lt "$BLOCKCOUNT" -o "$EXTOFF" -eq 1 ]; then
detect_mounted && verbose "$RESIZE_EXT needs unmounted filesystem" && try_umount
REMOUNT=$MOUNTED
- # CHECKME: after umount resize2fs requires fsck or -f flag.
- FSFORCE="-f"
+ if test -n "$MOUNTED" ; then
+ # Forced fsck -f for umounted extX filesystem.
+ case "$-" in
+ *i*) dry $FSCK $YES -f "$VOLUME" ;;
+ *) dry $FSCK -f -p "$VOLUME" ;;
+ esac
+ fi
fi
verbose "Resizing filesystem on device \"$VOLUME\" to $NEWSIZE bytes ($BLOCKCOUNT -> $NEWBLOCKCOUNT blocks of $BLOCKSIZE bytes)"
@@ -301,7 +311,7 @@
detect_mounted && verbose "ReiserFS resizes only unmounted filesystem" && try_umount
REMOUNT=$MOUNTED
verbose "Parsing $TUNE_REISER \"$VOLUME\""
- for i in $($TUNE_REISER "$VOLUME"); do
+ for i in $(LANG=C $TUNE_REISER "$VOLUME"); do
case "$i" in
"Blocksize"*) BLOCKSIZE=${i##*: } ;;
"Count of blocks"*) BLOCKCOUNT=${i##*: } ;;
@@ -330,7 +340,7 @@
temp_mount || error "Cannot mount Xfs filesystem"
fi
verbose "Parsing $TUNE_XFS \"$MOUNTPOINT\""
- for i in $($TUNE_XFS "$MOUNTPOINT"); do
+ for i in $(LANG=C $TUNE_XFS "$MOUNTPOINT"); do
case "$i" in
"data"*) BLOCKSIZE=${i##*bsize=} ; BLOCKCOUNT=${i##*blocks=} ;;
esac
@@ -370,6 +380,15 @@
cleanup 0
}
+####################################
+# Calclulate diff between two dates
+# LANG=C input is expected the
+# only one supported
+####################################
+diff_dates() {
+ echo $(( $(date -u -d"$1" +%s 2>/dev/null) - $(date -u -d"$2" +%s 2>/dev/null) ))
+}
+
###################
# Check filesystem
###################
@@ -379,6 +398,30 @@
verbose "Skipping filesystem check for device \"$VOLUME\" as the filesystem is mounted on $MOUNTED";
cleanup 3
fi
+
+ case "$FSTYPE" in
+ "ext2"|"ext3"|"ext4")
+ IFS_CHECK=$IFS
+ IFS=$NL
+ for i in $(LANG=C $TUNE_EXT -l "$VOLUME"); do
+ case "$i" in
+ "Last mount"*) LASTMOUNT=${i##*: } ;;
+ "Last checked"*) LASTCHECKED=${i##*: } ;;
+ esac
+ done
+ case "$LASTMOUNT" in
+ *"n/a") ;; # nothing to do - system was not mounted yet
+ *)
+ LASTDIFF=$(diff_dates $LASTMOUNT $LASTCHECKED)
+ if test "$LASTDIFF" -gt 0 ; then
+ verbose "Filesystem has not been checked after the last mount, using fsck -f"
+ FORCE="-f"
+ fi
+ ;;
+ esac
+ IFS=$IFS_CHECK
+ esac
+
case "$FSTYPE" in
"xfs") dry $XFS_CHECK "$VOLUME" ;;
*) # check if executed from interactive shell environment
^ permalink raw reply [flat|nested] 15+ messages in thread
* LVM2 ./WHATS_NEW scripts/fsadm.sh
@ 2010-11-01 14:08 zkabelac
0 siblings, 0 replies; 15+ messages in thread
From: zkabelac @ 2010-11-01 14:08 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2010-11-01 14:08:52
Modified files:
. : WHATS_NEW
scripts : fsadm.sh
Log message:
Return different status code for fsadm check of mounted filesystem
Return status code 3 for fsadm check of mounted filesystem - used later with
lvresize update patch to better support online filesystem resize.
Also makes a more consistent user interruption and returns status code 2
in this case.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1783&r2=1.1784
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/scripts/fsadm.sh.diff?cvsroot=lvm2&r1=1.20&r2=1.21
--- LVM2/WHATS_NEW 2010/10/29 21:15:23 1.1783
+++ LVM2/WHATS_NEW 2010/11/01 14:08:51 1.1784
@@ -1,5 +1,6 @@
Version 2.02.76 -
===================================
+ Modify fsadm to return different status code for check of mounted filesystem.
Update VG metadata only once in vgchange when making multiple changes.
Allow independent vgchange arguments to be used together.
Automatically unmount invalidated snapshots in dmeventd.
--- LVM2/scripts/fsadm.sh 2010/10/08 15:02:05 1.20
+++ LVM2/scripts/fsadm.sh 2010/11/01 14:08:52 1.21
@@ -23,6 +23,11 @@
# reiserfs: resize_reiserfs, reiserfstune
# xfs: xfs_growfs, xfs_info
#
+# Return values:
+# 0 success
+# 1 error
+# 2 break detected
+# 3 unsupported online filesystem check for given mounted fs
TOOL=fsadm
@@ -126,6 +131,8 @@
IFS=$IFS_OLD
trap 2
+ test "$1" -eq 2 && verbose "Break detected"
+
if [ "$DO_LVRESIZE" -eq 2 ]; then
# start LVRESIZE with the filesystem modification flag
# and allow recursive call of fsadm
@@ -349,7 +356,6 @@
# if the size parameter is missing use device size
#if [ -n "$NEWSIZE" -a $NEWSIZE <
test -z "$NEWSIZE" && NEWSIZE=${DEVSIZE}b
- trap cleanup 2
IFS=$NL
case "$FSTYPE" in
"ext3"|"ext2"|"ext4") resize_ext $NEWSIZE ;;
@@ -365,7 +371,10 @@
###################
check() {
detect_fs "$1"
- detect_mounted && error "Cannot fsck device \"$VOLUME\", filesystem is mounted on $MOUNTED"
+ if detect_mounted ; then
+ verbose "Skipping filesystem check for device \"$VOLUME\" as the filesystem is mounted on $MOUNTED";
+ cleanup 3
+ fi
case "$FSTYPE" in
"xfs") dry $XFS_CHECK "$VOLUME" ;;
*) # check if executed from interactive shell environment
@@ -380,6 +389,7 @@
# start point of this script
# - parsing parameters
#############################
+trap "cleanup 2" 2
# test if we are not invoked recursively
test -n "$FSADM_RUNNING" && exit 0
^ permalink raw reply [flat|nested] 15+ messages in thread
* LVM2 ./WHATS_NEW scripts/fsadm.sh
@ 2010-10-08 15:02 zkabelac
0 siblings, 0 replies; 15+ messages in thread
From: zkabelac @ 2010-10-08 15:02 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2010-10-08 15:02:06
Modified files:
. : WHATS_NEW
scripts : fsadm.sh
Log message:
Add support for noninterctive shell execution
Try to distinguish between the case of using interactive shell and non
interactive running - different combinations of '-y' and '-p' option
needs to be used for fsck.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1753&r2=1.1754
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/scripts/fsadm.sh.diff?cvsroot=lvm2&r1=1.19&r2=1.20
--- LVM2/WHATS_NEW 2010/10/08 15:00:06 1.1753
+++ LVM2/WHATS_NEW 2010/10/08 15:02:05 1.1754
@@ -1,5 +1,6 @@
Version 2.02.75 -
=====================================
+ Better support of noninteractive shell execution of fsadm.
Fix usage of --yes flag for ReiserFS resize in fsadm.
Fix detection of mounted filesystems for fsadm when udev is used.
Fix assignment of default value to LVM variable is fsadm.
--- LVM2/scripts/fsadm.sh 2010/10/08 15:00:07 1.19
+++ LVM2/scripts/fsadm.sh 2010/10/08 15:02:05 1.20
@@ -368,7 +368,11 @@
detect_mounted && error "Cannot fsck device \"$VOLUME\", filesystem is mounted on $MOUNTED"
case "$FSTYPE" in
"xfs") dry $XFS_CHECK "$VOLUME" ;;
- *) dry $FSCK $YES "$VOLUME" ;;
+ *) # check if executed from interactive shell environment
+ case "$-" in
+ *i*) dry $FSCK $YES $FORCE "$VOLUME" ;;
+ *) dry $FSCK $FORCE -p "$VOLUME" ;;
+ esac
esac
}
^ permalink raw reply [flat|nested] 15+ messages in thread
* LVM2 ./WHATS_NEW scripts/fsadm.sh
@ 2010-10-08 15:00 zkabelac
0 siblings, 0 replies; 15+ messages in thread
From: zkabelac @ 2010-10-08 15:00 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2010-10-08 15:00:07
Modified files:
. : WHATS_NEW
scripts : fsadm.sh
Log message:
Fix usage of --yes flag for ReiserFS resize
Put 'dry' before resize command - using dry for echo had no use.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1752&r2=1.1753
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/scripts/fsadm.sh.diff?cvsroot=lvm2&r1=1.18&r2=1.19
--- LVM2/WHATS_NEW 2010/10/08 14:55:19 1.1752
+++ LVM2/WHATS_NEW 2010/10/08 15:00:06 1.1753
@@ -1,5 +1,6 @@
Version 2.02.75 -
=====================================
+ Fix usage of --yes flag for ReiserFS resize in fsadm.
Fix detection of mounted filesystems for fsadm when udev is used.
Fix assignment of default value to LVM variable is fsadm.
Fix support for --yes flag for fsadm.
--- LVM2/scripts/fsadm.sh 2010/10/08 14:55:20 1.18
+++ LVM2/scripts/fsadm.sh 2010/10/08 15:00:07 1.19
@@ -300,7 +300,7 @@
decode_size $1 $BLOCKSIZE
verbose "Resizing \"$VOLUME\" $BLOCKCOUNT -> $NEWBLOCKCOUNT blocks ($NEWSIZE bytes, bs: $NEWBLOCKCOUNT)"
if [ -n "$YES" ]; then
- dry echo y | $RESIZE_REISER -s $NEWSIZE "$VOLUME"
+ echo y | dry $RESIZE_REISER -s $NEWSIZE "$VOLUME"
else
dry $RESIZE_REISER -s $NEWSIZE "$VOLUME"
fi
^ permalink raw reply [flat|nested] 15+ messages in thread
* LVM2 ./WHATS_NEW scripts/fsadm.sh
@ 2010-10-08 14:55 zkabelac
0 siblings, 0 replies; 15+ messages in thread
From: zkabelac @ 2010-10-08 14:55 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2010-10-08 14:55:20
Modified files:
. : WHATS_NEW
scripts : fsadm.sh
Log message:
Fix detection of mounted filesystem.
Update the way how fsadm detects mounted filesystem.
With udev /dev/dm-XXX paths are now returned - but mount or /proc/mounts
prints names in form of /dev/mapper/vg-lv - so the match was not found.
Fixex RHBZ #638050.
Current solution uses same trick as mount and detects vg-lv name through
/sys where available - this should be reasonable safe.
Instead of calling mount without parameter to get actual mount table,
switch to use /proc/mounts directly.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1751&r2=1.1752
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/scripts/fsadm.sh.diff?cvsroot=lvm2&r1=1.17&r2=1.18
--- LVM2/WHATS_NEW 2010/10/08 14:49:25 1.1751
+++ LVM2/WHATS_NEW 2010/10/08 14:55:19 1.1752
@@ -1,5 +1,6 @@
Version 2.02.75 -
=====================================
+ Fix detection of mounted filesystems for fsadm when udev is used.
Fix assignment of default value to LVM variable is fsadm.
Fix support for --yes flag for fsadm.
Do not execute lvresize with --dry-run option for fsadm.
--- LVM2/scripts/fsadm.sh 2010/10/08 14:49:26 1.17
+++ LVM2/scripts/fsadm.sh 2010/10/08 14:55:20 1.18
@@ -65,6 +65,7 @@
MOUNTPOINT=
MOUNTED=
REMOUNT=
+PROCMOUNTS="/proc/mounts"
IFS_OLD=$IFS
# without bash $'\n'
@@ -164,10 +165,15 @@
# detect filesystem on the given device
# dereference device name if it is symbolic link
detect_fs() {
- VOLUME=${1#/dev/}
+ VOLUME_ORIG=$1
+ VOLUME=${1#/dev/}
VOLUME=$($READLINK $READLINK_E "/dev/$VOLUME") || error "Cannot get readlink $1"
- # strip newline from volume name
- VOLUME=${VOLUME%%$NL}
+ RVOLUME=$VOLUME
+ case "$RVOLUME" in
+ /dev/dm-[0-9]*)
+ read </sys/block/${RVOLUME#/dev/}/dm/name SYSVOLUME 2>&1 && VOLUME="/dev/mapper/$SYSVOLUME"
+ ;;
+ esac
# 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
FSTYPE=$($BLKID -c /dev/null -s TYPE "$VOLUME") || error "Cannot get FSTYPE of \"$VOLUME\""
@@ -177,11 +183,19 @@
}
# check if the given device is already mounted and where
+# FIXME: resolve swap usage and device stacking
detect_mounted() {
- $MOUNT >/dev/null || error "Cannot detect mounted device $VOLUME"
- MOUNTED=$($MOUNT | $GREP "$VOLUME")
- MOUNTED=${MOUNTED##* on }
- MOUNTED=${MOUNTED% type *} # allow type in the mount name
+ test -e $PROCMOUNTS || error "Cannot detect mounted device $VOLUME"
+
+ MOUNTED=$($GREP ^"$VOLUME" $PROCMOUNTS)
+
+ # for empty string try again with real volume name
+ test -z "$MOUNTED" && MOUNTED=$($GREP ^"$RVOLUME" $PROCMOUNTS)
+
+ # cut device name prefix and trim everything past mountpoint
+ # echo translates \040 to spaces
+ MOUNTED=${MOUNTED#* }
+ MOUNTED=$(echo -n -e ${MOUNTED%% *})
test -n "$MOUNTED"
}
^ permalink raw reply [flat|nested] 15+ messages in thread
* LVM2 ./WHATS_NEW scripts/fsadm.sh
@ 2010-10-08 14:49 zkabelac
0 siblings, 0 replies; 15+ messages in thread
From: zkabelac @ 2010-10-08 14:49 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2010-10-08 14:49:26
Modified files:
. : WHATS_NEW
scripts : fsadm.sh
Log message:
Fix assignment of default LVM variable
Fix a typo which does not work in case LVM_BINARY is empty string.
Using proper :- syntax.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1750&r2=1.1751
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/scripts/fsadm.sh.diff?cvsroot=lvm2&r1=1.16&r2=1.17
--- LVM2/WHATS_NEW 2010/10/08 13:49:20 1.1750
+++ LVM2/WHATS_NEW 2010/10/08 14:49:25 1.1751
@@ -1,5 +1,6 @@
Version 2.02.75 -
=====================================
+ Fix assignment of default value to LVM variable is fsadm.
Fix support for --yes flag for fsadm.
Do not execute lvresize with --dry-run option for fsadm.
Fix fsadm return error code from user's break action.
--- LVM2/scripts/fsadm.sh 2010/10/08 13:49:20 1.16
+++ LVM2/scripts/fsadm.sh 2010/10/08 14:49:26 1.17
@@ -49,7 +49,7 @@
XFS_CHECK=xfs_check
# user may override lvm location by setting LVM_BINARY
-LVM=${LVM_BINARY-lvm}
+LVM=${LVM_BINARY:-lvm}
YES=${_FSADM_YES}
DRY=0
^ permalink raw reply [flat|nested] 15+ messages in thread
* LVM2 ./WHATS_NEW scripts/fsadm.sh
@ 2010-10-08 13:49 zkabelac
0 siblings, 0 replies; 15+ messages in thread
From: zkabelac @ 2010-10-08 13:49 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2010-10-08 13:49:20
Modified files:
. : WHATS_NEW
scripts : fsadm.sh
Log message:
Support for passing --yes flag recursively.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1749&r2=1.1750
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/scripts/fsadm.sh.diff?cvsroot=lvm2&r1=1.15&r2=1.16
--- LVM2/WHATS_NEW 2010/10/08 13:47:10 1.1749
+++ LVM2/WHATS_NEW 2010/10/08 13:49:20 1.1750
@@ -1,5 +1,6 @@
Version 2.02.75 -
=====================================
+ Fix support for --yes flag for fsadm.
Do not execute lvresize with --dry-run option for fsadm.
Fix fsadm return error code from user's break action.
Allow CC to be overridden at build time (for 'scan-build make').
--- LVM2/scripts/fsadm.sh 2010/10/08 13:47:10 1.15
+++ LVM2/scripts/fsadm.sh 2010/10/08 13:49:20 1.16
@@ -51,7 +51,7 @@
# user may override lvm location by setting LVM_BINARY
LVM=${LVM_BINARY-lvm}
-YES=
+YES=${_FSADM_YES}
DRY=0
VERB=
FORCE=
@@ -128,6 +128,8 @@
if [ "$DO_LVRESIZE" -eq 2 ]; then
# start LVRESIZE with the filesystem modification flag
# and allow recursive call of fsadm
+ _FSADM_YES=$YES
+ export _FSADM_YES
unset FSADM_RUNNING
dry exec $LVM lvresize $VERB $FORCE -r -L${NEWSIZE}b $VOLUME_ORIG
fi
^ permalink raw reply [flat|nested] 15+ messages in thread
* LVM2 ./WHATS_NEW scripts/fsadm.sh
@ 2010-10-08 13:47 zkabelac
0 siblings, 0 replies; 15+ messages in thread
From: zkabelac @ 2010-10-08 13:47 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2010-10-08 13:47:11
Modified files:
. : WHATS_NEW
scripts : fsadm.sh
Log message:
Correctly respect --dry-run option for fsadm
Fix missing 'dry' execution of lvresize - fixing problem where resize
command were 'dry-run' executed - but lvresize has been executed for real.
Also adapt code slightly to support better recursive execution of fsadm
through lvresize call.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1748&r2=1.1749
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/scripts/fsadm.sh.diff?cvsroot=lvm2&r1=1.14&r2=1.15
--- LVM2/WHATS_NEW 2010/10/08 12:35:56 1.1748
+++ LVM2/WHATS_NEW 2010/10/08 13:47:10 1.1749
@@ -1,5 +1,6 @@
Version 2.02.75 -
=====================================
+ Do not execute lvresize with --dry-run option for fsadm.
Fix fsadm return error code from user's break action.
Allow CC to be overridden at build time (for 'scan-build make').
Rename 'flags' to 'status' in struct metadata_area.
--- LVM2/scripts/fsadm.sh 2010/10/08 12:35:59 1.14
+++ LVM2/scripts/fsadm.sh 2010/10/08 13:47:10 1.15
@@ -125,10 +125,13 @@
IFS=$IFS_OLD
trap 2
- # start LVRESIZE with the filesystem modification flag
- # and allow recursive call of fsadm
- unset FSADM_RUNNING
- test "$DO_LVRESIZE" -eq 2 && exec $LVM lvresize $VERB -r -L$(( $NEWSIZE / 1048576 )) $VOLUME
+ if [ "$DO_LVRESIZE" -eq 2 ]; then
+ # start LVRESIZE with the filesystem modification flag
+ # and allow recursive call of fsadm
+ unset FSADM_RUNNING
+ dry exec $LVM lvresize $VERB $FORCE -r -L${NEWSIZE}b $VOLUME_ORIG
+ fi
+
# error exit status for break
exit ${1:-1}
}
^ permalink raw reply [flat|nested] 15+ messages in thread
* LVM2 ./WHATS_NEW scripts/fsadm.sh
@ 2010-10-08 12:36 zkabelac
0 siblings, 0 replies; 15+ messages in thread
From: zkabelac @ 2010-10-08 12:36 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2010-10-08 12:35:59
Modified files:
. : WHATS_NEW
scripts : fsadm.sh
Log message:
Fix a serious bug in the behavior of fasdm tool when breaked.
Under certain conditions it was possible to break (^C) fsadm before actually
resizing filesystem, but lvresize which executed fsadm will think resize
was succesful and shrinks partitions with unresized filesystem on it.
Fix by returning error (1) for this case - this stops lvresize from futher
proceding in resize operation.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1747&r2=1.1748
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/scripts/fsadm.sh.diff?cvsroot=lvm2&r1=1.13&r2=1.14
--- LVM2/WHATS_NEW 2010/10/07 16:33:34 1.1747
+++ LVM2/WHATS_NEW 2010/10/08 12:35:56 1.1748
@@ -1,5 +1,6 @@
Version 2.02.75 -
=====================================
+ Fix fsadm return error code from user's break action.
Allow CC to be overridden at build time (for 'scan-build make').
Rename 'flags' to 'status' in struct metadata_area.
Avoid segfault by limiting partial mode for lvm1 metadata. (2.02.74)
--- LVM2/scripts/fsadm.sh 2010/10/08 11:18:29 1.13
+++ LVM2/scripts/fsadm.sh 2010/10/08 12:35:59 1.14
@@ -1,6 +1,6 @@
#!/bin/bash
#
-# Copyright (C) 2007-2009 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2007-2010 Red Hat, Inc. All rights reserved.
#
# This file is part of LVM2.
#
@@ -129,7 +129,8 @@
# and allow recursive call of fsadm
unset FSADM_RUNNING
test "$DO_LVRESIZE" -eq 2 && exec $LVM lvresize $VERB -r -L$(( $NEWSIZE / 1048576 )) $VOLUME
- exit ${1:-0}
+ # error exit status for break
+ exit ${1:-1}
}
# convert parameter from Exa/Peta/Tera/Giga/Mega/Kilo/Bytes and blocks
^ permalink raw reply [flat|nested] 15+ messages in thread
* LVM2 ./WHATS_NEW scripts/fsadm.sh
@ 2009-06-09 15:31 zkabelac
0 siblings, 0 replies; 15+ messages in thread
From: zkabelac @ 2009-06-09 15:31 UTC (permalink / raw)
To: lvm-devel, lvm2-cvs
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2009-06-09 15:31:36
Modified files:
. : WHATS_NEW
scripts : fsadm.sh
Log message:
Use 'lvm lvresize' instead of 'lvresize' in fsadm.
Do not use '-n' realine option in fsadm for busybox compatiblity.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1144&r2=1.1145
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/scripts/fsadm.sh.diff?cvsroot=lvm2&r1=1.10&r2=1.11
--- LVM2/WHATS_NEW 2009/06/09 14:43:59 1.1144
+++ LVM2/WHATS_NEW 2009/06/09 15:31:36 1.1145
@@ -1,5 +1,7 @@
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.
Add vg_lock_newname() library function.
Round up requested readahead to at least one page and print warning.
--- LVM2/scripts/fsadm.sh 2009/02/24 15:48:01 1.10
+++ LVM2/scripts/fsadm.sh 2009/06/09 15:31:36 1.11
@@ -48,7 +48,8 @@
FSCK=fsck
XFS_CHECK=xfs_check
-LVRESIZE=lvresize
+# user may override lvm location by setting LVM_BINARY
+LVM=${LVM_BINARY-lvm}
YES=
DRY=0
@@ -66,6 +67,9 @@
REMOUNT=
IFS_OLD=$IFS
+# without bash $'\n'
+NL='
+'
tool_usage() {
echo "${TOOL}: Utility to resize or check the filesystem on a device"
@@ -124,7 +128,7 @@
# start LVRESIZE with the filesystem modification flag
# and allow recursive call of fsadm
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}
}
@@ -155,7 +159,9 @@
# dereference device name if it is symbolic link
detect_fs() {
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
# 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\""
@@ -324,8 +330,7 @@
#if [ -n "$NEWSIZE" -a $NEWSIZE <
test -z "$NEWSIZE" && NEWSIZE=${DEVSIZE}b
trap cleanup 2
- #IFS=$'\n' # don't use bash-ism ??
- IFS="$(printf \"\\n\")" # needed for parsing output
+ IFS=$NL
case "$FSTYPE" in
"ext3"|"ext2"|"ext4") resize_ext $NEWSIZE ;;
"reiserfs") resize_reiser $NEWSIZE ;;
@@ -359,10 +364,11 @@
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 "$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!"
-$($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 ))
test $TEST64BIT -eq 1000000000000000 || error "Shell does not handle 64bit arithmetic"
$(echo Y | $GREP Y >/dev/null) || error "Grep does not work properly"
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2012-03-16 12:53 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-19 13:43 LVM2 ./WHATS_NEW scripts/fsadm.sh zkabelac
-- strict thread matches above, loose matches on Subject: below --
2012-03-16 12:53 zkabelac
2011-09-19 14:52 zkabelac
2011-09-19 13:51 zkabelac
2011-09-19 13:47 zkabelac
2010-11-10 16:14 zkabelac
2010-11-01 14:08 zkabelac
2010-10-08 15:02 zkabelac
2010-10-08 15:00 zkabelac
2010-10-08 14:55 zkabelac
2010-10-08 14:49 zkabelac
2010-10-08 13:49 zkabelac
2010-10-08 13:47 zkabelac
2010-10-08 12:36 zkabelac
2009-06-09 15:31 zkabelac
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).