1833017 Members
2278 Online
110048 Solutions
New Discussion

remote tar command

 
Henry Chua
Super Advisor

remote tar command

Hi Guys

I have tried backing up files from a HP's Box to a sun's box tapedrive using tar command as below.. but it give error..

# tar -cvf | remsh dd of=/dev/rmt/0m bs=10k
tar: usage tar [-]{txruc}[eONvVwAfblhm{op}][0-7[lmh]] [tapefile] [blocksize] file1 file2...
0+0 records in
0+0 records out

MaY iKnow wat is wrong? thanks

cheers
Henry
12 REPLIES 12
Steven E. Protter
Exalted Contributor

Re: remote tar command

I would try

remesh hostname "tar cvf "

You might want to consider openssh/secureshell, which can get this job done without risking network and system security.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Biswajit Tripathy
Honored Contributor

Re: remote tar command

As it says, tar usage is incorrect in your script. It
should be

# tar -cvf tarfile.tar file1 file2...

This should printout all the filenames it is archieving
(as verbose option is used).

I'm not sure why are you "pipe"'ing tar output to
remsh?

- Biswajit
:-)
Henry Chua
Super Advisor

Re: remote tar command

Hi Guys,

what I intend to do is to copy data from a HPUX box to a remote tape drive that is mounted on a Sun 5.1 system... Is this possible?

Can I make the backup incremental?..the size of the source data is 40Gb... thanks!!


TwoProc
Honored Contributor

Re: remote tar command

- I agree with Steven , you should be using ssh instead of remsh...
A) First Question (from last post):
cd /localdir
tar cvf - . | remsh sunbox "cd /targetdir;tar xvf - "
B) Incremental question...
If you mean to "refresh only the files that change every day?" You can use "rsync" through an ssh pipe, and this would work very nicely for you.

Would look something like (this is actually the command for Linux - assuming that HPUX one would be similar)

rsync -avze ssh --delete /sourcedir/ sunbox:/targetdir/

notes:
*The --delete flag is optional
*The trailing "/" are important!
*the "z" is for inline compression (optional)

You can get rysnc at:
http://hpux.cs.utah.edu/hppd/hpux/Networking/Admin/rsync-2.6.3/

We are the people our parents warned us about --Jimmy Buffett
harry d brown jr
Honored Contributor

Re: remote tar command

HPhost as ROOT:

/sbin/mknod /tmp/stuffithere p
echo "+ +" >/.rhosts
cd directory to backup
tar -cvf /tmp/stuffithere .

ON SUN box as ROOT:

# rsh HPhost dd if=/tmp/stuffithere | dd of=/dev/rmt/0mn

live free or die
harry d brown jr
Live Free or Die
RolandH
Honored Contributor

Re: remote tar command

If you have ssh on both host you can use this

tar -zcvf - /usr/local/bin/tar | ssh remote_host "dd of=/dev/rmt/0m"

If not just use rsh instead.

tar -zcvf - /usr/local/bin/tar | rsh remote_host "dd of=/dev/rmt/0m"

For rsh the source system must be known in the .rhosts file of your sun system.

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

Re: remote tar command

AHHHH I see what is wrong in your command. You forgott one dash

# tar -cvf - | remsh dd of=/dev/rmt/0m bs=10k

Roland
Sometimes you lose and sometimes the others win
Noel Miranda
Frequent Advisor

Re: remote tar command

tar cvfb - 20 files | remsh host dd of=/dev/rmt/0m bs=20b

where files is the files you need to backup,
host is the remote host and the block size is 20(20*512b) on local(for tar) as well as the remote(for dd) systems.

Re: remote tar command

Some notes i took about piped tar:

Local:

# (cd $SRC; tar cf - . ) | (cd $DST; tar xf - )

Remote:

# (cd $SRC; tar cf - . ) | remsh $HOST "(cd $DST; tar xf - )"
# (cd $SRC; tar zcf - . ) | remsh $HOST "(cd $DST; tar zxf - )"

# (cd $SRC; tar cf - . ) | compress | \
remsh $HOST "uncompress | (cd $DST; tar xf - )"

# (cd $SRC; tar cf - . ) | gzip -c | \
remsh $HOST "gzip -cd | (cd $DST; tar xf - )"


Drawbacks:
- in HPUX doesn't support largefile. (use GNU tar to support largefiles)
- no "-xdev" option (like find) to restrict file to one filessytem (GNU tar propose this feature, switch -l)

I upload some more notes comparing several methods of local and remote data copying (tar, cpio, dumps, rsync,...) under several OSes (manly HP-UX) with pros and contras. [sorry, it's mainly in spanish, but i think that anyone can at least understand the commands]

Regards,
Alex
Henry Chua
Super Advisor

Re: remote tar command

tar -cvf - | remsh dd of=/dev/rmt/0m bs=10k

with the following command how do I determine the size of the blocksize used
Noel Miranda
Frequent Advisor

Re: remote tar command

For tar the block size is by default 20 blocks i.e. 20*512. As you have not specified the block size the default will be used. For the dd command you have specified the block size to be 10K.
jasper_2
Occasional Advisor

Re: remote tar command

Hi Henry,

Tar alone cant do it...you need to do several pipes to do it and during restoration you will also do the same...

why not use fbackup instead.. just setup the rhost from remote host then its done... just use frecover to restore it to HP systems later.

if you intend to restore it to a SUN box... just nfs mount your SUN Fs to HP server then do a frecover...

Hope these helps.

Jasper
the chose is yours, we are the product of the choices we make...