When dd reads a remote file into of=/dev/null, does data get page-cached by Linux?

I executed the command a few times and the transfer rate stays consistent. This may indicate that the file is not being cached during read; I'd like to confirm.


dd if=/nfs/sample.txt of=/dev/null

I checked a related question and did not see an answer.
DD from /dev/zero to /dev/null...what actually happens

  • And the size of the /nfs/sample.txt file is? Is there a network transfer involved? – Hannu Jul 13 '17 at 17:29
  • Yes, if=/nfs implies I am pulling the file from the network. It could be 1 byte or 1G. Does that matter? – Vortex Jul 13 '17 at 22:19
  • Yes, the size of the file matters. If the file is larger than the amount of memory available for a page cache, then the operating system will start discarding the first part of the file from cache by the time it’s reading the last part.  Therefore, the next time you run the command, it will be forced to read the entire file from the network again.  If the file is significantly smaller than the cache, then it’s possible that the entire file will still be in cache when the first command execution finishes, making it available for use for subsequent runs. – G-Man Jul 17 '17 at 8:07

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.