Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Apr 2002 18:42:01 +0300
From:      Giorgos Keramidas <keramida@ceid.upatras.gr>
To:        George Georgalis <george@galis.org>
Cc:        Peter Leftwich <Hostmaster@Video2Video.Com>, "Scott M. Nolde" <scott@smnolde.com>, FreeBSD Questions <freebsd-questions@FreeBSD.ORG>
Subject:   Re: find | cpio syntax [use scp]
Message-ID:  <20020405154200.GD553@hades.hell.gr>
In-Reply-To: <20020404103749.D9116@trot.haven.dom>
References:  <20020327215404.A39175@smnolde.com> <20020328005735.D97853-100000@earl-grey.cloud9.net> <20020328192151.GA1528@hades.hell.gr> <20020328160724.K15459@trot.haven.dom> <20020328224728.GB3044@hades.hell.gr> <20020404103749.D9116@trot.haven.dom>

next in thread | previous in thread | raw e-mail | index | archive | help
[ I wrapped the lines, to fit in less than 80 columns. ]
[ Other than this, no other major changes have been done. ]

On 2002-04-04 10:37, George Georgalis wrote:
>On Fri, Mar 29, 2002 at 12:47:28AM +0200, Giorgos Keramidas wrote:
>>On 2002-03-28 16:07, George Georgalis wrote:
>>> On Thu, Mar 28, 2002 at 09:21:51PM +0200, Giorgos Keramidas wrote:
>>> >
>>> >I customarily use ssh to copy files over ssh links:
>>> >
>>> >    $ tar cvf - . | gzip -9c | ssh -T user@host 'mkdir foo ; cd foo ; gzip -cd | tar xf -'
>>> >
>>> >The trick is to properly quote the ssh command, so that it's not executed
>>> >by the local shell :-)
>>>
>>> I wouldn't mind seeing a translation using cpio, since I
>>> understand it can preserve more attributes. I tried but...
>>>
>>> doesn't work:
>>>   find /var/tmp -print | cpio -oa | gzip -9c |\
>>>   ssh -T root@fait 'mkdir /tmp/foo ; cd /tmp/foo ; gzip | cpio -i'
>>
>>You missed the -cd options to the second gzip invocation (the one within
>>the quotes).
>
> there are still some problems... the sockets below (Invalid
> argument) didn't come over (even if they don't work on the new host
> shouldn't they come over?) and all of the mtimes have been reset to
> the time of the transfer.
>
> find /var/tmp -print | cpio -oa | gzip -9c |\
> ssh -T root@fait 'mkdir /tmp/foo ; cd /tmp/foo ; gzip -cd | cpio -i'
>
> cpio: /var/tmp/ssh-XXKhaWtb/agent.1000: Invalid argument

This is a UNIX domain socket file.  Can't be copied, it's just there
while an ssh-agent process exists that listens to connections...

> cpio: /var/tmp/ssh-XXNLjfGb/agent.10806: Invalid argument

Ditto.

> cpio: /var/tmp/-extended.pdf: truncating inode number
> cpio: /var/tmp/-extended.txt: truncating inode number

This is explained in the cpio manuals.  The inode number of this file
is too large to fit in the size of integer used in the default cpio
format.  Look at the description of option -H in cpio(1).

> and apparently because the full path is in the find statement, the
> files don't get extracted in /tmp/foo as expected, but in /var/tmp

Correct.  By default cpio will save the absolute filename when copying
data to an archive.  Unless you use the --no-absolute-filenames option.

> fixed with
> cd / ; find ./var/tmp -print | cpio -oa |\
> ssh -T root@fait 'mkdir /tmp/foo ; if [ ! -d /tmp/foo ]; then \
> mkdir -p /tmp/foo ; fi ; cd /tmp/foo | cpio -i'
>
> cpio: var/tmp: truncating inode number
> cpio: var/tmp/.fam_socket: truncating inode number
> cpio: var/tmp/formmail.tar.gz: truncating inode number
>
> and there's this...
> cpio: premature end of archive

I don't know what this is all about.  Perhaps an ssh connection that
has been dropped before the cpio archive passes correctly over it?

> I guess I didn't finish experimenting with it... it really looks as
> if cpio can just use ssh as a shell. Anyone done that?

Should be possible.  I think that anything that can put/get its data
to/from a stream connection can be used as the transport medium of
tar/cpio archives.

Giorgos Keramidas                       FreeBSD Documentation Project
keramida@{freebsd.org,ceid.upatras.gr}  http://www.FreeBSD.org/docproj/

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020405154200.GD553>