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 ?
No, it is not possible. You'll need to compress the data either before or after you transfer it.
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?).
The main reason why this is not possible is due to the nature of
rsync
. From theman
page: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
.