-1

I have a server in which there's a file with 30GB inside the partition /, although df -h lists this partition as using 11GB. Why does that happen?

[root@APPSERVER21-S1 ~]# ls -l /etc/vinter/logs/
total 2046032
-rw-r--r-- 1 root root     3920496 Sep 11 14:35 PlusoftCRMIntegration-APISILVERNODE-1.log
-rw-r--r-- 1 root root 30823671719 Sep 11 15:13 rsp.appserver21-s1.apigoldnode-1.api-oi-gold.log
-rw-r--r-- 1 root root   406061056 Sep 11 15:13 rsp.appserver21-s1.apisilvernode-1.api-oi-silver.log
[root@APPSERVER21-S1 ~]# df -h
Filesystem                      Size  Used Avail Use% Mounted on
devtmpfs                        3.6G     0  3.6G   0% /dev
tmpfs                           3.6G     0  3.6G   0% /dev/shm
tmpfs                           3.6G  137M  3.4G   4% /run
tmpfs                           3.6G     0  3.6G   0% /sys/fs/cgroup
/dev/mapper/vg_main-lv_root      16G  5.0G   11G  32% /
/dev/mapper/vg_dados-lv_dados    20G   33M   20G   1% /datastorage
/dev/mapper/vg_dados-lv_docker   80G  128M   79G   1% /var/lib/docker
/dev/xvdb1                      497M  161M  337M  33% /boot
tmpfs                           722M     0  722M   0% /run/user/0
JM Calil
  • 9
  • 5
  • Could be a [sparse file](https://stackoverflow.com/questions/43126760/what-is-a-sparse-file-and-why-do-we-need-it)? – melpomene Sep 11 '18 at 18:26
  • 1
    [so] is for programming questions, not questions about using or configuring Linux and its applications. [su] or [unix.se] would be better places for questions like this. – Barmar Sep 11 '18 at 18:46

1 Answers1

1

I have a server in which there's a file with 30GB inside the partition /, although df -h lists this partition as using 11GB.

Actually, it lists this filesystem as using 5 GB, not 11 GB.

Why does that happen?

This is impossible to answer without knowing what the contents of that file are, what the filesystem is, how the file was created, and so on.

There are filesystems that perform data-deduplication. If there are blocks with identical content, they will be replaced with links, so that they only take up the space of one block. So, if there is a lot of duplicate data on the filesystem, it is easily possible that the files take up much less space on-disk than their duplicated contents.

There are filesystems that perform compression. If there is a lot of redundancy on the filesystem, then the compression will reduce the data dramatically, and it is easily possible that the files take up much less space on-disk than their uncompressed contents.

Many filesystems support sparse files. Sparse files are files with "holes" in them. The holes will be read as a long string of binary zeroes, and are technically part of the content of the file, but they are not stored on-disk.

Jörg W Mittag
  • 363,080
  • 75
  • 446
  • 653