From owner-freebsd-questions Fri Apr 5 7:47: 7 2002 Delivered-To: freebsd-questions@freebsd.org Received: from ns1.otenet.gr (ns1.otenet.gr [195.170.0.2]) by hub.freebsd.org (Postfix) with ESMTP id 78B0937B8F1 for ; Fri, 5 Apr 2002 07:46:39 -0800 (PST) Received: from mailsrv.otenet.gr (mailsrv.otenet.gr [195.170.0.5]) by ns1.otenet.gr (8.12.2/8.12.2) with ESMTP id g35FijMk023621 for ; Fri, 5 Apr 2002 18:44:45 +0300 (EEST) Received: from hades.hell.gr (patr530-a050.otenet.gr [212.205.215.50]) by mailsrv.otenet.gr (8.12.2/8.12.2) with ESMTP id g35FgT2a017820; Fri, 5 Apr 2002 18:42:30 +0300 (EEST) Received: from hades.hell.gr (hades [127.0.0.1]) by hades.hell.gr (8.12.2/8.12.2) with ESMTP id g35FgUkt003483; Fri, 5 Apr 2002 18:42:30 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Received: (from charon@localhost) by hades.hell.gr (8.12.2/8.12.2/Submit) id g35FgFpb003441; Fri, 5 Apr 2002 18:42:15 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Date: Fri, 5 Apr 2002 18:42:01 +0300 From: Giorgos Keramidas To: George Georgalis Cc: Peter Leftwich , "Scott M. Nolde" , FreeBSD Questions Subject: Re: find | cpio syntax [use scp] Message-ID: <20020405154200.GD553@hades.hell.gr> 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> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020404103749.D9116@trot.haven.dom> User-Agent: Mutt/1.3.28i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG [ 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