Whamcloud - gitweb
f48ecd313ef54c709cebf60c25d213e370004d87
[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 OBDDIR="`dirname $0`/.."
5 [ "$OBDDIR" = "" ] && OBDDIR=".."
6 . $OBDDIR/demos/config.sh
7
8 [ ! -d $MNTSNAP/lost+found ] && echo "need to run snapsetup.sh first" && exit 1
9
10 plog umount $MNTSNAP
11 plog umount $MNTOBD
12
13 sync
14 sleep 1
15 rm $SNAPTABLE
16 plog log "STARTING snaprestore"
17 $OBDDIR/class/obdcontrol -f << EOF
18 snaptable
19 $SNAPTABLE
20 a
21 1
22 now
23 a
24 2
25 current
26 q
27 y
28 snapset 0 $SNAPTABLE
29 device /dev/obd2
30 connect
31 snaprestore 1
32 disconnect
33 EOF
34 plog log "COMPLETE snaprestore"
35
36 plog mount -t obdfs -odevice=/dev/obd1 /dev/obd1 $MNTOBD