0

I am running a regular rsync between a local folder and a remoter one via ssh. I got confused when I saw that the remote (and target) folder had a different size, it was smaller. I first suspected excluded files, but that wasn't the case. Instead I discovered the following.

The sizes in a local folder (a subfolder of the one I am syncing) look like this:

112K    .
48K ./workspace.xml
12K ./vcs.xml
12K ./preferred-vcs.xml
12K ./pm-client.iml
12K ./modules.xml
12K ./misc.xml

the remote ones, however, like this:

64K .
40K ./workspace.xml
4,0K    ./vcs.xml
4,0K    ./preferred-vcs.xml
4,0K    ./pm-client.iml
4,0K    ./modules.xml
4,0K    ./misc.xml

When I check the file contents, however, they look just the same. I see this a lot in the target folder, which ultimately leads to big differences in folder sizes.

The rsync I am running looks like this:

rsync -aPEh -e ssh --delete --delete-excluded --stats --exclude-from=<some-ignorelist> /source/folder/ /target/backup/folder

What can be the reason for this?

Yanick Nedderhoff
  • 1,174
  • 3
  • 18
  • 35
  • 1
    Where do these numbers come from (which command produced them)? This looks suspiciously like the filesystems using different block sizes. – DarkDust Apr 08 '17 at 10:24
  • Maybe... they come from `sudo du -a -h --max-depth=1 | sort -hr`. I have an alias for this, always using it when I want a ordered list of file and folder sizes. – Yanick Nedderhoff Apr 08 '17 at 11:21
  • Damn, yeah - `ls -allh` gives me the same sizes. What's wrong with my beautiful alias then? I want something that doesn't give me the `4,0K` for folders but the size of it including everything that's in it. – Yanick Nedderhoff Apr 08 '17 at 11:25

1 Answers1

3

The sizes that du and ls report are different: du reports the amount of space actually allocated on the filesystem while ls reports the the logical file size.

There are several questions on various StackExchange sites about this.

Why does du report different sizes on your two machines? Because they are either using different filesystems or they are configured differently. It all boils down to the block sizes used on the filesystem, which is what du reports.

Community
  • 1
  • 1
DarkDust
  • 90,870
  • 19
  • 190
  • 224