[comp.unix.questions] uucping whole trees?

jc@cdx39.UUCP (John Chambers) (12/19/86)

Well, here I am again, with another "Has anyone done this yet?" question.
This time the problem is:  Do there exist Unix tools for copying a whole
heirarchy of files intact from one system to another?

Before you say "RTFM", I'll go into the obvious approaches and explain
some of the gotchas in all of them.

First, the trivially obvious one:
	find /usr -exec uucp {} somewhere!/usr/joe \;
This does several things wrong.  First, uucp will flatten it out into
a single directory.  There are ways to get around this, but then you
run into the real killer:  information about links is lost.  You end
up with multiple copies of a file, rather than multiple links to the
same file.

OK, so we go to cpio (or tar, if you prefer).  We try:
	find /usr -print |cpio -o >foo.cpio
	uucp foo.cpio somewhere!/usr/joe/foo.cpio
	...
	cpio -ivdum foo.cpio
This has several problems.  First, it requires enough free disk space to
hold too.cpio, and in /usr case, that means that you'd better have half
your disk free.  The receiver has the same problem.  

Second, uucp package will almost certainly fail to transfer foo.cpio in
most cases.  The /usr/spool/uucp directory is very often in a separate
disk partition (for good reason); uucp will try to first copy foo.c into 
a temp file /usr/spool/uucp/TM.12345.6789, and there won't be space.  If
it should perchance succeed in getting the file across, it will then try
to mv it to /usr/joe/foo.cpio, and if this is in a different file system,
the sender will time out and report the transfer has failed.  [In this
case, it might actually get there, but uucp will try it again in another
hour, causing much congestion.]

The obvious thing to do next is to break the list up into a bunch of lists,
and send over a flock of little cpio archives.  This is easier said than
done.  You have to somehow find out what files are multiply linked, and
arrange to have them included in the same archive, or you lose the links.

I'm contemplating writing some programs to do this.  I figure it'll take
a day or two.  But I thought maybe I'd first ask around and see if anyone
has already solved it.  If there is a program to do it, and it takes me
less than a day to get it running, I'll save some time.  If I can't find
a solution, I guess I'll just write my own, and maybe post it.

It seems that others must have faced this problem before.  The 'cptree'
script works just fine on a single machine; I basically need something
that will do the same across a uucp (or other file-transfer) link.

-- 
	John M Chambers			Phone: 617/364-2000x7304
Email: ...{adelie,bu-cs,harvax,inmet,mcsbos,mit-eddie,mot[bos]}!cdx39!{jc,news,root,usenet,uucp}
Smail: Codex Corporation; Mailstop C1-30; 20 Cabot Blvd; Mansfield MA 02048-1193
Clever-Saying: For job offers, call (617)484-6393 evenings and weekends.

geoff@desint.UUCP (Geoff Kuenning) (12/22/86)

In article <529@cdx39.UUCP> jc@cdx39.UUCP (John Chambers) asks a long
question about uucp-ing whole trees.  Problems he mentions are:  preserving
links, free space for cpio output files, and keeping output files small
enough to get reliable uucp performance.

I sent John a long answer;  if you'd like a copy write me and I'll send a
copy.  The gist is:  links can be preserved by sorting by i-number;  ls -s
and a small shell script can then break the file list up into appropriately-
sized chunks and cpio/compress/uucp them.  You can even watch uucp spool
space a la /usr/lib/acct/ckpacct, and suspend for a while if it gets full.
My long answer contains most of an untested sh script to do this.
-- 

	Geoff Kuenning
	{hplabs,ihnp4}!trwrb!desint!geoff

Herndon@HI-MULTICS.arpa (12/23/86)

I don't know what version of UNIX you are using, but BSD 4.2 machines
have the "rcp" (remote copy) command.  If one specifies the command
with the -r option the command will copy from one machine to the other
all files and directories rooted at the name specified.

The command syntax is something like this (this may not be right, please
verify it.):

    rcp -r <path> <host:path>

Path in each case must be a directory, and, if you are using a different
login name on the remote machine, you need to set up your .rhosts file
to include your other login name and host.  

I'm sorry I can't be more specific, but it's been a login time since I 
worked on a BSD 4.2 machine.  However, I hope this has been of some
help.

                                          - WRH

----------

William R. Herndon,     Honeywell -- Secure Computing Technology Center

ARPA: Herndon@hi-multics
      hamlet@walt.cc.utexas.edu

geoff@desint.UUCP (Geoff Kuenning) (12/23/86)

In article <279@desint.UUCP> I write:

> In article <529@cdx39.UUCP> jc@cdx39.UUCP (John Chambers) asks a long

It must have been late when I wrote this.  It wasn't John Chambers, it
was Mitch Lerner.  I followed up on the wrong article.

> You can even watch uucp spool
> space a la /usr/lib/acct/ckpacct, and suspend for a while if it gets full.
> My long answer contains most of an untested sh script to do this.

I should clarify that my untested script does everything *except* watch
uucp spool space.  I have a script that watches incoming uucp space;
let me know if you want that too.  You can use it (or /usr/lib/acct/ckpacct)
as a model for watching the outgoing uucp spool space in the send script.

Sorry for any confusion.
-- 

	Geoff Kuenning
	{hplabs,ihnp4}!trwrb!desint!geoff