我有两个在资源方面相同的 VM。有人可以向我解释为什么下面的目录大小不同,即使它们都有相同的内容?
虚拟机1
root@vrni-platform:/usr/share/elasticsearch# ls -lah
total 560K
drwxr-xr-x 7 root root 4.0K Jul 29 13:59 .
drwxr-xr-x 141 root root 4.0K Jul 29 13:59 ..
drwxr-xr-x 2 root root 4.0K Jul 29 14:37 bin
drwxr-xr-x 9 root root 4.0K Jul 29 13:59 jdk
drwxr-xr-x 3 root root 4.0K Jul 29 13:59 lib
drwxr-xr-x 46 root root 4.0K Jul 29 13:59 modules
-rw-rw-r-- 1 root root 523K May 28 16:35 NOTICE.txt
drwxr-xr-x 2 root root 4.0K May 28 16:35 plugins
-rw-r--r-- 1 root root 8.0K May 28 16:35 README.asciidoc
虚拟机2
root@vrni-platform:/usr/share/elasticsearch# ls -lah
total 568K
drwxr-xr-x 7 root root 4.0K Jul 28 13:50 .
drwxr-xr-x 141 root root 4.0K Jul 28 10:35 ..
drwxr-xr-x 2 root root 4.0K Jul 29 07:20 bin
drwxr-xr-x 9 root root 4.0K Jul 28 13:50 jdk
drwxr-xr-x 3 root root 12K Jul 28 13:50 lib
drwxr-xr-x 46 root root 4.0K Jul 28 10:35 modules
-rw-rw-r-- 1 root root 523K May 28 16:35 NOTICE.txt
drwxr-xr-x 2 root root 4.0K May 28 16:35 plugins
-rw-r--r-- 1 root root 8.0K May 28 16:35 README.asciidoc
在 VM2 中,大小lib
为 12K,而在 VM1 中,大小lib
为 4K。
lib
VM1 中的内容
root@vrni-platform:/usr/share/elasticsearch/lib# ls -lah
total 26M
drwxr-xr-x 3 root root 4.0K Jul 29 13:59 .
drwxr-xr-x 7 root root 4.0K Jul 29 13:59 ..
-rw-r--r-- 1 root root 12M May 28 16:35 elasticsearch-7.7.1.jar
-rw-r--r-- 1 root root 18K May 28 16:35 elasticsearch-cli-7.7.1.jar
-rw-r--r-- 1 root root 44K May 28 16:35 elasticsearch-core-7.7.1.jar
-rw-r--r-- 1 root root 44K May 28 16:35 elasticsearch-geo-7.7.1.jar
-rw-r--r-- 1 root root 21K May 28 16:35 elasticsearch-launchers-7.7.1.jar
-rw-r--r-- 1 root root 6.4K May 28 16:35 elasticsearch-plugin-classloader-7.7.1.jar
-rw-r--r-- 1 root root 11K May 28 16:35 elasticsearch-secure-sm-7.7.1.jar
-rw-r--r-- 1 root root 135K May 28 16:35 elasticsearch-x-content-7.7.1.jar
-rw-r--r-- 1 root root 112K May 28 16:35 HdrHistogram-2.1.9.jar
-rw-r--r-- 1 root root 1.2M May 28 16:35 hppc-0.8.1.jar
-rw-r--r-- 1 root root 342K May 28 16:35 jackson-core-2.10.4.jar
-rw-r--r-- 1 root root 58K May 28 16:35 jackson-dataformat-cbor-2.10.4.jar
-rw-r--r-- 1 root root 89K May 28 16:35 jackson-dataformat-smile-2.10.4.jar
-rw-r--r-- 1 root root 46K May 28 16:35 jackson-dataformat-yaml-2.10.4.jar
-rw-r--r-- 1 root root 8.6K May 28 16:35 java-version-checker-7.7.1.jar
-rw-r--r-- 1 root root 865K May 28 16:35 jna-4.5.1.jar
-rw-r--r-- 1 root root 628K May 28 16:35 joda-time-2.10.4.jar
-rw-r--r-- 1 root root 77K May 28 16:35 jopt-simple-5.0.2.jar
-rw-r--r-- 1 root root 780K May 28 16:35 jts-core-1.15.0.jar
-rw-r--r-- 1 root root 258K May 28 16:35 log4j-api-2.11.1.jar
-rw-r--r-- 1 root root 1.6M May 28 16:35 log4j-core-2.11.1.jar
-rw-r--r-- 1 root root 1.7M May 28 16:35 lucene-analyzers-common-8.5.1.jar
-rw-r--r-- 1 root root 137K May 28 16:35 lucene-backward-codecs-8.5.1.jar
-rw-r--r-- 1 root root 3.4M May 28 16:35 lucene-core-8.5.1.jar
-rw-r--r-- 1 root root 89K May 28 16:35 lucene-grouping-8.5.1.jar
-rw-r--r-- 1 root root 205K May 28 16:35 lucene-highlighter-8.5.1.jar
-rw-r--r-- 1 root root 146K May 28 16:35 lucene-join-8.5.1.jar
-rw-r--r-- 1 root root 51K May 28 16:35 lucene-memory-8.5.1.jar
-rw-r--r-- 1 root root 97K May 28 16:35 lucene-misc-8.5.1.jar
-rw-r--r-- 1 root root 372K May 28 16:35 lucene-queries-8.5.1.jar
-rw-r--r-- 1 root root 374K May 28 16:35 lucene-queryparser-8.5.1.jar
-rw-r--r-- 1 root root 219K May 28 16:35 lucene-sandbox-8.5.1.jar
-rw-r--r-- 1 root root 303K May 28 16:35 lucene-spatial3d-8.5.1.jar
-rw-r--r-- 1 root root 236K May 28 16:35 lucene-spatial-extras-8.5.1.jar
-rw-r--r-- 1 root root 244K May 28 16:35 lucene-suggest-8.5.1.jar
-rw-r--r-- 1 root root 302K May 28 16:35 snakeyaml-1.26.jar
-rw-r--r-- 1 root root 201K May 28 16:35 spatial4j-0.7.jar
-rw-r--r-- 1 root root 51K May 28 16:35 t-digest-3.2.jar
drwxr-xr-x 4 root root 4.0K Jul 29 13:59 tools
lib
VM2中的内容
root@vrni-platform:/usr/share/elasticsearch/lib# ls -lah
total 26M
drwxr-xr-x 3 root root 12K Jul 28 13:50 .
drwxr-xr-x 7 root root 4.0K Jul 28 13:50 ..
-rw-r--r-- 1 root root 12M May 28 16:35 elasticsearch-7.7.1.jar
-rw-r--r-- 1 root root 18K May 28 16:35 elasticsearch-cli-7.7.1.jar
-rw-r--r-- 1 root root 44K May 28 16:35 elasticsearch-core-7.7.1.jar
-rw-r--r-- 1 root root 44K May 28 16:35 elasticsearch-geo-7.7.1.jar
-rw-r--r-- 1 root root 21K May 28 16:35 elasticsearch-launchers-7.7.1.jar
-rw-r--r-- 1 root root 6.4K May 28 16:35 elasticsearch-plugin-classloader-7.7.1.jar
-rw-r--r-- 1 root root 11K May 28 16:35 elasticsearch-secure-sm-7.7.1.jar
-rw-r--r-- 1 root root 135K May 28 16:35 elasticsearch-x-content-7.7.1.jar
-rw-r--r-- 1 root root 112K May 28 16:35 HdrHistogram-2.1.9.jar
-rw-r--r-- 1 root root 1.2M May 28 16:35 hppc-0.8.1.jar
-rw-r--r-- 1 root root 342K May 28 16:35 jackson-core-2.10.4.jar
-rw-r--r-- 1 root root 58K May 28 16:35 jackson-dataformat-cbor-2.10.4.jar
-rw-r--r-- 1 root root 89K May 28 16:35 jackson-dataformat-smile-2.10.4.jar
-rw-r--r-- 1 root root 46K May 28 16:35 jackson-dataformat-yaml-2.10.4.jar
-rw-r--r-- 1 root root 8.6K May 28 16:35 java-version-checker-7.7.1.jar
-rw-r--r-- 1 root root 865K May 28 16:35 jna-4.5.1.jar
-rw-r--r-- 1 root root 628K May 28 16:35 joda-time-2.10.4.jar
-rw-r--r-- 1 root root 77K May 28 16:35 jopt-simple-5.0.2.jar
-rw-r--r-- 1 root root 780K May 28 16:35 jts-core-1.15.0.jar
-rw-r--r-- 1 root root 258K May 28 16:35 log4j-api-2.11.1.jar
-rw-r--r-- 1 root root 1.6M May 28 16:35 log4j-core-2.11.1.jar
-rw-r--r-- 1 root root 1.7M May 28 16:35 lucene-analyzers-common-8.5.1.jar
-rw-r--r-- 1 root root 137K May 28 16:35 lucene-backward-codecs-8.5.1.jar
-rw-r--r-- 1 root root 3.4M May 28 16:35 lucene-core-8.5.1.jar
-rw-r--r-- 1 root root 89K May 28 16:35 lucene-grouping-8.5.1.jar
-rw-r--r-- 1 root root 205K May 28 16:35 lucene-highlighter-8.5.1.jar
-rw-r--r-- 1 root root 146K May 28 16:35 lucene-join-8.5.1.jar
-rw-r--r-- 1 root root 51K May 28 16:35 lucene-memory-8.5.1.jar
-rw-r--r-- 1 root root 97K May 28 16:35 lucene-misc-8.5.1.jar
-rw-r--r-- 1 root root 372K May 28 16:35 lucene-queries-8.5.1.jar
-rw-r--r-- 1 root root 374K May 28 16:35 lucene-queryparser-8.5.1.jar
-rw-r--r-- 1 root root 219K May 28 16:35 lucene-sandbox-8.5.1.jar
-rw-r--r-- 1 root root 303K May 28 16:35 lucene-spatial3d-8.5.1.jar
-rw-r--r-- 1 root root 236K May 28 16:35 lucene-spatial-extras-8.5.1.jar
-rw-r--r-- 1 root root 244K May 28 16:35 lucene-suggest-8.5.1.jar
-rw-r--r-- 1 root root 302K May 28 16:35 snakeyaml-1.26.jar
-rw-r--r-- 1 root root 201K May 28 16:35 spatial4j-0.7.jar
-rw-r--r-- 1 root root 51K May 28 16:35 t-digest-3.2.jar
drwxr-xr-x 4 root root 4.0K Jul 28 10:35 tools
正如这里所解释的,在 Linux 中,目录的大小通常为 4K,其中包含指向目录中文件列表的链接。那么有人可以让我知道为什么在上述两种情况下报告的目录大小不同吗?
操作系统 - Ubuntu 16.04.6