1 export PATH=$PATH:/sbin:/usr/sbin
7 PORTALS=$SRCDIR/../../portals
8 LUSTRE=$SRCDIR/../../obd
10 PTLCTL=$PORTALS/linux/utils/ptlctl
11 DEBCTL=$PORTALS/linux/utils/debugctl
12 ACCEPTOR=$PORTALS/linux/utils/acceptor
14 OBDCTL=$LUSTRE/utils/obdctl
16 LOOPNUM=0; export LOOPNUM
17 if [ -b /dev/loop0 ]; then
20 if [ -b /dev/loop/0 ]; then
23 echo "Cannot find /dev/loop0 or /dev/loop/0" 1>&2 && exit -1
27 # Return the next unused loop device on stdout and in the $LOOPDEV
28 # environment variable.
31 while [ -b ${LOOP}${LOOPNUM} ]; do
32 LOOPDEV=${LOOP}${LOOPNUM}
33 losetup ${LOOPDEV} > /dev/null 2>&1 || NEXT=${LOOPDEV}
34 LOOPNUM=`expr ${LOOPNUM} + 1`
35 [ "$NEXT" ] && echo ${NEXT} && break
39 # Create a new filesystem. If we are using a loopback device, we check
40 # for existing "template" filesystems instead of creating a new one,
41 # because it is _much_ faster to gunzip the empty filesystem instead of
42 # creating a new one from scratch. Conversely, if we are creating a
43 # filesystem on a device we use mkfs, because that only writes sparsely
44 # to the device. The empty filesystems are also highly compressed (1000:1)
45 # so they don't take too much space.
51 [ "$1" = "ext3" ] && MKFS="mkfs.ext2 -j"
54 [ $# -lt 2 -o $# -gt 3 ] && \
55 echo "usage: $0 <fstype> <file> [size]" 1>&2 && exit -1
58 [ -f "$PM" ] || PM="/etc/mtab"
60 grep "$2 " $PM 1>&2 && echo "$0: $2 is in $PM!" 1>&2 && exit -1
62 $MKFS $MKFSOPT $2 $3 || exit -1
63 LOOPDEV=$2 # Not really a loop device
66 echo "usage: $0 <fstype> <file> <size>" 1>&2 && exit -1
68 if [ -f "$EFILE" ]; then
69 echo "using existing filesystem $EFILE for $2"
70 zcat "$EFILE" > $2 || exit -1
73 echo "creating new filesystem on $2"
74 dd if=/dev/zero of=$2 bs=1k count=$3 1>&2 || exit -1
75 $MKFS $MKFSOPT -F $2 1>&2 || exit -1
77 LOOPDEV=`next_loop_dev`
78 losetup ${LOOPDEV} $2 1>&2 || exit -1
82 # Set up to use an existing filesystem. We take the same parameters as
83 # new_fs, even though we only use the <file> parameter, to make it easy
84 # to convert between new_fs and old_fs in testing scripts.
89 LOOPDEV=$2 # Not really a loop device
91 LOOPDEV=`next_loop_dev`
92 losetup ${LOOPDEV} $2 1>&2 || exit -1
97 $DEBCTL modules > $R/tmp/ogdb
98 echo "The GDB module script is in /tmp/ogdb"
102 if [ -z "$NETWORK" -o -z "$LOCALHOST" -o -z "$SERVER" ]; then
103 echo "$0: NETWORK or LOCALHOST or SERVER is not set" 1>&2
107 [ -c /dev/portals ] || mknod /dev/portals c 10 240
109 insmod $PORTALS/linux/oslib/portals.o || exit -1
112 elan) if [ "$PORT" ]; then
113 echo "$0: NETWORK is elan but PORT is set" 1>&2
116 insmod $PORTALS/linux/qswnal/kqswnal.o
118 tcp) if [ -z "$PORT" ]; then
119 echo "$0: NETWORK is tcp but PORT is not set" 1>&2
122 insmod $PORTALS/linux/socknal/ksocknal.o || exit -1
125 *) echo "$0: unknown NETWORK \'$NETWORK\'" 1>&2
133 connect $SERVER $PORT
143 [ -c /dev/obd ] || mknod /dev/obd c 10 241
145 insmod $LUSTRE/class/obdclass.o || exit -1
146 insmod $LUSTRE/rpc/ptlrpc.o || exit -1
147 insmod $LUSTRE/ldlm/ldlm.o || exit -1
148 insmod $LUSTRE/ext2obd/obdext2.o || exit -1
149 insmod $LUSTRE/filterobd/obdfilter.o || exit -1
150 insmod $LUSTRE/ost/ost.o || exit -1
151 insmod $LUSTRE/osc/osc.o || exit -1
152 insmod $LUSTRE/obdecho/obdecho.o || exit -1
153 insmod $LUSTRE/mds/mds.o || exit -1
154 insmod $LUSTRE/mdc/mdc.o || exit -1
155 insmod $LUSTRE/llight/llite.o || exit -1
159 [ -d /mnt/lustre ] || mkdir /mnt/lustre
163 [ -c /dev/portals ] || mknod /dev/portals c 10 240
165 insmod $PORTALS/linux/oslib/portals.o || exit -1
167 insmod $LUSTRE/class/obdclass.o || exit -1
168 insmod $LUSTRE/ldlm/ldlm.o || exit -1
171 echo "Press Enter to continue"