1

Linux uses free RAM to store pages of disk files to speed up overall disk access.

However for the purposes of benchmarking, I want to test the disk read speed and I don't want that speed measurement to be thrown off by disk file data already cached in RAM. Is there a way to either

A) ensure that a new file that I create will not be stored in RAM, or

B) purge RAM of any particular disk file?

I should also say I want to avoid the use of sudo.

1 Answer 1

1

A) For read speeds sudo hdparm -tT --direct /dev/sda does exactly that

B) echo 3 | sudo tee /proc/sys/vm/drop_caches

If you want to avoid using sudo, you could use this: https://github.com/Feh/nocache

A sample command:

nocache time cat file > /dev/null

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .