1

I'm performing an rsync of files into an encrypted volume, which has a maximum size. Before performing the synchronization process I would like to determine if there is enough space left in the volume.

I have already played around with the --dry-run option of rsync but it does not give me amount ADDITIONAL bytes that have to be transfered, e.g.

File_A -> 30KB
rsync for first time
change File_A -> 73KB

Now I would like to receive the amount of additional space I need, which in this case would be 43KB. That should be done for all files and sub-folders so that I can determine if the space left on the volume is sufficient.

By using the --dry-run option like this:

 rsync -an --stats test.txt folder/

 Number of files: 1 (reg: 1)
 Number of created files: 0
 Number of deleted files: 0
 Number of regular files transferred: 1
 Total file size: 10 bytes
 Total transferred file size: 10 bytes
 Literal data: 0 bytes
 Matched data: 0 bytes
 File list size: 0
 File list generation time: 0.001 seconds
 File list transfer time: 0.000 seconds
 Total bytes sent: 68
 Total bytes received: 19

 sent 68 bytes  received 19 bytes  174.00 bytes/sec
 total size is 10  speedup is 0.11 (DRY RUN)

The file folder/test.txt is of size 6Bytes, and the test.txt is of size 10Bytes, therefore the difference is 4Bytes. But I only receive the total size of the file that has to be changed in the Total file size: 10bytes.

Is there any way (or even other tool) where I can determine the additional sizes?

  • If your destination filesystem is encrypted, you could only get a rough estimate of the extra space needed as many such filesystems will add extra random data to files to obfuscate their real size, and compress the data before encryping, so a larger new file could finally take less space if it compresses better than it did before. – meuh May 16 '17 at 18:19
  • But there must be some maximum size of the volume otherwise how would the encryption program determine when it's to much data or not? – wasp256 May 16 '17 at 19:07
  • Note that the total file size doesn't tell you disk usage, for various reasons. It's only an approximation. – Gilles May 16 '17 at 23:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.