DLT drive restoring from tar file with tar and cpio

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Tom Ward
Date:  
Subject: DLT drive restoring from tar file with tar and cpio
wrote:

>I have found the following example in Essential System Administration Oreilly Press 3rd revision, page 736 although I have a question.
>
>Example
>tar -xp /home/chavez/freeway/1.data
>cpio -imd '*1.data' < /dev/rmt0
>end of example
>
>The books explanation of the example
>The command restores the file /home/chavez/freeway/1.data from an archive made of /home located on the tape in the default tape drive.
>
>When you execute the first command "tar -xp /home/chavez/freeway/data" how does the shell know that it should execute the tar command on the data on the tape drive? – I suppose because it looks at the default tape drive.
>
>for the 2nd command why is it necessary to have the "*" when only one file is being restored not all files that end with "data"? Also is the file restored to the current working directory or the location they were backed up from?
>
>
>Jim
>
>
>

Jim,

You're correct on the tar command. By default it looks at the first tape
device. I've never used cpio, but it looks like the example is showing
the use of the -d switch. I don't think it's necessary to use *, that
full path should be okay, but the -d switch will create the leading
directories as needed. It looks to me like you could end up with more
than you want if there are other files that match the *1.data pattern.

Regards,
Tom