Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have dio vicious widget for monitoring IO within an awesome widget. It is defined like so:

diowidget = widget({ type = "textbox" })
vicious.register(diowidget, vicious.widgets.dio, '<span color="#4682b4">${sda read_mb}</span>/<span color="#bf3eff">${sda write_mb}</span>', 3)

However, my hard disk uses lvm and looks like:

; df -h
Filesystem                         Size  Used Avail Use% Mounted on
rootfs                              50G  8.0G   40G  17% /
devtmpfs                           2.0G     0  2.0G   0% /dev
tmpfs                              2.0G  1.8M  2.0G   1% /dev/shm
tmpfs                              2.0G  804K  2.0G   1% /run
/dev/mapper/vg_nightwatch-lv_root   50G  8.0G   40G  17% /
tmpfs                              2.0G     0  2.0G   0% /sys/fs/cgroup
tmpfs                              2.0G     0  2.0G   0% /media
/dev/mapper/vg_nightwatch-lv_home  409G   15G  374G   4% /home

Use "mapper" instead of "sda" gives me an Invalid markup.

What should I use instead?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Use the source, which reads (excerpt)

for line in io.lines("/proc/diskstats") do
    local device, read, write =
        -- Linux kernel documentation: Documentation/iostats.txt
        string.match(line, "([^%s]+) %d+ %d+ (%d+) %d+ %d+ %d+ (%d+)")
    disk_lines[device] = { read, write }
end
[...]
-- Calculate and store I/O
helpers.uformat(disk_usage, device.." read",  read,  unit)
helpers.uformat(disk_usage, device.." write", write, unit)
helpers.uformat(disk_usage, device.." total", read + write, unit)
[...]
return disk_usage

Thus whatever is listed in your /proc/diskstats becomes the key to disk_usage and can thus be queried. I don't use LVM so I cannot guess. It seems fairly complicated, though, since the I/O of a virtual device, well,... what is it you'd like to measure? However, if you use one device only, the numbers would obviously make sense and this hopefully helps you further.

share|improve this answer
    
Clearly, if I wanted detailed information, I would use iostat. All I want is an indication that the hard drive is doing work, so I guess that sda (or whatever) would work well. Thank you. –  Sardathrion Aug 2 '12 at 9:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.