Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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? – user130370 Aug 3 '12 at 12:43

Short answer no.

Long answer : From what I understand of, 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


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.