I did two experiments.
The first experiment (Ubuntu 20.04, ext4 filesystem):
- Run command
free -h -w
:
$ free -h -w
total used free shared buffers cache available
Mem: 30Gi 2,6Gi 25Gi 106Mi 126Mi 2,1Gi 27Gi
- Run command
sudo find / | grep something
- Run command
free -h -w
again and observe significant (about 1G) increasing of "buffers" column, and increasing of "cache" column as well (about 500M):
$ free -h -w
total used free shared buffers cache available
Mem: 30Gi 2,6Gi 24Gi 106Mi 1,2Gi 2,6Gi 27Gi
The second experiment (same PC):
- Run command
free -h -w
:
$ free -h -w
total used free shared buffers cache available
Mem: 30Gi 2,6Gi 24Gi 106Mi 1,2Gi 2,6Gi 27Gi
- Run command
dd if=/dev/nvme0n1p2 of=/dev/null bs=1M count=500
- your disk would be another here - Run command
free -h -w
again and observe 500M increasing of buffers:
$ free -h -w
total used free shared buffers cache available
Mem: 30Gi 2,6Gi 24Gi 115Mi 1,7Gi 2,6Gi 27Gi
So the question is: why buffers
column was increased in the first and why in the second case? I've read this What is the buffers column in the output from free? but answers here are not appropriate for me.
They tell "buffers column contains metadata about files" - but it is wrong, because it is the "cache" column that counts slabs for inode, dentry and buffer_head (which are actually metadata of files). man free
also tells us that cache
column contains SReclaimable
.
They also tell "buffers column contains cache of blocks from block devices" - and it looks more like the truth, it explains why buffers
increased when I ran dd
, but it does not explain why buffers
column increased when I ran find
command. And even in case of dd
- why we need it if we already have file cache? Nobody read/write directly from/to block devices except of DVD disks.