]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/blob - db/xfs_admin.sh
libxfs: fix xfs_trans_alloc_empty namespace
[thirdparty/xfsprogs-dev.git] / db / xfs_admin.sh
1 #!/bin/sh -f
2 #
3 # Copyright (c) 2000-2001 Silicon Graphics, Inc. All Rights Reserved.
4 #
5
6 status=0
7 DB_OPTS=""
8 REPAIR_OPTS=""
9 USAGE="Usage: xfs_admin [-efjlpuV] [-c 0|1] [-L label] [-U uuid] device"
10
11 while getopts "efjlpuc:L:U:V" c
12 do
13 case $c in
14 c) REPAIR_OPTS=$REPAIR_OPTS" -c lazycount="$OPTARG;;
15 e) DB_OPTS=$DB_OPTS" -c 'version extflg'";;
16 f) DB_OPTS=$DB_OPTS" -f";;
17 j) DB_OPTS=$DB_OPTS" -c 'version log2'";;
18 l) DB_OPTS=$DB_OPTS" -r -c label";;
19 L) DB_OPTS=$DB_OPTS" -c 'label "$OPTARG"'";;
20 p) DB_OPTS=$DB_OPTS" -c 'version projid32bit'";;
21 u) DB_OPTS=$DB_OPTS" -r -c uuid";;
22 U) DB_OPTS=$DB_OPTS" -c 'uuid "$OPTARG"'";;
23 V) xfs_db -p xfs_admin -V
24 status=$?
25 exit $status
26 ;;
27 \?) echo $USAGE 1>&2
28 exit 2
29 ;;
30 esac
31 done
32 set -- extra $@
33 shift $OPTIND
34 case $# in
35 1) if [ -n "$DB_OPTS" ]
36 then
37 eval xfs_db -x -p xfs_admin $DB_OPTS $1
38 status=$?
39 fi
40 if [ -n "$REPAIR_OPTS" ]
41 then
42 # Hide normal repair output which is sent to stderr
43 # assuming the filesystem is fine when a user is
44 # running xfs_admin.
45 # Ideally, we need to improve the output behaviour
46 # of repair for this purpose (say a "quiet" mode).
47 eval xfs_repair $REPAIR_OPTS $1 2> /dev/null
48 status=`expr $? + $status`
49 if [ $status -ne 0 ]
50 then
51 echo "Conversion failed, is the filesystem unmounted?"
52 fi
53 fi
54 ;;
55 *) echo $USAGE 1>&2
56 exit 2
57 ;;
58 esac
59 exit $status