sftp the directories has different sizes after transfer?
i am moving folders from server into another debian
-> centos
using sftp .
the folders size is different after the transfer is done . for example :
remote server :
sftp 00.00.00
sftp get folderName ( size 87mb)
on local server :
du -sh *
folderName ( size 83mb )
is it possible i am not transferring the hidden files and folders?
Solution 1:
I'm not familiar with sftp, but the cause is probably a unit difference: du
shows size in MiB while sftp might show Mb. To convert from one to the other, multiply the size given by sftp by 1000*1000/(1024*1024)
(87 -> ~83).
Wikipedia page on the subject : https://en.wikipedia.org/wiki/Byte#Multiple-byte_units
Note that if you transfer very small files, you might some day notice that du
shows a greater size than expected. This is because du
shows the reserved size of the files on disk, which is greater than the actual 'usefull' size that is calculated by sftp.
Edit: to test this behavior, you can create a file with a controlled size and tranfer it. To create a 32 MiB (~33MB) file:
# 1048576 is 1 MiB (1024*1024)
dd if=/dev/zero bs=1048576 count=32 of=testfile