LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   tar file to tape (https://www.linuxquestions.org/questions/linux-newbie-8/tar-file-to-tape-735442/)

ust 06-24-2009 11:05 PM

tar file to tape
 
I have a tape which have data in it ( make by other backup tool ) , I want to use tar to append data to it , I tried "tar -cvf dev file" , it will overwrite the data in the tape , can advise how to preserve the existing data ? thx

TB0ne 06-25-2009 09:48 AM

Quote:

Originally Posted by ust (Post 3585448)
I have a tape which have data in it ( make by other backup tool ) , I want to use tar to append data to it , I tried "tar -cvf dev file" , it will overwrite the data in the tape , can advise how to preserve the existing data ? thx

Please write clearly and spell out your words.

No immediate ideas, since you don't say what "other backup too" created the tape, or what format THAT data is in, or what the tool does to the tape after creating the backup (does it rewind? Eject the tape?). The mt command ("man mt"), gives you control over the tape device, and will let you get to the end of the valid data set.

Look at the man page for the tar command too...the "-A" switch lets you append data.

choogendyk 06-25-2009 07:44 PM

(TBOne, flying wild guess: English is not ust's first language.)

ust, Since you say that it was another tool that used the tape, and that you want to append with tar, I'm going to assume that you mean append to the tape, not to the other tool's backup file. So any -A switch is not going to help.

What you want is for the tape to have the other backup tool's file, the file mark, and another file on the tape that is the tar file. As TBOne suggested, `man mt`. You want to put the tape in, use mt to get the status, forward the tape to the end of the data (you can use fsf repeatedly in mt), and then put your tar file at the end of that. Something like:

$ mt -f /dev/nst0 status
(output showing tape positioned at file 0)
$ mt -f /dev/nst0 fsf 1
$ mt -f /dev/nst0 status
(output showing tape positioned at file 1)
$ mt -f /dev/nst0 fsf 1
$ mt -f /dev/nst0 status
(output showing tape positioned at file 2)

and so on. On Solaris, I can do `mt eom`, and it will go to the end of the data on the tape. You'll have to check your man page on mt to see if yours can do that. You can also do something like `mt -f /dev/nst0 fsf 10` and it will go forward over 10 file marks, or go to the end and give you an error saying there is no more. Then check status. Then,

$ tar cvf /dev/nst0 files_to_tar

Note: I've used /dev/nst0, because in a previous post of yours it appears you have /dev/st0. The "n" is to use the non-rewinding version of the tape device. Otherwise, it will rewind automatically after an operation.

Of course, it would help us help you if we knew what the other backup tool was. It is possible that some tools believe they own a tape and might overwrite your tar file next time you use them.


All times are GMT -5. The time now is 10:42 PM.