LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-05-2003, 12:12 PM   #1
pk21
Member
 
Registered: Jun 2002
Location: Netherlands - Amsterdam
Distribution: RedHat 9
Posts: 549

Rep: Reputation: 30
Question cp / tar ???


Hi all!

I want to make a backup of a hd, but the problem is i havent got that much space on my second disk. So when i copy the disk it has to zip the files. Anyone knows how i can get that to work???

cp -a olddisk newdisk | tar -xzvf ???

I know something like that should work.
 
Old 01-05-2003, 12:53 PM   #2
moses
Senior Member
 
Registered: Sep 2002
Location: Arizona, US, Earth
Distribution: Slackware, (Non-Linux: Solaris 7,8,9; OSX; BeOS)
Posts: 1,152

Rep: Reputation: 50
Do you want a single file on the new disk?
Code:
cd /src_dir
tar cvf - . | ( cd /dest_dir; gzip > foo.tgz )
or (better)
Code:
cd /src_dir
tar zcf /dest_dir/foo.tgz .
If you want everything compressed, but not tarred up:
Code:
cd /src_dir
tar cf - . | (cd /dest_dir; tar xvf -; gzip -r rcs)
N.B. This is not as efficient w.r.t. compression

Last edited by moses; 01-05-2003 at 02:32 PM.
 
Old 01-05-2003, 03:54 PM   #3
pk21
Member
 
Registered: Jun 2002
Location: Netherlands - Amsterdam
Distribution: RedHat 9
Posts: 549

Original Poster
Rep: Reputation: 30
ok, thanks!!!

but i was also wondering how i can do this over a network with for example ssh.
 
Old 01-05-2003, 06:04 PM   #4
moses
Senior Member
 
Registered: Sep 2002
Location: Arizona, US, Earth
Distribution: Slackware, (Non-Linux: Solaris 7,8,9; OSX; BeOS)
Posts: 1,152

Rep: Reputation: 50
I think you'll have to gzip/tar up the files on the host machine,
then scp them to your client machine.
 
Old 01-06-2003, 05:06 PM   #5
pk21
Member
 
Registered: Jun 2002
Location: Netherlands - Amsterdam
Distribution: RedHat 9
Posts: 549

Original Poster
Rep: Reputation: 30
thanks for replying, but that is not wat i meant. There has to be a command to put the output of 'tar' directly true a '|' and then 'scp' the tar.

In this way it won't require any space on the host you are making a backup off.
 
Old 01-06-2003, 06:32 PM   #6
moses
Senior Member
 
Registered: Sep 2002
Location: Arizona, US, Earth
Distribution: Slackware, (Non-Linux: Solaris 7,8,9; OSX; BeOS)
Posts: 1,152

Rep: Reputation: 50
Ok, I've read the scp and ssh man pages, and this is the way to do
it:
Code:
ssh -f user@server tar cvf - src_dir | ( cd /dest_dir; gzip > foo.tgz )
 
Old 01-07-2003, 12:58 PM   #7
pk21
Member
 
Registered: Jun 2002
Location: Netherlands - Amsterdam
Distribution: RedHat 9
Posts: 549

Original Poster
Rep: Reputation: 30
Thanks!!!
 
  


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
how can i decompress this tar.tar file? hmmm sounds new.. tar.tar.. help ;) kublador Linux - Software 14 10-25-2016 02:48 AM
tar tar cvf - . | (cd /root/; tar xvf -) ewt3y Linux - General 10 02-19-2014 10:55 AM
a tough question 4 u, problem in extracting tar & tar.gz files p_garg Linux - General 5 11-08-2010 11:02 AM
.rpms, .tar.gz, .tgz, .src.rpm, & .tar.bz2 whoots Mandriva 10 10-18-2003 12:08 PM
Diferance between rpm, tar, tar.gz, scr.tar, etc mobassir Linux - General 12 08-21-2003 06:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:43 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