Whamcloud - gitweb
- ext2_obd.c --- fix the bugs in read/write for Linux 2.4.3
[fs/lustre-release.git] / lustre / demos / snaprest.sh
1 #!/bin/sh
2 # Utility script to test restoring a previous snapshot.  This will destroy
3 # the "current" snapshot and restore the old one in its place.
4 #
5 # Copyright (C) 2001  Cluster File Systems, Inc.
6 #
7 # This code is issued under the GNU General Public License.
8 # See the file COPYING in this distribution
9
10 OBDDIR="`dirname $0`/.."
11 . $OBDDIR/demos/config.sh
12
13 [ ! -d $MNTSNAP/lost+found ] && echo "need to run snapsetup.sh first" && exit 1
14
15 plog umount $MNTSNAP
16 plog umount $MNTOBD
17
18 mount | grep "$MNTOBD " > /dev/null 2>&1
19 if [ x$? = x0 ]; then 
20     echo "Stuff still mounted on $MNTOBD; clean up first."
21     exit 
22 fi
23
24 mount | grep "$MNTSNAP " > /dev/null 2>&1
25 if [ x$? = x0 ]; then 
26     echo "Stuff still mounted on $MNTSNAP; clean up first."
27     exit 
28 fi
29
30 sync
31 plog log "STARTING snaprestore"
32
33
34 $OBDDIR/class/obdcontrol -f << EOF
35 device /dev/obd1
36 cleanup
37 detach
38 device /dev/obd2
39 connect
40 snaprestore 2 $SNAPTABLE 0
41 quit
42 EOF
43
44 plog log "COMPLETE snaprestore"
45
46 plog mount -t obdfs -odevice=/dev/obd2 none $MNTOBD