LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices

Reply
 
LinkBack Search this Thread
Old 08-04-2007, 07:03 AM   #1
j0hnd0e
Member
 
Registered: Nov 2005
Distribution: slamd64, slackware64
Posts: 34

Rep: Reputation: 15
rsnyc backup to gzip archive?


Hi

Is it possible to compress destination to one gzip file with rsync.
I'm trying to backup source dir /var/log to destination that will be backup.gz file?

Can Rsync compare content of gz archive with src dir content, and if content differ to update gz archive, or create new one with files that differ?
In gzip manual there is a switch command --rsyncable that should make gzip archive much compatible with rsync, but I do not know how it works with rsync.


thanks for your replys
 
Old 08-04-2007, 07:44 AM   #2
Dutch Master
Senior Member
 
Registered: Dec 2005
Posts: 1,667

Rep: Reputation: 112Reputation: 112
No, rsync does just that: remote synchronizing. It doesn't compress data permanently (it does during transfer, but I couldn't find anything about the algorithm used). However, what you want can be achieved using pipes: you send the output of one command to be used as input of the second command. In your case:
Code:
gzip <options> <source> <named backup> | rsync <user@machine:destination-dir>
Note that | is *not* a lowercase L or capital i, but a special character, usually found on the \ key.
 
Old 08-04-2007, 08:41 AM   #3
j0hnd0e
Member
 
Registered: Nov 2005
Distribution: slamd64, slackware64
Posts: 34

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Dutch Master
In your case:
Code:
gzip <options> <source> <named backup> | rsync <user@machine:destination-dir>
this will make only gzip-ed archive from source-dir, but afterwards it cannot be compared with source dir.

for example in usual rsync case (dir ---> dir)

rsync -a /sourcedir/data /destinationdir/backupdata
* this makes two eqauls dirs

but how it is possible to compare something like this:

rsync -a /sourcedir/data /destinationdir/backupdata.gz
* offcourse this command doesn't work. But is it possible somehow to compare content of gzip archive with /sourcedir/data and if differ to update archive, or create new one.


thanks
 
Old 08-04-2007, 09:06 AM   #4
Dutch Master
Senior Member
 
Registered: Dec 2005
Posts: 1,667

Rep: Reputation: 112Reputation: 112
I doubt it can be done directly, but using a script it can be done.
1) create a temp dir in /home/user
2) copy the tarred archive back from the backup-machine and unpack
3) compare the unpacked archive with the original file
4) if changed, gzip the original and send it to the backup-machine, else: end script

Another option is to gzip the original and then rsync those. Quicker, but I'm not sure it'll work reading the contents of the archive.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Making a bad gzip archive message to appear raklo Linux - Desktop 8 01-01-2007 02:42 AM
backup: dump vs tar-bzip/gzip kpachopoulos Linux - General 2 12-21-2006 06:45 AM
Doing backup of servers scripts using tar/gzip/scp/rm Swakoo Linux - General 4 12-05-2006 02:09 AM
retrieving tape backup after using cpio and gzip jazbinschek Linux - Newbie 8 12-29-2005 10:31 PM
How to backup/archive evolution emails? subaruwrx Linux - Software 4 10-25-2004 07:25 AM


All times are GMT -5. The time now is 09:08 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration