# free
total used free shared buffers cached
Mem: 3848656 2889508 959148 5316 263896 2023340
-/+buffers/cache: 602272 3246384
Swap: 2031612 0 2031612
# find / -name abc.def
# free
total used free shared buffers cached
Mem: 3848656 2984052 864604 5320 319612 2023348
-/+buffers/cache: 641092 3207564
Swap: 2031612 0 2031612
再测试一下直接读取block device,观察”buffers”增加的现象:
# free
total used free shared buffers cached
Mem: 3848656 3006944 841712 5316 331020 2028648
-/+buffers/cache: 647276 3201380
Swap: 2031612 0 2031612
# dd if=/dev/sda1 of=/dev/null count=2000
2000+0records in
2000+0records out
1024000bytes(1.0MB)copied,0.026413s,38.8MB/s
# free
total used free shared buffers cached
Mem: 3848656 3007704 840952 5316 331872 2028692
-/+buffers/cache: 647140 3201516
Swap: 2031612 0 2031612
结论:
free 命令所显示的 “buffers” 表示块设备(block device)所占用的缓存页,包括直接读写块设备、以及文件系统元数据(metadata)如SuperBlock所使用的缓存页;
而 “cached” 表示普通文件所占用的缓存页。