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

前端 未结 7 1276
春和景丽
春和景丽 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:07

    Kristof Provost was very close, but in my situation, I didn't want to use dd or write my own software, so the solution was to use the "--drop-cache" option in rsync.

    I have used this many times since creating this question, and it seems to fix the problem completely. One exception was when I am using rsync to copy from a FreeBSD machine, which doesn't support "--drop-cache". So I wrote a wrapper to replace the /usr/local/bin/rsync command, and remove that option, and now it works copying from there too.

    It still uses huge amount of memory for buffers, and seems to keep almost no cache, but works smoothly anyway.

    $ free
                 total       used       free     shared    buffers     cached
    Mem:      24731544   24531576     199968          0   15349680     850624
    -/+ buffers/cache:    8331272   16400272
    Swap:      4194300     602648    3591652
    

提交回复
热议问题