cancel
Showing results for 
Search instead for 
Did you mean: 

erase the tape

hnlixm
Advisor

erase the tape

how can i erase the tape:
# mt -f /dev/rmt/0m status
Drive: IBM ULTRIUM-TD3
Format:
Status: [41114438] BOT online compression immediate-report-mode
File: 0
Block: 0

what the command means? thankyou somebody!
26 REPLIES
Dennis Handly
Acclaimed Contributor

Re: erase the tape

You mean with a bulk eraser? Or burning/shredding the tape?
Or just writing a whole bunch of stuff on it?
hnlixm
Advisor

Re: erase the tape

just for rewirte
Dennis Handly
Acclaimed Contributor

Re: erase the tape

>just for rewrite

There is nothing you need to do, just write to it. (Unless it is a labeled tape or something.)
hnlixm
Advisor

Re: erase the tape

i run
# tar tvf /dev/rmt/0m
it display nothing
but actually i

#tar cvf /dev/rmt/0m 1.txt first

is the tape bad? or it is full
Dennis Handly
Acclaimed Contributor

Re: erase the tape

>is the tape bad? or it is full

If you did "tar cvf" then "tar tvf" and you don't have a no-rewind device, it would indicate something is wrong but not full.
hnlixm
Advisor

Re: erase the tape

i run

# mt -f /dev/rmt/0m rewind
# tar cvf /dev/rmt/0m 200908.tar.Z
a 200908.tar.Z 2280933 blocks
# tar tvf /dev/rmt/0m
rw-rw-rw- 1001/107 1167837679 Aug 21 17:37 2009 200908.tar.Z
# tar cvf /dev/rmt/0m 1.log
a 1.log 170 blocks
# tar tvf /dev/rmt/0m
rw-rw-rw- 1001/107 86588 Aug 24 17:57 2009 1.log
# tar -tvf /dev/rmt/0m 200908.tar.Z
rw-rw-rw- 1001/107 86588 Aug 24 17:57 2009 1.log

why the second file overwrite the first file
Steven Schweda
Honored Contributor

Re: erase the tape

> why the second file overwrite the first file

What is your operating system? "uname -a"?

> [...] you don't have a no-rewind device
> [...]

man 7 mt

Look for "rewind".
hnlixm
Advisor

Re: erase the tape

HP-UX ty_86 B.11.23 U ia64 3035812023 unlimited-user license
Steven Schweda
Honored Contributor

Re: erase the tape

> HP-UX ty_86 B.11.23 U ia64 3035812023 unlimited-user license

Ok, then "man 7 mt", or:

http://docs.hp.com/en/B2355-60103/mt.7.html

and look for "rewind".

An HP-UX forum search for keywords like:

tar tape rewind

should find many old discussions.
hnlixm
Advisor

Re: erase the tape

maybe it's a no-rewind device,but how can i make sure
Steven Schweda
Honored Contributor

Re: erase the tape

> maybe it's a no-rewind device,

Maybe _what_ is? "/dev/rmt/0m"? The name
with no "n" in it? Guess again.

> but how can i make sure

One way would be to use "tar" twice, and then
see if you got one or two archives on the
tape. If you get two, then it's not
rewinding between the "tar" jobs.
hnlixm
Advisor

Re: erase the tape

yes ,with no 'n' ,it is "/dev/rmt/0m"

i get a job ,so it must be a rewind tape.

but how can i see other files? i can only see the lastest file after i run "tar"
OldSchool
Honored Contributor

Re: erase the tape

hnlixm> i run

mt -f /dev/rmt/0m rewind
--- which rewound the tape
(1)
tar cvf /dev/rmt/0m 200908.tar.Z
a 200908.tar.Z 2280933 blocks
--- which wrote 200908.tar.Z to tape, and then REWOUND it

(2)
tar tvf /dev/rmt/0m
rw-rw-rw- 1001/107 1167837679 Aug 21 17:37 2009 200908.tar.Z
--- which read the tape contents, and then REWOUND it, which impacts the following, as you are now at the beginning of the tape

(3)
tar cvf /dev/rmt/0m 1.log
a 1.log 170 blocks
--- which wrote 1.log to the tape and then REWOUND it

