Operating System - HP-UX
1829636 Members
1679 Online
109992 Solutions
New Discussion

Re: tar and dd combination

 
SOLVED
Go to solution
BKUMAR
Frequent Advisor

tar and dd combination

Hi Experts,

we use the below command for cutting the tape to ext-party

tar -cvfEb - 60 $1 | rsh remoteserver dd of=/dev/rmt/0 obs=800b

when we validate it looks good from unix and appln point....when the ext-party tries to restore the same he gets corrupted data...the command we used above from long back we modified to backup in remoteserver....any hints/tips highly appreciated

thanks in advance

Unix Administration Most Dedicated and Challenging Career in the World
7 REPLIES 7
Rodney Hills
Honored Contributor

Re: tar and dd combination

Is the ext-party restoring to an hp-ux system?

Some versions of unix have byte ordering issues, known as big-endian/little-endian.

tar can not handle this situation, but "cpio" can. Do a "man cpio" for further info.

HTH

-- Rod Hills
There be dragons...
H.Merijn Brand (procura
Honored Contributor

Re: tar and dd combination

the net might be giving too small packets. Try a double buffer and a pull instead of a push

remotesrvr # remsh localsrvr \( cd $1 \; tar cvf - . \) | dd | ddof=/dev/rmt/0m obs=800b


a5:/pro/3gl/HP 105 > remsh l1 \( cd /tmp/fin \; tar cvf - . \) | dd | dd of=/dev/null obs=800b
a ./dd 300 blocks
a ./fldlst 125 blocks
a ./btlst 6 blocks
a ./hshlst 24 blocks
a ./lnklst 23 blocks
a ./dd.sv 302 blocks
a ./fldlst.sv 126 blocks
a ./btlst.sv 6 blocks
a ./hshlst.sv 24 blocks
a ./lnklst.sv 23 blocks
a ./fldlst.df 2 blocks
a ./btlst.df 1 blocks
a ./hshlst.df 1 blocks
a ./lnklst.df 0 blocks
980+0 records in
980+0 records out
980+0 records in
1+1 records out
a5:/pro/3gl/HP 106 >


Enjoy, have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Jdamian
Respected Contributor

Re: tar and dd combination

what is 'E' option for ?

the manual pages on my box show no 'E' option.

And the 'b' option doesn't work. Read the following pragraph from tar manual pages:

b Use the next arg argument as the blocking factor for archive records. The default is 20; the maximum is at least 20. However, if the f - modifier is used to specify standard input, the default blocking factor is 1.


Frank Slootweg
Honored Contributor

Re: tar and dd combination

This command is all mixed up.

The "b .. 60" specifies a blocking factor of 60 (blocks of 512 bytes each), so a record size of 60 blocks, but dd(1) reads with a (default) input block size of 1 block and writes with a output block size of 800 blocks.

Furthermore, as others mentioned, HP-UX' tar(1) does not have an "E" option, and HP-UX' Remote Shell is remsh, not rsh.

So which system(s) *are* we talking about?

See also procura's comment about buffering over the network:

A 'remote pipe', i.e. a normal pipe combined with r[em]sh(1), does not guarantee that what comes in on one end comes out on the other end in the *same* 'chunks'. I.e. if you send for example 10 'chunks' of 60 blocks, 600 blocks will come out, but *not* neccessarily in 10 'chunks' of 60 blocks.

This is normally solved by putting a pair of dd(1) commands 'around' the remote pipe and letting the dd(1) commands write to and read from the remote pipe with the same block size, i.e. for example (using your strange example):

tar -cvf[E]b - 60 $1 | dd ibs=60b obs=8k | r[em]sh remoteserver dd ibs=8k of=/dev/rmt/0 obs=800b

BKUMAR
Frequent Advisor

Re: tar and dd combination

Hi All,

the remoteserver here is hp and soure server is sun....hope these is clear.....and it used to run fine for long time.....

It is fine now since source server has veritas cluster crashed and we need to do fsck manually for the filesystems and take a backup...it is fine now

Thanks all for the suggestions/hints....
Unix Administration Most Dedicated and Challenging Career in the World
BKUMAR
Frequent Advisor

Re: tar and dd combination

and the explanation for [E] from sun is

E Write a tarfile with extended headers. (Used with c,
r, or u options; ignored with t or x options.) When a
tarfile is written with extended headers, the modification time is Maintained with a granularity of
microseconds rather than seconds. In addition,
filenames no longer than PATH_MAX characters that
could not be archived without E, and file sizes
greater than 8GB, are supported. The E flag is
required whenever the larger files and/or files with
longer names, or whose UID/GID exceed 2097151, are to
be archived, or if time granularity of microseconds is
desired.

Unix Administration Most Dedicated and Challenging Career in the World
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: tar and dd combination

If you must handle files larger than 2GB and large UID/GID's then you are going to be far better off using the Gnu version of tar - on both ends. It has more options than the standard tar and is available for both Sun and HP-UX.

When you use non-standard arguments, especially across platforms, you are asking for problems.

If it ain't broke, I can fix that.