{"id":323,"date":"2012-08-27T09:23:11","date_gmt":"2012-08-27T08:23:11","guid":{"rendered":"http:\/\/lendl.priv.at\/blog\/?p=323"},"modified":"2026-01-26T12:12:58","modified_gmt":"2026-01-26T11:12:58","slug":"linux-iostat-and-device-names","status":"publish","type":"post","link":"https:\/\/lendl.priv.at\/blog\/2012\/08\/27\/linux-iostat-and-device-names\/","title":{"rendered":"Linux, iostat and device names"},"content":{"rendered":"<p>My favorite tools for looking at the I\/O load of Linux boxes are iotop and iostat. Running &#8220;iostat -xm 5&#8221; is one of the first things I do whenever I have the feeling that a server might be I\/O-bound. The output is perfectly fine and useful on your typical one-disk box, but once you throw in either Xen or DM-Crypt, then the output is not so intuitive any more as it is no longer clear what each of the dm-XX devices is actually holding.<\/p>\n<p>So I whipped up the following quick perl script to translate them:<\/p>\n<p><code><\/p>\n<pre>\n#!\/usr\/bin\/perl -w\n#\n# Replace dm-x names in stdin with names from \/dev\/mapper, e.g.\n# iostat -xm 5 | $0\n#\n# Otmar Lendl, 2012\/08\/24\n#\n\nuse strict;\n\nmy %m;\n\nforeach my $l (split(\/\\n\/, `ls -l \/dev\/mapper`)) {\n# lrwxrwxrwx 1 root root      8 May  3 18:49 vg1-abusehelper--swap -> ..\/dm-21\n        if ($l =~ \/\\d\\d:\\d\\d ([\\w-]+) -> \\.\\.\\\/(dm-\\d+)\/) {\n                $m{$2} = $1;\n        }\n}\n\nwhile(<>) {\n        s\/(dm-\\d+)( *) \/substr($m{$1}. (' ' x 80),0,length($1.$2)).' '\/eg;\n        print;\n}\n<\/pre>\n<p><\/code><\/p>\n<p>The quotes in substitution line should be plain single quotes, not the typographic nonsense that wordpress insists on inserting.<\/p>\n<p>Share and Enjoy!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>My favorite tools for looking at the I\/O load of Linux boxes are iotop and iostat. Running &#8220;iostat -xm 5&#8221; is one of the first things I do whenever I have the feeling that a server might be I\/O-bound. The output is perfectly fine and useful on your typical one-disk box, but once you throw [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-323","post","type-post","status-publish","format-standard","hentry","category-system-administration"],"_links":{"self":[{"href":"https:\/\/lendl.priv.at\/blog\/wp-json\/wp\/v2\/posts\/323","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lendl.priv.at\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lendl.priv.at\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lendl.priv.at\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lendl.priv.at\/blog\/wp-json\/wp\/v2\/comments?post=323"}],"version-history":[{"count":1,"href":"https:\/\/lendl.priv.at\/blog\/wp-json\/wp\/v2\/posts\/323\/revisions"}],"predecessor-version":[{"id":867,"href":"https:\/\/lendl.priv.at\/blog\/wp-json\/wp\/v2\/posts\/323\/revisions\/867"}],"wp:attachment":[{"href":"https:\/\/lendl.priv.at\/blog\/wp-json\/wp\/v2\/media?parent=323"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lendl.priv.at\/blog\/wp-json\/wp\/v2\/categories?post=323"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lendl.priv.at\/blog\/wp-json\/wp\/v2\/tags?post=323"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}