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" = "./.." ] && OBDDIR=".."
6 . $OBDDIR/demos/config.sh
8 [ ! -d $MNTSNAP/lost+found ] && echo "need to run snapsetup.sh first" && exit 1
13 mount | grep $MNTOBD > /dev/null 2>&1
15 echo "Stuff still mounted on $MNTOBD; clean up first."
19 mount | grep $MNTSNAP > /dev/null 2>&1
21 echo "Stuff still mounted on $MNTSNAP; clean up first."
26 plog log "STARTING snaprestore"
29 $OBDDIR/class/obdcontrol -f << EOF
35 snaprestore 2 $SNAPTABLE 0
38 plog log "COMPLETE snaprestore"
40 plog mount -t obdfs -odevice=/dev/obd2 none $MNTOBD