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 OBDDIR="`dirname $0`/.."
5 . $OBDDIR/demos/config.sh
7 [ ! -d $MNTSNAP/lost+found ] && echo "need to run snapsetup.sh first" && exit 1
12 mount | grep "$MNTOBD " > /dev/null 2>&1
14 echo "Stuff still mounted on $MNTOBD; clean up first."
18 mount | grep "$MNTSNAP " > /dev/null 2>&1
20 echo "Stuff still mounted on $MNTSNAP; clean up first."
25 plog log "STARTING snaprestore"
28 $OBDDIR/class/obdcontrol -f << EOF
34 snaprestore 2 $SNAPTABLE 0
38 plog log "COMPLETE snaprestore"
40 plog mount -t obdfs -odevice=/dev/obd2 none $MNTOBD