(4)
tar tvf /dev/rmt/0m
rw-rw-rw- 1001/107 86588 Aug 24 17:57 2009 1.log
tar -tvf /dev/rmt/0m 200908.tar.Z
rw-rw-rw- 1001/107 86588 Aug 24 17:57 2009 1.log
--- yep, 1.log is the only thing on the tape. Remember, it rewound to the begining
--- when step (2) finished, so step (3) overwrote what was on it. you have to skip to the end of tape before (3), or use a non-rewind device, as in /dev/rmt/0mn, in step (2).

Using tar to append archives to a tape can be deadly, for just the reasons illustrated. I highly recommend that you DON'T use it this way. If you insist on doing so, read the man pages for "mt" and "tar" carefully. For what it's worth, I wouldn't trust the "append" option of tar as far as I could throw the server.

Steven Schweda
Honored Contributor

Re: erase the tape

> [...] For what it's worth, I wouldn't trust
> the "append" option of tar as far as I
> could throw the server.

You mean this one?

"man tar":

[...]
r

Add the named file to the end of the archive. The same blocking factor used to create
the archive must be used to append to it. This option cannot be used if the archive is a tape.
[...]

The "cannot be used if" part would seem to
limit the threat.

> [...] which impacts the following, [...]

Does it leave a crater?
OldSchool
Honored Contributor

Re: erase the tape

that's the part, I was afraid the OP would stop at:


Add the named file to the end of the archive. The same blocking factor used to create


and never read:

This option cannot be used if the archive is a tape


as to the crater, sure it does. just about the size of the overwritten file :)

hnlixm
Advisor

Re: erase the tape

[...]--- when step (2) finished, so step (3) overwrote what was on it. you have to skip to the end of tape before
>how can i skip to the end of tape? i run "
mt -f /dev/rmt/0m eof " ?

[...] (3), or use a non-rewind device, as in /dev/rmt/0mn, in step (2).


> i run "
# tar -cvf /dev/rmt/0mn 1.txt
a 1.txt 1 blocks
# tar -cvf /dev/rmt/0mn 1.log
a 1.log 170 blocks
# tar -tvf /dev/rmt/0m
rw-rw-rw- 0/3 6 Aug 21 17:32 2009 1.txt
# tar -tvf /dev/rmt/0mn
rw-rw-rw- 1001/107 86547 Aug 25 17:32 2009 1.log
"

so the tape may wind forward when i run "tar -cvf /dev/rmt/0mn"

how can i see all the files in one command instead of two ?




Steven Schweda
Honored Contributor

Re: erase the tape

> how can i see all the files in one command
> instead of two ?

One way would be to write the files to the
tape in one command instead of two.

A "tar -c" command writes one "tar" archive.
A "tar -t" (or "-x") command reads one "tar"
archive. A "tar" archive can contain more
than one file. For example:

tar -cvf /dev/rmt/0mn 1.log 1.txt

"man tar" might be useful.
Dennis Handly
Acclaimed Contributor

Re: erase the tape

>mt -f /dev/rmt/0m eof?

This will fail without a no-rewind device.

>how can I see all the files in one command instead of two?

You can't. Don't do this if you want to protect the data that's on your tape!
Note OldSchool's warning.
hnlixm
Advisor

Re: erase the tape

>[...]A "tar -t" (or "-x") command reads one "tar"


i run "man tar":
"-t List the names of all the files in the archive."

it should not read only a file
hnlixm
Advisor

Re: erase the tape

>[...]You can't. Don't do this if you want to protect the data that's on your tape!
Note OldSchool's warning.

you mean it may rewrite the data on the tape?
hnlixm
Advisor

Re: erase the tape

man tar
[...]-c Create a new archive. Write from the beginning of the
archive instead of appending after the last file. Any
previous information in the archive is overwritten


thanks guys!


i frist run "tar cvf " overwrite the whole tape,so i can only see one file ...

kindly regards!
hnlixm
Advisor

Re: erase the tape

i should use "tar rvf /dev/rmt/0m" instead of
"tar -cvf /dev/rmt/0m"
OldSchool
Honored Contributor

Re: erase the tape

....

i should use "tar rvf /dev/rmt/0m" instead of
"tar -cvf /dev/rmt/0m"
.....


for WHAT?

I think you fail to grasp the concepts involved here, especially when to use *rewind* devices -vs- *non-rewind* devices.
hnlixm
Advisor

Re: erase the tape

>I think you fail to grasp the concepts >involved here, especially when to use >*rewind* devices -vs- *non-rewind* devices.


rewind device is "dev/rmt/0m",after "tar rvf " it goes the head.


no-rewind device is "/dev/rmt/0mn",it stops where it "tar"