tar - help needed

I need to retrieve one file from tape which appears to be dumped to using tar.
I have tried the following command - but no luck. Any ideas?
I dont want to to restore the complete backup - just one file.

tar -xf /dev/rmt/0cn /var/opt/tmp/AA/dump/TEST.DUMP_20051003

Backup script looks like the below

\# Backup /
echo "" >> $LOGFILE 2>&1
echo "Creating list of excluded files/direcories" >> $LOGFILE 2>&1
mount | grep -v "^/ " | awk '\{print "."$1\}' > /tmp/rootex$$ 2>&1
\(cd /; find ./etc -type D\) >> /tmp/rootex$$ 2>&1
echo "Backing up the root \(/\) file system" >> $LOGFILE 2>&1
\(cd /; tar -cEfX $TAPE /tmp/rootex$$ .\) >> $LOGFILE 2>&1
rm -f /tmp/rootex$$

\# Backup /var/opt/tmp
echo "" >> $LOGFILE 2>&1
echo "Dumping /var/opt/tmp to tape \(with tar\)" >> $LOGFILE 2>&1
\(cd /var/opt/tmp && tar cEf $TAPE .\) >> $LOGFILE 2>&1

You have to use the filename exactly as it was written to tape. If I read the script right, I think it might be:
tar -xf /dev/rmt/0cn ./var/opt/tmp/AA/dump/TEST.DUMP_20051003
Note the dot I added in front of the /var. It it still doesn't work do a
tar tvf /dev/rmt/0cn > listing
and look in listinh until you find your filename...

... or find that it is not there! :eek:

I may have a problem - I performed the following:

tar tvf /dev/rmt/0cn > listing

But it only lists 20 files and 1 directory - the directory being ./

Any ideas? I am sure the backup script must be copying the entire root file system - shouldnt it?

I tried your script fragment and it worked for me. I grabbed pretty much the whole root filesystem. The the fragment looks good, so I would expect it to work. Don't know what to tell you. :confused:

I did a tar tf /dev/rmt/0cn > listing

this time it listed a lot more files.. but still nothing under /var/opt

The script only backs up root. /var is often a separate filesystem.

Ah... That would explain it - when I do a df -k I get the following

# df -k
Filesystem kbytes used avail capacity Mounted on
/dev/md/dsk/d30 15395211 4758233 10483026 32% /
/proc 0 0 0 0% /proc
fd 0 0 0 0% /dev/fd
mnttab 0 0 0 0% /etc/mnttab
swap 6356152 16 6356136 1% /var/run
swap 6364160 8024 6356136 1% /tmp
/dev/dsk/c2t0d0s0 52126800 8752294 41810702 18% /var/opt/

We do appear to backup some lower level directories within /var/opt separately within the script but not the one I am looking for... oh well!