Link to home
Start Free TrialLog in
Avatar of hauto
hauto

asked on

Remote mount a tape-drive

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)
      itemp=read(fd,bf,2048);

But how to do the for remote case?

Having reference to the following but it didn't stat the anwer clear
https://www.experts-exchange.com/Operating_Systems/ Unix/Q_11629218.html

Waiting for your suggestion!
Hugo
Avatar of yuzh
yuzh

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

tar + rsh

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

ASKER

yuzh

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
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
system("/path-to/yourscript")
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:
         http://sunfreeware.com/

 Have a look at the following page to learn how to use ssh + tar:
         
         http://oldlook.experts-exchange.com/questions/20755213/execute-program-on-a-remote-machine-and-display-result-locally.html
         http://oldlook.experts-exchange.com/questions/20173314/tar-remotely-using-ssh-and-directly-transfer-files-into-tape.html

        Cheers!
   
Avatar of hauto

ASKER

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)
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).
Avatar of hauto

ASKER

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)
Avatar of hauto

ASKER

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.
"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!
Avatar of hauto

ASKER

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

Thanks.
"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 :
http://www.ebsinc.com/solaris/network/nfs.html
http://www.sunhelp.org/faq/nfs.html

"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)
http://sunfreeware.com/

It should work for you.

Cheers!
Avatar of hauto

ASKER

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 gnu.org, 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)
I can see  any valid reason to refund point for this question, I gave possible solutions for the
question.

at least PAQ with no refund.
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!
Avatar of hauto

ASKER

yuzh,

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?

jmcg,

The data I am working on is radar data, can you tell me more on rmtd?
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!
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).
Hi modulo,

     Please keep this question open, hauto need sometime to test
it.

     Thanks
yuzh
ASKER CERTIFIED SOLUTION
Avatar of modulo
modulo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial