ionice: set or get process I/O scheduling class and priority
ionice [-c class] [-n level] [-t] -p PID...
ionice [-c class] [-n level] [-t] command [argument...]
What it does
Classes: 0 none, 1 realtime (root only), 2 best-effort (levels 0-7, 0 highest), 3 idle (only when no one else uses the disk). Only I/O schedulers that implement priorities (BFQ) act on them; virtio disks on Ubuntu use the none scheduler.
Options you will use
-c, --class class- name or number: 0 none, 1 realtime, 2 best-effort, 3 idle.
-n, --classdata level- priority within the class (0-7).
-p, --pid PID...- existing processes.
-t, --ignore- ignore failures to set the priority.
Examples
$ ionice -p 4242show a process's class
$ sudo ionice -c3 -p 4242idle class for a batch job
Gotchas
- To really limit a job's disk bandwidth use the cgroup instead: IOReadBandwidthMax= / IOWriteBandwidthMax= in its unit (io.max).
Try ionice in a real terminal Free, in your browser - a real Ubuntu terminal to try it in, with missions that check your work.