Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 04-02-2009, 05:23 AM   #1
LQ Newbie
Registered: Apr 2009
Posts: 2

Rep: Reputation: 0
Question adding files to tar archive

I have a requirement to archive files to tape. What I would like to do is issue a tar from several different points in a shell script such that all files sit in a single archive file on tape. I would have anticipated executing the following commands using the norewind tape device would achieve this:

tar cvf /dev/nst0 /directory1/file1.txt
tar rvf /dev/nst0 /directory2/file2.txt
tar rvf /dev/st0 /directory3/file3.txt
However, when verifying what is on the tape I get the following
tar tvf /dev/st0
blah,blah,blah .... /directory1/file1.txt -- only the 1st file

tar tvf /dev/nst0
blah,blah,blah .... /directory1/file1.txt
tar tvf /dev/nst0
no output from this command
tar tvf /dev/nst0
blah,blah,blah .... /directory2/file2.txt
tar tvf /dev/nst0
no output from this command
tar tvf /dev/nst0
blah,blah,blah .... /directory3/file3.txt

This suggests that 3 archive sets were written. Can someone explain what is wrong ?
Old 04-02-2009, 05:34 AM   #2
LQ Addict
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,891

Rep: Reputation: 351Reputation: 351Reputation: 351Reputation: 351
Try using the -A option instead of -r. Does the append to archive still not work?
Old 04-02-2009, 05:39 AM   #3
Registered: Jan 2008
Location: Mumbai, india
Posts: 130

Rep: Reputation: 17
Once u make a tar archieve, the best way to add or remove files from archive is " cpio ".

do man cpio for further options

i hope this helps
Old 04-02-2009, 06:08 AM   #4
LQ Newbie
Registered: Apr 2009
Posts: 2

Original Poster
Rep: Reputation: 0

From documentation tar -A will concatenate tar archives and gives an error. My requirement is really quite simple, save files to tape, do some processing save more files at the end of the tape, so they can all be recovered in a single restore. At the moment, cpio, dd et al cannot be considered.


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
Piping tar bzcat to add a file to a tar.bz2 archive DaveQB Linux - Software 0 06-02-2008 08:28 PM
adding multiple files to jar archive drkstr Linux - Software 2 12-26-2006 07:54 PM
Recovering files from corrupt TAR archive... johnwyles Linux - Software 8 04-17-2006 04:44 AM
show biggest files in tar archive? ahz10 Linux - Software 3 11-04-2005 03:48 PM
How to list the files in my tar.bz2 archive ??? merlin23 Linux - Newbie 13 12-14-2004 08:50 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:11 AM.

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