My favorite tools for looking at the I/O load of Linux boxes are iotop and iostat. Running “iostat -xm 5” 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.
So I whipped up the following quick perl script to translate them:
#!/usr/bin/perl -w
#
# Replace dm-x names in stdin with names from /dev/mapper, e.g.
# iostat -xm 5 | $0
#
# Otmar Lendl, 2012/08/24
#
use strict;
my %m;
foreach my $l (split(/\n/, `ls -l /dev/mapper`)) {
# lrwxrwxrwx 1 root root 8 May 3 18:49 vg1-abusehelper--swap -> ../dm-21
if ($l =~ /\d\d:\d\d ([\w-]+) -> \.\.\/(dm-\d+)/) {
$m{$2} = $1;
}
}
while(<>) {
s/(dm-\d+)( *) /substr($m{$1}. (' ' x 80),0,length($1.$2)).' '/eg;
print;
}
The quotes in substitution line should be plain single quotes, not the typographic nonsense that wordpress insists on inserting.
Share and Enjoy!