Remote mount a tape-drive

Posted on 2003-11-04
Last Modified: 2010-05-18
Dearr all,

I have to extract huge sets of 8mm tapes recorded earlier to do some calculation.
and I only have 2 Sun Machines (very old version, Ulta5 and SPARCStation 20) and 2 tapes drive in my company.

The ultra 5 is connecting to a tape drive but it doesn't have c compiler and the tape driver is not allowed to move. So that I cannot write c program to extract data from tape drive,

What I think is using the SPARCStation 20 to mount the tape driver on ultra5 and read the tapes, meanwhile I am extracting data on the local driver on the SPARCStation 20.

If the tape drive is connected locally and I can read the content of the tape with c program,
e.g. fd=open("/dev/rst0",O_RDONLY)

But how to do the for remote case?

Having reference to the following but it didn't stat the anwer clear Unix/Q_11629218.html

Waiting for your suggestion!
Question by:hauto
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 38

Expert Comment

ID: 9677055
you don't need to mount the tape driver, in Solaris you can use
ufsdump/ufsrestor to access to the remote tape drive

tar + rsh

to do the job. that's the short answer for 20 points. do a man to learn more.

Author Comment

ID: 9679766

Thanks for the advice.
I have searched link about ufsdump before posting my question in EE
but still I don't have any idea.

My question again, I want to know how to use the apporaches you suggested to meet my goal? Can you explain more detail.

I mean, can I use ufsdump/ufsrestor to do tasks that I used to do with my C program, e.g.
1. system("mt -f /dev/rst0 rewind")
2. fd=open("/dev/rst0",O_RDONLY)
3. itemp=read(fd,bf,2048);
4. Do some calculation based on the data read out

For the 2nd method
Actually the tape data is not archived using tar and I wonder if I cna use tar+rsh to read the content out
LVL 38

Expert Comment

ID: 9683869
Here's a longer answer.

I'll tell you how to do it in a shell command, you can use it in a script, or in your C code use
Let say you has boxA and boxB, boxB has a tape drive, and you alread setup boxA and boxB
knows each other. (define in /etc/hosts, or NIS/NIS+... etc)

1. use ufsdump/ufsrestore to access a remote tape:
     Edit /root/.rhost in both Client and Server
     at boxA, type in:
     rsh boxB  echo test
     if "test" echoed back to your screen, you permission is OK, otherwise
     check your setup again.

2.  Example for using ufsdump and ufsrestore:
     (IF you boot up boxA from cdrom or boot server, use boxB-IP instead of
      the machine name)
      rsh boxB mt -f /dev/rmt/0 rewind
       /usr/sbin/ufsdump 0cf boxB:/dev/rmt/0n filesystem-name
       (filesystem-name = / , /usr , /dev/dsk/c0t0d0s0, etc)
       cd /restore_dir
        ufsrestore rf boxB:/dev/rmt/0n

3. usr tar:
        To copy files to the remote tape driver: (eg, tar )
        $ tar cf - file-list | rsh boxB dd of=/dev/rmt/0n
        To extract files from a Remote Tape drive
        cd /restore_dir
        $ rsh boxB dd if=/dev/rmt/0n | tar xvfp -

        Verify what's on the tape:
        $ rsh boxB mt -f /dev/rmt/0n rewind
        $ rsh boxB tar tvf /dev/rmt/0n
        $ rsh boxB mt -f /dev/rmt/0n rewind

        use can also use cpio to do the job, man cpio to learn more.

The more secure way to do it,  is use ssh + tar, ssh + cpio to do the job.
you can download openssh (+ a lot of free tools, eg GNU gcc etc) from:

 Have a look at the following page to learn how to use ssh + tar:

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.


Author Comment

ID: 9684590
thanks for the reply,

I have spent some time to the documentation on sun's web site about nfsrestore.
I wonder if your suggestions fit my case.

For my case, since the 8mm Mammoth tapes are recorded from data stream
and they have are not stored as individual file on tape.

Can I still use nfsrestore to read the content? Also, I have no space to store the content of a tape,
what I am doing on the SPARCStation 20 is read and calculate the result with the use of data structure in C,
then save the result as text file.(which is much smaller in size)
LVL 38

Expert Comment

ID: 9684651
ufsdump, or tar should should work for you.

"I have no space to store the content of a tape,
what I am doing on the SPARCStation 20 is read and calculate the result with the use of data structure in C"

Which version of Solaris are you running in the ultra5? the IDE HD is very cheap now?
if the Ultra 5 is running Solaris 7, you can add another 20GB IDE HD to the box, if it is
Solaris 8, add a 60 GB HD.

In SPARCStation 20, you can import soem HD sapce from the Ultra 5 (use NFS mount, setup
as read and write).

Author Comment

ID: 9685178
I can't change the HD size as it's company's policy, too bad

