Tag Archives: io

ionice: It’s nice to be nice to the nice

I don’t use ionice as much as I should. I know better, but it’s always an afterthought to me. Mea culpa.

ionice works where nice doesn’t. The best example I can think of is laggy behavior on disk transfers, like copying a giant file from one place to another.

You can nice the copy process all you want, but you’ll probably still sense some lag, because you’re just devoting more processor priority to cp, which isn’t where the problem lies.

To that end, next time you are waiting for a big file to decrypt, or you’re splitting volumes in the background, try. …

sudo ionice -c3 -p###

where ### is the process number for the copy process or gnupg or split or whatever. Class 3 sets it to “idle,” meaning so long as nothing else needs disk access, this process can do as it wants. Otherwise, it takes a back seat.

I think I first learned about this from jdong’s website, years ago. The page is still there, and so is a gimmick to switch your whole shell process — and therefore everything subsequent that you start from there — to idle process. Take a peek; it’s a short but useful read.

ionice is part of util-linux. 😉