Equivalent of `nice` for filesystem IO?

When I'm running an rsync backup job which involves copying over large files, the machine running the backup (both Mac desktops and Linux servers) grinds to a halt and the load average goes through the roof.

I've tried:

  • niceing the rsync process (doesn't help - the bottleneck is the disk)
  • On Linux, reniceing a kjournald (helps, but seems like a hack and doesn't work on the Mac)
  • Using the --bwlimit rsync flag (helps, but it means all the transfers are slow - even when they don't need to be)

So, is there any way I can "nice" rsync's IO so the machines are useable while the backup is running?

PS: I'm aware of the dangers of rsync on the Mac… But I've used BackupBouncer to verify my backups, though, and they seem OK.


Solution 1:

It looks like the setpriority API on Mac OS X is supposed to be able to alter IO scheduling (see http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man2/setpriority.2.html). I don't have any MacOS handy so I can't test that nice actually changes the IO priority.

On the Linux side, ionice is what you're looking for.

Solution 2:

On linux you can use ionice http://linux.die.net/man/1/ionice