My problem is this: My laptop has a relatively slow disk subsystem (amd I'm not going to buy a better one) and I backup my system using rsync
which works well for me. However, during the backup process, the files read are read into the buffer/cache of the system, which eventually triggers the swap system.
For example, running cat Win10.qcow2 > /dev/null
a 60 GB file will result in
free -h
total used free shared buff/cache available
Mem: 15Gi 2.2Gi 210Mi 170Mi 13Gi 12Gi
Swap: 30Gi 14Mi 30Gi
and if I write to a real device, like my USB backup drive, the swap starts being used, up to a couple of GB. I do have vm.swappiness = 0
in /etc/sysctl
By itself, this is not bad, but because of my slow disk system, the computer becomes less than sprightly in response to inputs. Painfully slow, in fact.
What I would like to have is a method for limiting the amount of page buffer that the process can consume, leaving enough room to run smaller commands, such as opening a terminal.
What I have tried, is using lxc
, which did not limit the system use of buffers, docker
which I could not fully figure out yet, and I'm attempting to get lxd
running, but I'll need some time to figure that one out.
There is a program nocache
which I think works, but rsync
then does not output progress indicators.
By default when
rsync
updates your backup it creates a copy of the file and then moves it into place. To avoid this step you can haversync
write directly to your backup with the--inplace
argument.As per https://linux.die.net/man/1/rsync: