3

I try to rsync between 2 local disks, thus there is no compression. the sparse file has apparent size of 50GB, actual size of 16GB. I tried rsync -a -P --sparse, it did generate sparse file on destination at the end. However, it is not as sparse as the source file. The generated file is 27GB instead of 16GB. I can use fallocate -d <filename> to shrink it more. It became around 18GB. However, this operation takes quite long time. In other hand, cp -a --sparse can create identical file.

Also the speed is as slow as the rsync command without --sparse. This is because:

As currently designed, the --sparse option only affects writing of the destination file, not the transfer of the data

However, I am more interested in the remote size. I wonder why rsync did not replicate the exact same size of the source file as cp --sparse=always?

This even happens when the destination is empty. So i guess this has nothing to do with --inplace option.

rsync  version 3.1.3  protocol version 31

according to @anx, I did some test with --block-size=4096 which yield same file size on remote.

Wang
  • 292
  • 1
  • 2
  • 11
  • Is it gone with smaller --block-size? (I wonder if it is just the overhead from rsync not punching unaligned holes) – anx Oct 08 '22 at 19:11
  • Does this answer your question? [Sparse files significantly larger (but still sparse) after copying over a network](https://serverfault.com/questions/707786/sparse-files-significantly-larger-but-still-sparse-after-copying-over-a-networ) – anx Oct 08 '22 at 19:12
  • @anx this does not answer my question at all. I am ok to use `--sparse` every time, and I am using backup. thus I do not use `--inplace`. My concern is more about the size of the sparse file on remote. – Wang Oct 08 '22 at 19:51
  • @anx check my update on block size – Wang Oct 08 '22 at 19:53

0 Answers0