Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm using rsync to copy files between servers, I'm using -z option what compresses data only for the network transfer stage.

But I would like to leave compressed files on remote machine and I have not found this option in rsync.

Is this possible ?

share|improve this question

3 Answers 3

up vote 4 down vote accepted

No, it is not possible. You'll need to compress the data either before or after you transfer it.

share|improve this answer
    
OK, I'll just use ssh+gzip then, thanks! –  Wojtek Aug 3 '12 at 12:09
    
Just curious : I'm interested in better understanding of zlib internals. Anyone has good documentation? –  coincoin Aug 3 '12 at 12:43

Short answer no.

Long answer : From what I understand of http://zlib.net/zlib_faq.html, zlib does not really compress files but chunks of a stream. You can't be sure that a total version of your file exists somewhere in a compressed state (think of sending a 200GB mp3 file : Do you need 190GB free space?).

share|improve this answer

The main reason why this is not possible is due to the nature of rsync. From the man page:

It is famous for its delta-transfer algorithm, which reduces the amount of data sent over the network by sending only the differences between the source files and the existing files in the destination.

Unless this is the first time you are transferring these files, only the changes are being sent. If you could somehow save the data stream, you'd end up with a sort of compressed diff file, which wouldn't be of any particular use.

Compress the files before passing them to rsync.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.