1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

fsadm: use xfs_repair when available

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.
This commit is contained in:
Zdenek Kabelac 2014-01-20 11:57:39 +01:00
parent 5f90353636
commit 59336a2a06

View File

@ -54,6 +54,8 @@ READLINK=readlink
READLINK_E="-e"
FSCK=fsck
XFS_CHECK=xfs_check
# XFS_REPAIR -n is used when XFS_CHECK is not found
XFS_REPAIR=xfs_repair
# user may override lvm location by setting LVM_BINARY
LVM=${LVM_BINARY:-lvm}
@ -430,7 +432,15 @@ check() {
esac
case "$FSTYPE" in
"xfs") dry "$XFS_CHECK" "$VOLUME" ;;
"xfs") if which "$XFS_CHECK" >"$NULL" 2>&1 ; then
dry "$XFS_CHECK" "$VOLUME"
else
# Replacement for outdated xfs_check
# FIXME: for small devices we need to force_geometry,
# since we run in '-n' mode, it shouldn't be problem.
# Think about better way....
dry "$XFS_REPAIR" -n -o force_geometry "$VOLUME"
fi ;;
*) # check if executed from interactive shell environment
case "$-" in
*i*) dry "$FSCK" $YES $FORCE "$VOLUME" ;;
@ -452,7 +462,8 @@ test -n "$FSADM_RUNNING" && exit 0
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 "$XFS_REPAIR" \
-a -n "$LVM" \
|| error "Required command definitions in the script are missing!"
"$LVM" version >"$NULL" 2>&1 || error "Could not run lvm binary \"$LVM\""