Linux

All about Linux kernel and operating systems that are based on it.
[Random post]

 tags  gallery  RSS

26.6.2023 23:51:49 reposted from juozaspo

Clearing i/o cache on Linux

Running

sync; echo 3 > /proc/sys/vm/drop_caches 

under root or

sudo bash -c 'sync; echo 3 > /proc/sys/vm/drop_caches'

when using sudo helps to avoid some i/o caching issues when benchmarking file system operations such as duplicate finding. Meaning of values (from kernel documentation, https://www.kernel.org/doc/Documentation/sysctl/vm.txt):

To free pagecache:

echo 1 > /proc/sys/vm/drop_caches

To free reclaimable slab objects (includes dentries and inodes):

echo 2 > /proc/sys/vm/drop_caches

To free slab objects and pagecache:

echo 3 > /proc/sys/vm/drop_caches

login