Why does the du command show double size when sending the h flag?

I want to check the total size of the git repository. It's funny that du gives me two different size kings when sending the -h flag. In fact, this gives a double size.

Why is this? What is the correct size?

MyMac:~/repositories/my-repo.git davidrod$ du -h
  0B    ./branches
 64K    ./hooks
4.0K    ./info
  0B    ./objects/info
3.3M    ./objects/pack
3.3M    ./objects
4.0K    ./refs/heads
8.0K    ./refs/tags
 12K    ./refs
3.3M    .
MyMac:~/repositories/my-repo.git davidrod$ du 
0   ./branches
128 ./hooks
8   ./info
0   ./objects/info
6672    ./objects/pack
6672    ./objects
8   ./refs/heads
16  ./refs/tags
24  ./refs
6856    .
+4
source share
2 answers

The OSX size (which I assume you have on behalf of the computer) is designed for 512-byte blocks because it uses the BSD version du(other versions, such as Cygwin, which I use now on Windows, behave differently).

So for each 1K you get two blocks, apparently doubling the value of each size.

+4
source

. (512B ). 1 = 2 .

+3

Source: https://habr.com/ru/post/1540146/


All Articles