chenky
asked on
tar remotely using ssh and directly transfer files into tape
Hi,
I'm having trouble getting this to work. The local machine runs solaris and is the only one with a tape drive. i'm trying to archive files from other machines (running Linux) directly into the tape drive.
I tried commands like this:
Local> ssh user@remote "tar -cv /home/dir1" > /dev/rmt/0 dir1.tgz
and some combinations similarly but nothing gets into tape. It works if it is to a local directory though. I'll offer 200 points for this one, if anyone can help me out quickly.
Thanks,
KC
I'm having trouble getting this to work. The local machine runs solaris and is the only one with a tape drive. i'm trying to archive files from other machines (running Linux) directly into the tape drive.
I tried commands like this:
Local> ssh user@remote "tar -cv /home/dir1" > /dev/rmt/0 dir1.tgz
and some combinations similarly but nothing gets into tape. It works if it is to a local directory though. I'll offer 200 points for this one, if anyone can help me out quickly.
Thanks,
KC
The classic way to do this is to set the Solaris box up for rsh access for the appropriate users and to then do 'tar cf solaris-sys:/dev/rmt/0'. Of course there are security implications in doing that, but on a local LAN that is normally an acceptable compromise. For the really paranoid, having a 'tape only server' is an appropriate solution.
ASKER
Thanks guys,
I tried those, seem to hangup - tape drive doesn't even blink, and it just seems to hang there.
KC
I tried those, seem to hangup - tape drive doesn't even blink, and it just seems to hang there.
KC
Hi chenky,
In your LAN, set up rsh to use the remote tape. I assume that you know how to set this up. ( edit /etc/hosts, .rhosts file etc).
to verify rsh: at the client box:
rsh server echo test
if you see test echo on your screen, it is ok with rsh, make sure that you have write permission to write to the tape drive on the server, if not, you might have to do it as root.
use the following command to copy the files to the tape on the server:
(do this at your work station)
tar cf - /home/dir | rsh tape-server dd of=/dev/rmt/0n
you can verify what's on the tape at the workstation or tape server.
make sure you rewind the tape first.
Cheers!
===========
yuzh
In your LAN, set up rsh to use the remote tape. I assume that you know how to set this up. ( edit /etc/hosts, .rhosts file etc).
to verify rsh: at the client box:
rsh server echo test
if you see test echo on your screen, it is ok with rsh, make sure that you have write permission to write to the tape drive on the server, if not, you might have to do it as root.
use the following command to copy the files to the tape on the server:
(do this at your work station)
tar cf - /home/dir | rsh tape-server dd of=/dev/rmt/0n
you can verify what's on the tape at the workstation or tape server.
make sure you rewind the tape first.
Cheers!
===========
yuzh
>ssh user@remote "tar -cv /home/dir1" > /dev/rmt/0 dir1.tgz
What does dir1.tgz mean?
I suggest:
ssh user@remote tar -cf - /home/dir1 | tar -xf /dev/rmt/0
(keep in mind that this device has a special block size, usualy, so the second tar probably should have an appropriate block size with the -b option)
What does dir1.tgz mean?
I suggest:
ssh user@remote tar -cf - /home/dir1 | tar -xf /dev/rmt/0
(keep in mind that this device has a special block size, usualy, so the second tar probably should have an appropriate block size with the -b option)
ASKER
Hi guys,
I prefer not to use rsh - security reasons - even on LAN. But thanks for the suggestions.
Hi ahoffmann,
Works better, but command line still hangs there without writing anything into tape. I've tried many other variations, including putting "" on "tar -cf - /home/dir1" as well as adding "-" after tar -xf. It should notify sending it to stdout and reading stdin within a created shell. Any ideas ?
Thanks,
Chenky
I prefer not to use rsh - security reasons - even on LAN. But thanks for the suggestions.
Hi ahoffmann,
Works better, but command line still hangs there without writing anything into tape. I've tried many other variations, including putting "" on "tar -cf - /home/dir1" as well as adding "-" after tar -xf. It should notify sending it to stdout and reading stdin within a created shell. Any ideas ?
Thanks,
Chenky
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
> tar cfb 128 -
should be
tar cbf 128 -
chenky, could you pleas check if following produces a valid tar file:
ssh user@remote tar -cf - /home/dir1|tar -xf /tmp/t.tar
should be
tar cbf 128 -
chenky, could you pleas check if following produces a valid tar file:
ssh user@remote tar -cf - /home/dir1|tar -xf /tmp/t.tar
ASKER
Hi Yuzh,
very close, this actually works....
ssh user@remote "tar cf - /dirname"| dd of=/dev/rmt/0 obs=126b
anyway I accept yours as an answer, Thank you and also the other guys too, saved me from a lot more headache.(been having lots!)
200 points is yours!
Thanks again,
Chenky
very close, this actually works....
ssh user@remote "tar cf - /dirname"| dd of=/dev/rmt/0 obs=126b
anyway I accept yours as an answer, Thank you and also the other guys too, saved me from a lot more headache.(been having lots!)
200 points is yours!
Thanks again,
Chenky
$ ssh user@remote "tar -cf - /home/dir1" > /dev/rmt/0