My backup is killing disk performance. How do I slow it down?

Quick Linux Tip #37:

Try: ionice -c 3 -p $$

Info: ionice sets I/O priority. Class 3 (idle) only allows disk access when no other process needs it.

Examples:

  • $ ionice -c 3 nice -n 19 rsync -av /src /dst  # Throttles CPU + I/O
  • $ ionice -c 2 -n 7 tar -czf backup.tar.gz /data  # Best-effort, low priority
  • $ sudo ionice -c 1 -n 4 -p 1234  # Real-time priority (root only)

Note: Classes: 1=Real-time (root only), 2=Best-effort (default), 3=Idle. Combine ionice with nice for complete system throttling.




LinuxTeck.com
linuxteck@ubuntu:~$ ionice -c 3 -p $$

linuxteck@ubuntu:~$ ionice -n $$ 
idle

linuxteck@ubuntu:~$ ionice -c 3 tar -czf backup.tar.gz /data

linuxteck@ubuntu:~$ iotop -o -b -n 1 | grep tar
3456 idle linuxteck 0.00 B/s 234.56 K/s ?unavailable? tar -czf backup.tar.gz /data
linuxteck@ubuntu:~$

PREVIOUS ARTICLE Quick Linux Tip #36: My connection to a server is slow. Where in the network is the bottleneck? NEXT ARTICLE Quick Linux Tip #38: How do I make my custom app automatically restart on crash?
About John Britto

John Britto Founder & Chief-Editor @LinuxTeck. A Computer Geek and Linux Intellectual having more than 20+ years of experience in Linux and Open Source technologies.

View all posts by John Britto →

Leave a Reply

Your email address will not be published.