Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm a newbie when it comes to working with tape backups.

I'm trying to extract a directory from a tape archive, and not getting much success.

The directory on the tape is of the format /foo1/foo2/foo3/foo4/foo5/foo6 with the directory I want being foo6.

The method I've found of extracting a specific directory from tape (my tape drive device being st0) is:

tar -xvf /dev/st0 /foo1/foo2/foo3/foo4/foo5/foo6

However, when I try that, tar can't find the desired directory

share|improve this question
add comment

1 Answer

One simple answer may be that the file/directory you want is simply not on the archive.

Another possible answer is that you are providing the path incorrectly relative to the archive. Tar is extemely picky when compared with filesystem operations. The filesystem has context like the working directory to use, and tar does not.

One common mistake is that tar archives simply do not include a leading slash, so asking for /foo might not be what you need to do. If there was a symlink anywhere within the path you are extracting, then your directory may not be where you expect it. Tar will not resolve the symlink when extracting, you need to provide the full canoical path according to how it is stored in the archive.

In any case, it might be easier to simply rewind the tape and then run tar -tvf /dev/st0 to list the contents of the archive. Is the file/directory you want in the list? Look closely at the path, and copy exactly what you see.

share|improve this answer
    
On the last point, yeah, that's how I found the source directory on the tape (I wasn't present when it was being made). I'll be specific though... when I run tar -tvf /dev/st0 , the result starts with ./ I had started to do an extract of the whole tape, and got the path of the directory I want... at least the way it showed up in the filesystem was as I described in my post, with 6 levels of directories and not much else that is strange. I guess if it looks a bit different on the tape, I can't easily tell –  ACKumen Feb 28 '12 at 17:06
    
If what you see on the tape starts with ./, then do your extract like tar -xvf /dev/st0 ./foo1/foo2/.... Remember a TAR is an archive not a filesystem. –  Zoredache Feb 28 '12 at 17:09
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.