Score:3

why `rsync --sparse` create much larger file than the source?

de flag

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.

anx avatar
fr flag
anx
Is it gone with smaller --block-size? (I wonder if it is just the overhead from rsync not punching unaligned holes)
anx avatar
fr flag
anx
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)
de flag
@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.
de flag
@anx check my update on block size
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.