SUMMARY: doing a tar to remote tape via ssh

From: Gene Huft <>
Date: Thu Feb 28 2002 - 14:08:47 EST
As always, this is an awesome list. My original question was about the proper
syntax of doing a tar to remote tape drive via ssh, I thought it would be
tar cpfv - /source_dir | ssh remote_host_with_tape_drive "/bin/tar xpf -
(I goofed on this example, the last tar would have to be cpf*but even that
wasn't working)

Overwhelmingly, it was suggested I use dd in place of the last tar, thus this
is what I used:
tar cpfv - /src_dir | ssh remote_host "/bin/dd of=/dev/rmt/3hbn"

 Fabrice Guerini provided the answer along with
several other folks,
& gave me the syntax for restoring any such Backups:

tar cpfv - /source_dir | ssh remote_host "/bin/dd of=/dev/rmt/3hbn"

Your mileage may vary; depending on your tape drive, you may need various
options to 'dd', such as "bs=n" or "conv=sync". And I don't recommend to
use absolute pathnames for directories in a 'tar' archive. Instead, use


cd /src_dir; ssh remote_host  "dd if=/dev/rmt/3hbn" | tar xvfp -

Other Replies:

From:                 Tim Carlson <>

replace the second tar with a dd

tar cpfv - /source_dir | ssh remote_host_with_tape_drive dd

From:                 John Tan <>

If I were writing to tape, I'd do it through a combination of tar and dd,
and run it from the machine with the tape drive.

ssh remote_host_with_file_system tar cpfv - /source_dir | dd
From:                 Larye Parkins <>

This is the simplest:

tar - cpvf - /from_dir | ssh -l user remote_host dd of=/dev/rmt/3hbn

tars to stdout, ssh streams to dd, which writes to tape device

From:                 "Doug Floer" <>

tar cpfv - /source_dir | ssh remote_host_with_tape_drive "/bin/dd

You'll need to work out blocking factors for dd.  The way to test is to
logon the remote host and "tar tvf /dev/rmt/3hbn".
From:                 Michael Miller <>

we do ufsdumps as:

/usr/sbin/ufsdump 0cf - / | \
   /usr/local/bin/ssh -i my_identity user@host dd of=/dev/rmt/0n obs=48k

we use the dd to ensure that the blocking is done right onto the tape!

From:                 system administration account

tar cvpf - /source_dir | ssh remotehost dd of=/dev/rmt/3hbn obs=10k

(assuming the data will fit on one tape; this method doesn't easily
let one change tapes half-way through).
From:                 "Christopher L. Barnard" <>

I have a file in my tickler directory that reminds me how to do exactly

--- 8<---

to do an remote dump without rsh,

ssh remotehost /usr/local/bin/dumpcmd | dd obs=63k of=/dev/rmt/0n

where /usr/local/bin/dumpcmd is an executable (eg.):
/usr/sbin/ufsdump 0fcu - /dev/md/dsk/d0
/usr/sbin/ufsdump 0fcu - /dev/md/dsk/d2
/usr/sbin/ufsdump 0fcu - /dev/md/dsk/d3
/usr/sbin/ufsdump 0fcu - /dev/md/dsk/d4
From:                 Dylan Northrup <>

You've got the arguments to the first tar in the wrong order.  Also, you
might have better luck using 'dd' on the opposite end.  Try this:

  'tar cpvf - /source_dir | ssh remote_host "dd of=/dev/rmt/3hbn obs=20b"'

This works for me to duplicate from one host to another (with the
output file changed to an actual file).
From:                 Chintu Pandya <>

Just incase if you have not received any suggestions.... here is one
from me.

tar cfb - 20 /source_dir | ssh remote_host " dd of=/dev/rmt/3hbn obs=20b"

this should work.
sunmanagers mailing list
Received on Thu Feb 28 13:10:28 2002

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:42:35 EST