LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-24-2009, 11:05 PM   #1
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Rep: Reputation: 31
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
 
Old 06-25-2009, 09:48 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,553

Rep: Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946Reputation: 7946
Quote:
Originally Posted by ust View Post
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.
 
Old 06-25-2009, 07:44 PM   #3
choogendyk
Senior Member
 
Registered: Aug 2007
Location: Massachusetts, USA
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,197

Rep: Reputation: 105Reputation: 105
(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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to put more than one tar file on a tape kaplan71 Linux - Software 2 05-01-2009 07:25 PM
Is Tar file to tape drive faster than dir/files to tape drive? Runge_Kutta Linux - General 2 03-11-2009 07:13 AM
tar file twice? put to tape? Gzip? jantman Linux - Software 4 03-25-2007 03:01 PM
Using Tar/Star to copy a compressed file from tape geokker Linux - Software 1 09-09-2005 07:32 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration