{"id":408,"date":"2023-03-20T06:01:00","date_gmt":"2023-03-20T12:01:00","guid":{"rendered":"http:\/\/blog.supportpro.com\/2011\/01\/ionice\/"},"modified":"2026-03-30T02:46:04","modified_gmt":"2026-03-30T08:46:04","slug":"ionice","status":"publish","type":"post","link":"https:\/\/www.supportpro.com\/blog\/ionice\/","title":{"rendered":"Ionice Command: Set I\/O Scheduling Class and Priority"},"content":{"rendered":"\n<p>The ionice command is used to set I\/O scheduling class and priority for a program.<\/p>\n\n\n\n<p>The I\/O schedule for a program can be changed to the following:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>CFQ<\/li>\n\n\n\n<li>Noop scheduler<\/li>\n\n\n\n<li>Anticipatory<\/li>\n\n\n\n<li>Deadline<\/li>\n<\/ol>\n\n\n\n<p>The current Disk Scheduler can be viewed from<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>root@twenty ~]# cat \/sys\/block\/sd&#91;ab]\/queue\/scheduler<br>noop anticipatory deadline &#91;cfq]<\/strong><\/code><\/pre>\n\n\n\n<p>The current scheduler can be changed by<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>&#91;root@twenty queue]# echo anticipatory &gt; scheduler<br>&#91;root@twenty queue]# cat \/sys\/block\/sda\/queue\/scheduler<br>noop &#91;anticipatory] deadline cfq<\/strong><\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><b>Ionice Utility<\/b><\/h2>\n\n\n\n<p>The ionice sets the io scheduling class and priority for a program or script. It supports the following three scheduling classes<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Idle: A program running with idle io priority will only get disk time when no other program has asked for disk io for a defined grace period. Number-3<\/li>\n\n\n\n<li>Best effort: This is the default scheduling class for any process that hasn&#8217;t asked for a specific io priority. Programs inherit the CPU nice setting for io priorities. This class takes a priority argument from 0-7, with a lower number being a higher priority. Number- 2<\/li>\n\n\n\n<li>Real-time: The RT scheduling class is given first access to the disk, regardless of what else is going on in the system. Thus the RT class needs to be used with some care, as it can starve other processes. Number -1<\/li>\n<\/ol>\n\n\n\n<p>Setting ionice for a pid ( number 3 specifies the scheduling class)<\/p>\n\n\n\n<p>ionice -c3 -p 1004<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>FAQs<\/strong><\/h4>\n\n\n\n<h4 class=\"wp-block-heading\">1. What is an I\/O scheduler in Linux?<\/h4>\n\n\n\n<p>An I\/O scheduler manages how <strong>disk read\/write operations are ordered and processed<\/strong>, helping improve system performance and responsiveness.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">2. How can I check the current I\/O scheduler?<\/h4>\n\n\n\n<p>You can check it using:<br><code>cat \/sys\/block\/sdX\/queue\/scheduler<\/code><br>This shows the active scheduler in brackets.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">3. What is the ionice command used for?<\/h4>\n\n\n\n<p><code>ionice<\/code> is used to <strong>set or change the I\/O priority of a process<\/strong>, allowing better control over disk usage.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">4. What are the ionice scheduling classes?<\/h4>\n\n\n\n<p>There are three classes:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Idle (3):<\/strong> Lowest priority<\/li>\n\n\n\n<li><strong>Best Effort (2):<\/strong> Default priority<\/li>\n\n\n\n<li><strong>Real-Time (1):<\/strong> Highest priority (use carefully)<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">5. How do I change the I\/O scheduler in Linux?<\/h4>\n\n\n\n<p>You can change it using:<br><code>echo scheduler_name &gt; \/sys\/block\/sdX\/queue\/scheduler<\/code><\/p>\n\n\n\n<p>If you require help, <a href=\"https:\/\/www.supportpro.com\/requestquote.php\">contact SupportPRO Server Admin<\/a><\/p>\n\n\n\n<div class=\"wp-block-media-text alignwide has-media-on-the-right is-stacked-on-mobile is-vertically-aligned-center has-white-background-color has-background\"><div class=\"wp-block-media-text__content\">\n<p class=\"has-large-font-size\">Partner with <strong>SupportPRO<\/strong> for 24\/7 proactive cloud support that keeps your business secure, scalable, and ahead of the curve.<\/p>\n\n\n\n<!--HubSpot Call-to-Action Code --><span class=\"hs-cta-wrapper\" id=\"hs-cta-wrapper-3350a795-db50-482f-9911-301930d1b1be\"><span class=\"hs-cta-node hs-cta-3350a795-db50-482f-9911-301930d1b1be\" id=\"hs-cta-3350a795-db50-482f-9911-301930d1b1be\"><!--[if lte IE 8]><div id=\"hs-cta-ie-element\"><\/div><![endif]--><a href=\"https:\/\/cta-redirect.hubspot.com\/cta\/redirect\/2725694\/3350a795-db50-482f-9911-301930d1b1be\" ><img decoding=\"async\" class=\"hs-cta-img\" id=\"hs-cta-img-3350a795-db50-482f-9911-301930d1b1be\" style=\"border-width:0px;\" src=\"https:\/\/no-cache.hubspot.com\/cta\/default\/2725694\/3350a795-db50-482f-9911-301930d1b1be.png\"  alt=\"Contact Us today!\"\/><\/a><\/span><script charset=\"utf-8\" src=\"https:\/\/js.hscta.net\/cta\/current.js\"><\/script><script type=\"text\/javascript\"> hbspt.cta.load(2725694, '3350a795-db50-482f-9911-301930d1b1be', {\"useNewLoader\":\"true\",\"region\":\"na1\"}); <\/script><\/span><!-- end HubSpot Call-to-Action Code -->\n<\/div><figure class=\"wp-block-media-text__media\"><img fetchpriority=\"high\" decoding=\"async\" width=\"904\" height=\"931\" src=\"https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup.png\" alt=\"guy server checkup\" class=\"wp-image-12943 size-full\" srcset=\"https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup.png 904w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup-291x300.png 291w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup-768x791.png 768w, https:\/\/www.supportpro.com\/blog\/wp-content\/uploads\/2022\/09\/Free-server-checkup-585x602.png 585w\" sizes=\"(max-width: 904px) 100vw, 904px\" \/><\/figure><\/div>\n","protected":false},"excerpt":{"rendered":"<p>The ionice command is used to set I\/O scheduling class and priority for a program. The I\/O schedule for a program can be changed to the following: The current Disk&hellip;<\/p>\n","protected":false},"author":4,"featured_media":13077,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[3],"tags":[106],"class_list":["post-408","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technical-articles","tag-server"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/408","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/comments?post=408"}],"version-history":[{"count":5,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/408\/revisions"}],"predecessor-version":[{"id":16142,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/408\/revisions\/16142"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/media\/13077"}],"wp:attachment":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/media?parent=408"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/categories?post=408"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/tags?post=408"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}