Time Machine is great, especially if hooked up to a network storage device. However, lately the backups have been taking a lot of system and network resources, rendering the machine practically unusable while they run. Videos skip (esp. streaming ones), apps slow down, web browsing freezes...but since Time Machine runs in the background, it's OK to lower the backup daemon's priority and give other processes a "chance" to work smoothly. From the terminal, this is the command that does the trick:
sudo renice +5 -p `ps -axc | grep backupd | awk '{ print \$1 }'` Here's what's going on:
sudo: This runs the command as the root. You will need to enter the administrator password.
renice: This is the standard Unix command for changing the priority of a running application.
+5: Process priorities under BSD Unix-based systems typicall run from -20 to +20, with +20 being lowest (i.e. running slowest) to -20 being maximum (yes, I know it's unintuitively backward, but there's an old historical reason for it). What we're doing is bumping Time Machine daemon's nice priority up by 5 (or any number you want) to let it run slower.
-ppid: This is the process id of the process you want to adjust. Since this changes every time Time Machine runs, we have to have a way to find it dynamically at runtime - which is where the rest of the line enclosed in ` back-quotes come in. On most Unix shells, items enclosed in back-quotes get executed and the result returned back to the command line. So we're going to look up the process ID of the current Time Machine server process and return it here.
ps -axc: The ps command returns a long list of all running processes on the system. We need to filter out the one we want, which we do by piping the output into a grep filter...
grep backupd: We're taking all the output from the ps command and only keeping those lines that contain the string backupd - which happens to be the name of the Time Machine server. So we end up with a single line of ps output that looks something like this: 19041 ?? 1:07.48 backupd but what we need is the process ID to pass back up to the renice command. In this case, it's the first number on the line. We need a way to extract only that, which is where awk comes in...
awk '{print \$1 }': By default, awk splits its input into chunks based on whitespace. We're simply asking it to split up some text and return the first item to us.
When you run this, the sudo part of the command will ask you for your admin password, then proceed to do it's thing. Put it all together and you've got yourself a simple way to slow down Time Machine so it's not such a CPU hog.
Remember, the renice command doesn't stick, so every time you reboot or a new Time Machine session starts, the process goes back to normal priority. There are ways to automate the priority lowering scheme or even make it permanent, but I don't recommend doing that as sometimes, you may want backups to run full-speed.
In order to slow it down to max slowness, use this:
sudo renice +20 -p `ps -axc | grep backupd | awk '{ print \$1 }'`
Speeding up Time Machine
Time Machine is not that great when it needs to do a large backup and appears to take forever. To remedy this, type the following command into terminal (you will be asked for your password):
sudo sysctl debug.lowpri_throttle_enabled=0
The reason for time machines backup being slow is that it defaults to a low priority mode. When you enter the command above it will increase the priority with the cost of using up more resources from your Mac. The benefit here is that the larger backup will go much faster which may be much better at the cost of some power savings.
To revert back to default after you're done, type this: