Sample Header Ad - 728x90

The reason why buffers in "free -h" command output is increased

0 votes
1 answer
239 views
I did two experiments. **The first experiment (Ubuntu 20.04, ext4 filesystem):** 1. 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
2. Run command sudo find / | grep something 3. 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):** 1. 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
2. Run command dd if=/dev/nvme0n1p2 of=/dev/null bs=1M count=500 - your disk would be another here 3. 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 https://unix.stackexchange.com/questions/34422/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.
Asked by OSintegrator (1 rep)
Jun 18, 2021, 05:13 AM
Last activity: Jun 20, 2021, 10:49 PM