1833883 Members
2085 Online
110063 Solutions
New Discussion

tar and cpio

 
Jairo Campana
Trusted Contributor

tar and cpio

Hello I need made backup of serverA/diretoryA to serverB/directoryB (file system)
2500Gb directoryA(file system)

tar cvf - /directoryA |rsh ServerA dd of=/directoryB
Its work.

I need to do with the command cpio

thanks

legionx
11 REPLIES 11
Steven E. Protter
Exalted Contributor

Re: tar and cpio

Hmmm

How about:

scp -rp /directoryA/* serverb:/directoryB

rcp -rp /directoryA/* serverb:/directoryB

# issue tar or cpio command as an ssh or rsh command.

scp/ssh are the secure replacements for rcp/rsh

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
hpuxrox
Respected Contributor

Re: tar and cpio

I aways use,

tar -cvf - . | remsh client "cd /directory ; tar -xvf -"


H.Merijn Brand (procura
Honored Contributor

Re: tar and cpio

Yates is right, though the cd isn't needed, since you use absolute path's

The command you use in your own example is wrong twice. 1. you do a rsh on you own machine, where you probably mean to start it on the other machine, and 2. dd will only stream, and not create a directory tree, leaving a tar archive in the *file* /directoryB

With cpio that would be

# find /directoryA | cpio -oc | remsh serverB cpio -iudcm

# tar cf - /directoryA | remsh serverB tar xf -

for 2500Gb NEVER use NFS :)

If you have a less reliable network, using dd as a buffer might help tar/cpio on the receiving side:

# find /directoryA | cpio -oc | remsh serverB dd \| cpio -iudcm

# tar cf - /directoryA | remsh serverB dd \| tar xf -

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Tim D Fulford
Honored Contributor

Re: tar and cpio

Hi

what about

tar cf - | gzip - | remsh "gunzip - | tar xf -"

This will be quicker as it transfers the files zipped up... (as generally the network is the slow part of the transfer)

If you want to use ssh etc replace the remsh with th appropriate command.

Tim
-
Jim Butler
Valued Contributor

Re: tar and cpio

if you can mount from serverB - to serverA - my favorite is..

log into serverB

cd /net/serverA/directoryA

Then,

find . -depth -print | cpio -pdm /directoryB/


Have fun!
Man The Bilge Pumps!
Jairo Campana
Trusted Contributor

Re: tar and cpio

it mistakes my commando to me with tar is
tar cvf - /directoryA |rsh ServerA dd of=/directoryB/test.tar

is work

Steven E Protter scp and sftp , winscp ...
I know it, the idea is to do it with cpio
since I did with command tar

Yates H. Randall , is like my command:
tar -cvf - . | remsh client "cd /directory ; tar -xvf -"

tar cvf - /directoryA |rsh ServerA dd of=/directoryB


Procura:
find /directoryA | cpio -oc | remsh serverB cpio -iudcm
error:
find /diretoryA |cpio -oc |rsh serverB cpio -iudcm
11 blocks
Out of phase--get help
Perhaps the "-c" option shouldn't be used

find /directoryA | cpio -oc | remsh serverB dd \| cpio -iudcm
11 blocks
11+0 records in
11+0 records out
Out of phase--get help
Perhaps the "-c" option shouldn't be used

in serverB no exist directoryA , Its no work


Jim Butler : not NFS, not SAMBA,not Cifs





legionx
Jairo Campana
Trusted Contributor

Re: tar and cpio

ServerA is solaris8 and ServerB is a HPUX11.0
legionx
D Block 2
Respected Contributor

Re: tar and cpio

a simple rule using cpio is to have the same options on both runs -- except the "i" and the "o"

cpio -icdumv | remsh .. cpio -ocdumv

you might try using "B" for blocking.
# man cpio
states "B" option good for variable size records, writing to a tape device.
Golf is a Good Walk Spoiled, Mark Twain.
twang
Honored Contributor

Re: tar and cpio

For remote backups, my suggestions are:

# fbackup -f remote_system_name:/dev/rmt/0m -i file_name -v
example: fbackup -f hp_a:/dev/rmt/0m -i /var/spool/lp/ -v

To extract a cpio archive from a remote tape device:

# remsh square "dd if=/dev/rmt/0m bs=8k" | cpio -icvBdum

H.Merijn Brand (procura
Honored Contributor

Re: tar and cpio

The -c is for more compatible exchange format.

Can you switch to GNU cpio?

# find /directoryA | gcpio -o --format=crc | remsh serverB dd \| gcpio -i -u -d -m

GNU's cpio does not need the -c options when using -i, because it detects the format itself!

If you would use GNU tar, you can compress on the fly

# gtar -czf - /directoryA | remsh serverB dd \| gtar -xzf -

And, again, do NOT use NFS (remote mounts) unless you want to last the transfer forever

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
H.Merijn Brand (procura
Honored Contributor

Re: tar and cpio

And the message you got makes me beleive that the source isn't that big

# find /directoryA | wc -l

shows you how many files and/or directories it contains

# du -s /directoryA

shows you how many blocks should be transfered

Enjoy. Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn