LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-27-2011, 03:14 PM   #1
metallica1973
Senior Member
 
Registered: Feb 2003
Location: Washington D.C
Posts: 2,190

Rep: Reputation: 60
A more efficient scp /cpio one liner


Is there a shorter way to pass a scp copy from a remote site locally and then pass it into cpio?

Code:
scp -Crp root@192.168.0.131:/var/backups/ /home/testuser/Downloads/extract/;find /home/testuser/Downloads/extract/backups | cpio -oavc > /home/testuser/Downloads/extract/testbackup.cpio
??
 
Old 10-27-2011, 03:29 PM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Code:
ssh root@192.168.0.131 "find /var/backups | cpio -oavc" > /home/testuser/Downloads/extract/testbackup.cpio
 
Old 10-27-2011, 09:08 PM   #3
metallica1973
Senior Member
 
Registered: Feb 2003
Location: Washington D.C
Posts: 2,190

Original Poster
Rep: Reputation: 60
awesome but will this scp the backups directly through cpio and then to the 1T media?It is a big backup and I dont have much space where the script will run from to store the files temporarily. Everything would need to occur on the 1T external drive.

So

Code:
scp -Crp testuser@192.168.5.1:/var/www/ --> cpio -oavc > /media/1T-drive/www/fullwwwsite.cpio
Also would you recommend compression while transferring this large ammount of data(500M+)? thanks

Last edited by metallica1973; 10-27-2011 at 09:21 PM.
 
Old 10-27-2011, 09:25 PM   #4
metallica1973
Senior Member
 
Registered: Feb 2003
Location: Washington D.C
Posts: 2,190

Original Poster
Rep: Reputation: 60
i tested it and it worked awesomely. many thanks man
 
Old 10-28-2011, 01:06 AM   #5
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
You're welcome!

As you already noticed, on the remote machine it writes to the standard output (no disk space required) and it redirects into a local cpio file.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cpio -idcmv command hanged while extracting .cpio command ravindra.atre Linux - General 2 08-22-2011 04:10 AM
awk one liner help niknak Linux - Newbie 1 05-07-2009 04:52 AM
IP Forward one-liner? JoeBleaux Linux - Networking 1 04-27-2009 10:24 AM
scp does not work and gives the following error message: scp: FATAL: Executing ssh1 i akay Linux - Networking 16 09-28-2008 11:41 PM
How to use cpio to extract a cpio archive? linx win Debian 4 06-17-2005 01:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration