Operating System - HP-UX
1850512 Members
2397 Online
104054 Solutions
New Discussion

Re: confused with command "tar". would the tape be full?

 
SOLVED
Go to solution
Jessica Chou
Advisor

confused with command "tar". would the tape be full?

Got a question here.
When I reused a tape on the command
"tar -cvf /dev/rmt/0m /dir1 /dir2"
for several time, would the tape be possible full?
Isn't tar create a new archive and over-write the old tape instead of appeading to it, when it executes with option "-c", ?

Thank you in advance.

Jessica
6 REPLIES 6
Andreas Voss
Honored Contributor

Re: confused with command "tar". would the tape be full?

Hi,

you are right, tar with -c starts a new archive BUT if you had a previous command with the device /dev/rmt/0mn, the tape isn't rewind and so the next tar command writes after this position.
To prevent this rewind the tape explictly with:
mt -t /dev/rmt/0m rew

Regards
John Palmer
Honored Contributor

Re: confused with command "tar". would the tape be full?

Hi Jessica,

Because you are using the 'rewind' tape device (/dev/rmt/0m) tar will always rewind the tape when it closes the output file.

Thus if you run several 'tars' they will always overwrite each other.

If you want to have several tar dumps on a tape, you must use the 'non rewind' tape device (/dev/rmt/0mn (or 0mnb)).

Regards,
John
Vincente Fernandes
Valued Contributor

Re: confused with command "tar". would the tape be full?

Yes "-c" option creates a new archive and overwrite the old tape. Maybe the tape must be having some problem or worn out. What error/message you get?
Andy Monks
Honored Contributor

Re: confused with command "tar". would the tape be full?

One common cause of this error, is a fault with the tape or the tape drive. The other, obviously is the tape has filled up.

You didn't mention whether this occurs instantly or after a while. Also, what tape drive/media are you using, and how big is the data?
Jessica Chou
Advisor

Re: confused with command "tar". would the tape be full?

Hi!
Thanks all you guys' reply.
The media I use is HP's DLT tape drive with
a 40-80 GB data cartridge.

The error message I got at tar command was something like "tape full... enter device name... or null to abort ..."(I forgot to write it down at that moment.)

Since some of you mentioned that "/dev/rmt/0mn" can have the tape un-rewinded, I would like to know what benefit I can get by using this device? How can I identify the tar files I made on a tape for later extraction?

Thank you.

Jessica
John Palmer
Honored Contributor
Solution

Re: confused with command "tar". would the tape be full?

Jessica,

The message that you got was that tar had run off the end of the tape.

If you use the non-rewind tape device file then when a program like 'tar' finishes the tape is left positioned at the end of the tar file. Running another tar produces a second file on the tape and so on. Each of the files is separated from the previous by a 'tape mark' and end of the last file is indicated by a 'double tape mark'. Thus three runs of tar to /dev/rmt/0mn will produce the following data on tape (*TM* is a tape mark):-


*TM*

*TM*

*TM*
*TM*

If you wrote a fourth file, this would start by overwriting the final tape mark.

As far as identifying the tar files goes, various techniques can be employed:-

If you script the running of tar then the script could log what it has done to a file somewhere.
You could write the contents on the tape label.
You could also use tar itself to identify the contents of a tar file with
'tar tvf /dev/rmt/0mn'

On a performance note, it is worth specifying the 'b' argument to tar with a blocksize of 64. This speeds up tar considerably and gets more data onto the tape.

Use 'tar cbf 64 /dev/rmt/0mn' to backup
and 'tar xbf 64 /dev/rmt/0mn to restore.

Hope this helps,
John