Let me summary my knowlege to your suggestion and my difficultivity
1. setting .rhosts to let BoxA(SPARCStation 20,) and BoxB(Ultra5) trust each other

2. on BoxA, use ufsrestore to extract one set of data from tape
(I don't know what the output file is since the tape was recorded by writting binary data stream to the tape directory, not file by file)
(BoxA doesn't have ufdump/ufsrestore, it's sun4m )

3. then we get one file on BoxA's directory which is the content of tape on BoxB

4. Use c program to open the file and do calculation
(the c program I've been working calculates the result while the data extraction in progress, but your suggest is to make a output first, then read the output file)

Author Comment

ID: 9685221
Let me clarify what I am going to do more.

My scenario is to do the calculation while the data is reading out from tape,
but not a post-processing job, which mean extract the whole set of data and then do the calculation.
LVL 38

Expert Comment

ID: 9685255
"I can't change the HD size as it's company's policy, too bad"

I mean you add an extra HD in the Ultra 5 and then use NFS mount to mout the HD on the Sparc 20 !!!

HD will run a lot faster than tape !!! (you cann't compare the speed)

IF you are only handle the data file, "tar" is the tool to use. ufsdump/ufsrestore is good
for system level backup, it can handle specify (eg device files), the native Solaris tar can't.

"4. Use c program to open the file and do calculation
(the c program I've been working calculates the result while the data extraction in progress, but your suggest is to make a output first, then read the output file) "

I don't thing you can process the data, while you are extraing it from the tape. the tape is very
slow, you should extra the data to the HD, and then process the data in the HD.

Tape is a sequential access storage device. HD is a random access storage device!

Author Comment

ID: 9691262
There's no NFS installed on both server
and I don't allow to install anything to these machines

From your explanation, I get a idea about how ufsrestore do.
Without a HD space and I only do the calculation while the tape is being extract.

To sum up, that mean ufsrestore cannot fit my case??

Is there another solution?
How about compiling the c program on a Linux machine having a compiler built to output binary file for solaris?
And put the compiled file to work on solaris??

I will grant you point if you can answer my question

LVL 38

Expert Comment

ID: 9691472
"There's no NFS installed on both server "

NFS should be there, all you need is to set it up, by edit soem configuration files,
it is very easy to setup, should take < 5 min to do it:

Have a look at :

"How about compiling the c program on a Linux machine having a compiler built to output binary file for solaris?"

the binary compiled in Linux WILL NOT run under Solaris.

With NFS, you can mount the C compiler from the SPARC 20 on the Ultra 5 !!!

IF you boss doesn't allow you to use NFS mount, download the GUN gcc compiler from:
(Free) (download complier + libs)

It should work for you.


Author Comment

ID: 9701550
I know that originally binary compiled from Linux cannot run on solaris
even solaris 1's binary (a.out format) cannot run on solaris 2 or above(elf format)

However, I find a term calling cross compiler from, seems it can do the following
configure and built the gcc in Linux and the binary can be run on solaris(but not on Linux anymore)
LVL 38

Expert Comment

ID: 11652652
I can see  any valid reason to refund point for this question, I gave possible solutions for the

at least PAQ with no refund.
LVL 38

Expert Comment

ID: 11652929
Add/import extra HD space can be a solution, but the asker said "I can't change the HD size as it's
company's policy, too bad"

I don't know how the company run their bussiness, a IDE HD is very cheap, setup NFS only take
< 5 mintues!

Author Comment

ID: 11653647

I see your motivation but the real case is my company really not allow me in changing the system config. It's a crucial production radar system used by government
Can you think of another solution?


The data I am working on is radar data, can you tell me more on rmtd?
LVL 38

Expert Comment

ID: 11653817
You can try to read the remote tape to stdout in your local box, eg, if the tape is tar format,
you do:

rsh dd if=/dev/rmt/0n | tar tvf -

to see what's in the file, you can use the simliar command for usfrestore, cpio etc.

or use secure shell:

ssh user@remote  "dd if=/dev/rmt/0n "| tar tvf -

I'm work for .edu (.gov) myself, that's why I can't understand a company not allow adding a HD!
LVL 20

Expert Comment

ID: 11656615
Sorry, I don't have any details about rmtd on SunOS.

If the tape record boundaries are not an issue, you should try yuzh's suggestion of running 'dd' via rsh or ssh, streaming the data back over the network to your C program. If you know the tape has fixed-length physical records, you need to supply that size as an 'ibs=' parameter to the dd comand (unless it happens to be exactly 512, which I think is still the default).
LVL 38

Expert Comment

ID: 11687718
Hi modulo,

     Please keep this question open, hauto need sometime to test


Accepted Solution

modulo earned 0 total points
ID: 11858636
PAQed, with points refunded (100)

Community Support Moderator

Featured Post

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. Please see for the updated article. It is avail…
Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question