How can I limit the cache used by copying so there is still memory available for other cache?

前端 未结 7 1277
春和景丽
春和景丽 2020-12-29 22:51

Basic situation:

I am copying some NTFS disks in openSuSE. Each one is 2TB. When I do this, the system runs slow.

My guesses:

7条回答
  •  鱼传尺愫
    2020-12-29 23:08

    It's not possible if you're using plain old cp, but if you're willing to re-implement or patch it yourself setting posix_fadvise(fd, 0, 0, POSIX_FADV_NOREUSE) on both input and output file will probably help.

    posix_fadvise() tells the kernel about your intended access pattern. In this case, you'd only use the data once so there's no point in caching it. The Linux kernel honours these flags, so shouldn't be caching the data any more.

提交回复
热议问题