The Linux Page

nice and ionice for Linux users

By default, a computer system gives each process the same priority level in regard to accessing your hard drive.

With newer versions of Linux, it is possible to use two other priorities: one where I/O is not primordial and thus you do not get it if anyone else wants it, and one where you want to work in realtime and have priority over anyone else.

This is achieved with the ionice command line (or corresponding kernel calls.)

This is particularly useful if you want to copy a partition to another and you know that it will take 20 minutes to copy everything... and thus the computer will be close to unusable during that time... unless you start the copy with ionice and let other processes use I/O as much as they want while you sit around.

The ionice help screen goes like this:

prompt# ionice -h
Usage: ionice [OPTIONS] [COMMAND [ARG]...]
Sets or gets process io scheduling class and priority.

    -n    Class data (typically 0-7, lower being higher prio)
    -c    Scheduling class
            1: realtime, 2: best-effort, 3: idle
    -p    Process pid
    -h    This help page

Jens Axboe (C) 2005

So, to run a command such as tripwire with a low priority, one goes this:

ionice -c3 tripwire

In most cases, you can just use the -c3 or -c1 options. Note that -c2 is generally not useful. The -n can be used to make the priority lower or higher.

The -p option let you change the I/O processing mode of a running process.

I'm now using this for my rsync commands and tripwire. That allows Apache to work better while one of those tools is running concurrently.

Re: nice and ionice for Linux users

He! He! 8-)

Okay, thank you. I corrected the page.

Re: nice and ionice for Linux users

ionode?