* rolls up sleeves ....*
Okay, diving right on in ...
There are two ways, one following on from the other and building your confidence in your backup/recovery system.
First off, can we read the tar archive?
Code:
tar tvf /dev/rst0
or
tar tvf /dev/st0
depending on which you opted to use.
That will
test the archive - t for test.
Assuming you see a long list of files being produced, along with owenserhip and size we know that the tape can be read and that it appears to have a viable archive upon it.
The real killer test is, of course, the "ooops, where did that flaming file go, dammit I will have to recover it" option. yes, it's test the recovery time!
Here is where it can get a little hairy, so bear with us!
The best thing to do is:
1) Create a dummy file in a directory that you are backing up.
2) Take a backup
3) Delete the file
4) Restore (or at least try to!) the file from the backup
Optional step 5) Gloat over re-appearance of recovered file and go get a beer!
Steps 1 to 3 should, I hope, not be beyond you.
Step 3 is the new one. Now, let us assume the following:
Code:
mkdir -p /usr/backuptest
echo "If this doesnt work I will be looking for a new job" > /usr/backuptest/backup.txt
tar cvf /dev/rst0 /usr
rm /usr/backuptest/backup.txt
(this is the new bit coming up ...)
Code:
tar xvf /dev/rst0 /usr/backuptest/backup.txt
Using the x for E
xtract option of tar
Now, having taken you all through that, I will pass on a little gem of wisdom ...
When backing up a system with tar use RELATIVE paths. That way you can recover the data to a new location and not be restricted to just over-writing any existing stuff.
Cheat sheet for backing up (for use in a script):
Code:
# Remember where we were
where=`pwd`
# change to where we want to backup, assuming single dir tree
cd /usr
# backup relative to here
tar cvf /dev/rst0 .
# remember return code for later testing
cc=$?
# change dir back to where we were
cd $where
To recover, you 'just' need to be careful of what directory you are in and to remember to add a leading .
Thus the test above would be:
Code:
mkdir -p /usr/backuptest
echo "If this doesnt work I will be looking for a new job" > /usr/backuptest/backup.txt
cd /usr
tar cvf /dev/rst0 .
rm /usr/backuptest/backup.txt
cd /tmp
tar xvf /dev/rst0 ./usr/backuptest/backup.txt
And your file will now be in /tmp/backuptest.
Have fun!