1833729 Members
2389 Online
110063 Solutions
New Discussion

Re: About Tar

 
SOLVED
Go to solution
juno2
Super Advisor

About Tar

How to run the tar to append the file ? I have tar some files to the tape then can't list it out , can suggest what is wrong? thx.

# tar cvf /dev/rmt0 /tmp/file1
# tar rvf /dev/rmt0 /tmp/file2
# tar tvf /dev/rmt0
# -rw-r--r-- bin bin 102575 date time tmp/file1 ,

why the file file2 can't be tar ? thx.

13 REPLIES 13
Ravi_8
Honored Contributor

Re: About Tar

Hi,

you have to rewind the tape before using ' tar rvf'

otherwise

#tar cvf /tmp/file1 /tmp/file2 will backup both files
never give up
H.Merijn Brand (procura
Honored Contributor
Solution

Re: About Tar

tar is a *streaming* utility when used on tape

Move all to tape at once

# tar cvf /dev/rmt/0m /tmp/file1 /tmp/file2

Use no-rewind tape

# tar cvf /dev/rmt/0mn /tmp/file1
# tar cvf /dev/rmt/0mn /tmp/file2
# mt -t /dev/rmt/0m rewind

Enjoy, have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
juno2
Super Advisor

Re: About Tar

You mean my steps should be as following ? I tried but fail , can suggest ? thx.

# tar cvf /dev/rmt0 /tmp/file1

# mt -t /dev/rmt/0m rewind

# tar rvf /dev/rmt0 /tmp/file2

H.Merijn Brand (procura
Honored Contributor

Re: About Tar

no. that will overwrite the archivation of file1 to tape with file2 on the same location: the beginning of the tape

Again, two options

1. Put both files to tape in one go

# tar cvf /dev/rmt/0m /tmp/file1 /tmp/file2

(note that /dev/rmt/0m is auto-rewind)

a. retreive file1

# mt -t /dev/rmt/0m rewind
# tar xvf /dev/rmt/0m /tmp/file1

b. retreive file2

# mt -t /dev/rmt/0m rewind
# tar xvf /dev/rmt/0m /tmp/file2

c. retreive both files

# mt -t /dev/rmt/0m rewind
# tar xvf /dev/rmt/0m

2. put the files on seperate logical tape partitions

# tar cvf /dev/rmt/0mn /tmp/file1
# tar cvf /dev/rmt/0m /tmp/file2

Now the first (0mn is a NO-REWIND device) file is on the first logical parttition, and file2 is on the second

a. retrieve file1

# mt -t /dev/rmt/0m rewind
# tar xvf /dev/rmt/0m

b. retreive file2

# mt -t /dev/rmt/0m rewind
# mt -t /dev/rmt/0m fsf 1
# tar xvf /dev/rmt/0m

c. retreive both files

# mt -t /dev/rmt/0m rewind
# tar xvf /dev/rmt/0mn
# tar xvf /dev/rmt/0m

Enjoy, have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
juno2
Super Advisor

Re: About Tar

hi procura ,
thx r reply, i perfer the solution 1 but still hv question , in my case , i can't run " tar cvf /dev/rmt/0m file1 file2" , cos there are some existing files in the tape ( it was backup previosly , ) , i don't want to overwrite the files with the new files so i need to append , how can I append files when the tape already have some data ? thx.
H.Merijn Brand (procura
Honored Contributor

Re: About Tar

Before doing anything, do

# mt -t /dev/rmt/0m eof

Which will put the tape at the end of the data

# man mt

will give you all the options

Enjoy, have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
juno2
Super Advisor

Re: About Tar

hi all,

#tar -cvf /dev/rmt/0m /tmp/file1
#mt -t /dev/tape eof
# tar -r -vf /dev/rmt/0m /tmp/file2
# tar -tvf /dev/rmt/0m /tmp/file2

I still can't append the file to the tape , what can i do? thx.
Keely Jackson
Trusted Contributor

Re: About Tar

Hi
Don't forget to use the 0mn (non-rewind) tape device.

Cheers
Keely
Live long and prosper
V. V. Ravi Kumar_1
Respected Contributor

Re: About Tar

Hi,
#tar cvf /dev/rmt0mn /tmp/file1 (no rewind)
#tar cvf /dev/rmt0m /tmp/file2 (append 2nd file and tape will rewound and will be at the beginning)
#mt -f /dev/rmt0mn fsf 1
moves tape forward by 1 archieve.
#tar tvf /dev/rmt0mn /tmp/file2 (will list file2)

Regards
Never Say No
juno2
Super Advisor

Re: About Tar

Thx all, but how about the tar function "-r" or other function that can use to append files ? thx.
H.Merijn Brand (procura
Honored Contributor

Re: About Tar

not on tapes

Enjoy, have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
juno2
Super Advisor

Re: About Tar

thx V. V. Ravi Kumar ,

but how can i list file1 and file 2 ( not just file2) ? thx.
Michael Tully
Honored Contributor

Re: About Tar

Think of these archives being in different drawers of the same filing cabinet. You can't really open the same drawer at the same time. The same with this tape. ALthough they are on the same tape you can't read them together.
Mr Kumar's procedure highlights what must be done.
Anyone for a Mutiny ?