Operating System - HP-UX
1855599 Members
2444 Online
104112 Solutions
New Discussion

Re: Read/write from external tape drive

 
SOLVED
Go to solution
tham
Occasional Contributor

Read/write from external tape drive

Good Day,

I'm planning to installed an external DDS 2gb scsi tape drive on my B180L controller but I do not know how to do the following in shell mode ;

1 ) view/read the contents of a tape in the
drive
2 ) write to the tape
3 ) copy the files in the tape to hardisk

I do know the that the device file is /dev/rmt/1m , just don't know the commands

thanks a lot.

4 REPLIES 4
Michael Tully
Honored Contributor

Re: Read/write from external tape drive

The easiest way to talk to a tape drive is to insert a tape and try to rewind the tape, whilst you are watching it. Make sure that the tape is compatible with the actual drive as well.

# mt -t /dev/rmt/0m

The other guys have mentioned what to look for initally.

We can help more if we know format you wish to use ...

Regards
Michael
Anyone for a Mutiny ?
Stefan Farrelly
Honored Contributor
Solution

Re: Read/write from external tape drive


1) tar tvf /dev/rmt/0m (or it may be a different Xm device file, use> ioscan -fknCtape to id which /dev/rmt file its using)
This will display the contents of the tape ONLY if it is in tar format. It could be in lots of different formats! fbackup, Omniback, Netbackup, Networker, dd, cpio etc etc.

2) to write to the tape; tar cvf /dev/rmt/0m
Again, the 0m may be different. Use ioscan to id which one your tape drive is using.

3) To extract the files off tape it depends again what format the tape is in - it could be tons of different formats. Lets hope its in tar format, to extract it;
cd
tar xvf /dev/rmt/0m
Im from Palmerston North, New Zealand, but somehow ended up in London...
RolandH
Honored Contributor

Re: Read/write from external tape drive

Hi Jamie,

you can use three commands to read/write to/from tape : tar, cpio, dd
tar is the most popular command but is not so fast as cpio. dd will mostly used if u want write raw data to tape. See the man pages from these commands. Espacially the EXAMPLES section.

Write to tape with tar:
tar -cvf /dev/rmt/0m /tmp/blub.txt
Read from tape with tar:
tar -xvf /dev/rmt/0m .
(Write content from tape to current directory)
Read content from tape without writing to disc:
tar -tvf /dev/rmt/0m

Keep in mind if u use the device file /dev/rmt/0m the tape will always be rewinded after the command has finished.
ie
If you write to tape with.
tar -cvf /dev/rmt/0m /tmp/blub.txt
blub.txt is on the tape. What's now if you want one more file on the tape?
If you do someting like this
tar -cvf /dev/rmt/0m /tmp/blub.txt2
your first file will be overwritten. What can you do now ? Use another device file which will not rewind the tape (/dev/rmt/0mn) after completion of command. Do "ioscan -funCtape" and all device file will be listed for the DDS drive. If you want more information what all these device file mean - do "man 7 mt".
But you can also do
tar -uvf /dev/rmt/0m /tmp/blub.txt2
The option -u will append file to an existing archive. See man page of tar.

Another important thing you should always do is to label the DDS-Tape always with the command you have used to write to. Because then you now how you have read the data, if you need it.
Do some practice with a new tape with all these three commands to get more experince with archiving on tape.

Regards
Roland
Sometimes you lose and sometimes the others win
RolandH
Honored Contributor

Re: Read/write from external tape drive

Sorry small typo - you are Tham not Jamie.
Jamie was a question I answered before.

Roland

PS: Do not assign points to that.
Sometimes you lose and sometimes the others win