# Disk Monitoring

### Introduction

As with other subsystems that have specific devices, collectl can report disk summary as well as detail data. Like other summary data, disk summary data represents the total activity across all disks or to be more precise, those enumerated in /proc/diskstats, with the following caveats:

- Partition data is skipped by default for both summary and detail data, noting filters contain a trailing letter-space
- Only those disk names that explicitly match the pattern in DiskFilter (see collectl.conf) are collected and subseqently included in the results. You can also override this on demand by specifying --rawdskfilt. Note that in both cases any disks not selected will not have any data recorded for them.
- You can force collectl to collect/report partition level details by specifying a disk filter without the trailing space. If you do so, the partition data will NOT be included in the summary stats since that would result in double counting.
- If you specify a filter with --diskfilt, these filters are only applied to output and allow you to report on a subset of disks for which data has been collected.
- Device mapper disks, while listed in the detail data are NOT included in the summary data to avoid double counting

The three key counters for disk activity are bytes, iops and merges, though only bytes and iops are reported in brief summary mode. The average I/O size which is also reportd in verbose and detail modes may be optionally included in brief mode by including --iosize or --dskopts i. If you're not sure why/when you'd care about summary data, be sure to read this.

Disk detail goes a step further and in addition to including the same information that's reported for summary data also includes key device specific metrics relating to queue lengths, wait and service times as well as utilization. For those familiar with iostat, this is the same data it reports. These numbers will help you determine if your individual disks are operating properly since high wait and/or service times are a bad thing and indicate something is causing an undesired delay somewhere.

Filtering
If you'd like to limit the disks included in either the detail output or the summary totals, you can explicity include or exclude them using --dskfilt. The target of this switch is actually one or more perl expressions, but if you don't know perl all you really need to know is these are strings that are compared to each disk name. If the first (or only) name is preceded with a ^, disks that match the string(s) will be excluded.

No filtering...

    collectl -sD
    # DISK STATISTICS (/sec)
    #          <---------reads---------><---------writes---------><--------averages--------> Pct
    #Name       KBytes Merged  IOs Size  KBytes Merged  IOs Size  RWSize  QLen  Wait SvcTim Util
    sda              0      0    0    0     291     67    5   58      58     0     0      0    0
    sdb              0      0    0    0       0      0    0    0       0     0     0      0    0
    dm-0             0      0    0    0     291      0   73    4       4     0     1      0    0
    dm-1             0      0    0    0       0      0    0    0       0     0     0      0    0
    hda              0      0    0    0       0      0    0    0       0     0     0      0    0

Only include sd disks...

    collectl -sD --dskfilt sd
    # DISK STATISTICS (/sec)
    #          <---------reads---------><---------writes---------><--------averages--------> Pct
    #Name       KBytes Merged  IOs Size  KBytes Merged  IOs Size  RWSize  QLen  Wait SvcTim Util
    sda              0      0    0    0       0      0    0    0       0     0     0      0    0
    sdb              0      0    0    0       0      0    0    0       0     0     0      0    0

Exclude sd and dm disks...

    collectl -sD --dskfilt ^sd,dm
    # DISK STATISTICS (/sec)
    #          <---------reads---------><---------writes---------><--------averages--------> Pct
    #Name       KBytes Merged  IOs Size  KBytes Merged  IOs Size  RWSize  QLen  Wait SvcTim Util
    hda              0      0    0    0       0      0    0    0       0     0     0      0    0

Exclude disks with the letter 'a' in their name...

    collectl -sD --dskfilt ^a
    # DISK STATISTICS (/sec)
    #          <---------reads---------><---------writes---------><--------averages--------> Pct
    #Name       KBytes Merged  IOs Size  KBytes Merged  IOs Size  RWSize  QLen  Wait SvcTim Util
    sdb              0      0    0    0       0      0    0    0       0     0     0      0    0
    dm-0             0      0    0    0       0      0    0    0       0     0     0      0    0
    dm-1             0      0    0    0       0      0    0    0       0     0     0      0    0

Dynamic Disk Discovery
Dynamic disks are handled by the exact same algorithms that are applied to dynamic networks and while they have not yet been found to have the same problems as netoworks do with potentially hundreds of orphaned names no longer in use, the same logic for dealing with stale disks has been added to netowrk processing data and rather than be repetitious, read the descrption for dynamic network processing and learn how the new disk option --dskopts o would be applied.

updated Sept 4, 2013