3

Given the annoying feature of snap's loop devices, my iostat output in an Ubuntu 18.04.02 is kind of like this

Is there a way to filter out loop devices other than | grep -v loop ?

$ iostat -xm
Linux 4.15.0-47-generic (pkara-pc01)    04/22/2019  _x86_64_    (4 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
          19.85    0.03    5.64    2.18    0.00   72.30

Device            r/s     w/s     rMB/s     wMB/s   rrqm/s   wrqm/s  %rrqm  %wrqm r_await w_await aqu-sz rareq-sz wareq-sz  svctm  %util
loop0            0.01    0.00      0.00      0.00     0.00     0.00   0.00   0.00    7.00    0.00   0.00     2.88     0.00   0.50   0.00
loop1            0.06    0.00      0.00      0.00     0.00     0.00   0.00   0.00    1.25    0.00   0.00     1.80     0.00   0.09   0.00
loop2            0.01    0.00      0.00      0.00     0.00     0.00   0.00   0.00    7.47    0.00   0.00     6.57     0.00   1.06   0.00
loop3            0.00    0.00      0.00      0.00     0.00     0.00   0.00   0.00    2.40    0.00   0.00     2.50     0.00   0.00   0.00
loop4            0.01    0.00      0.00      0.00     0.00     0.00   0.00   0.00    8.54    0.00   0.00     2.44     0.00   1.54   0.00
loop5            0.01    0.00      0.00      0.00     0.00     0.00   0.00   0.00   10.29    0.00   0.00     2.86     0.00   0.76   0.00
loop6            0.05    0.00      0.00      0.00     0.00     0.00   0.00   0.00    1.55    0.00   0.00     1.89     0.00   0.17   0.00
loop7            0.06    0.00      0.00      0.00     0.00     0.00   0.00   0.00    1.39    0.00   0.00     1.75     0.00   0.24   0.00
sda              0.07    0.00      0.00      0.00     0.00     0.00   5.32   9.09    9.29   41.60   0.00    12.47     3.20   9.51   0.07
sdb             23.40  103.81      0.40     38.12     8.47    10.16  26.59   8.91    8.48    6.17   0.84    17.49   376.07   0.94  11.93
dm-0            31.96  113.83      0.40     38.08     0.00     0.00   0.00   0.00   12.17   10.89   1.63    12.74   342.57   0.82  12.00
dm-1            31.91  113.30      0.40     38.08     0.00     0.00   0.00   0.00   12.19   10.95   1.63    12.74   344.17   0.83  12.04
dm-2             0.02    0.00      0.00      0.00     0.00     0.00   0.00   0.00    0.51    0.00   0.00    19.90     0.00   0.41   0.00
dm-3             0.05    0.00      0.00      0.00     0.00     0.00   0.00   0.00    9.82   58.91   0.00    10.21     2.91  10.02   0.05
dm-4             0.03    0.00      0.00      0.00     0.00     0.00   0.00   0.00   14.23   64.80   0.00    14.69     3.20  14.35   0.05
loop8            0.02    0.00      0.00      0.00     0.00     0.00   0.00   0.00   10.54    0.00   0.00     9.13     0.00   2.67   0.01
loop9            0.01    0.00      0.00      0.00     0.00     0.00   0.00   0.00   11.83    0.00   0.00     2.66     0.00   1.79   0.00
loop10           0.01    0.00      0.00      0.00     0.00     0.00   0.00   0.00   28.96    0.00   0.00    20.96     0.00   3.20   0.00
loop11           0.01    0.00      0.00      0.00     0.00     0.00   0.00   0.00   31.20    0.00   0.00    20.80     0.00   4.80   0.00
loop12           0.01    0.00      0.00      0.00     0.00     0.00   0.00   0.00   18.56    0.00   0.00     9.28     0.00   1.56   0.00
loop13           0.02    0.00      0.00      0.00     0.00     0.00   0.00   0.00   11.77    0.00   0.00     9.36     0.00   2.12   0.00
loop14           0.01    0.00      0.00      0.00     0.00     0.00   0.00   0.00   13.65    0.00   0.00     9.76     0.00   0.71   0.00
loop15           0.01    0.00      0.00      0.00     0.00     0.00   0.00   0.00   30.40    0.00   0.00    20.96     0.00   4.08   0.00
loop16           0.04    0.00      0.00      0.00     0.00     0.00   0.00   0.00    3.85    0.00   0.00     5.22     0.00   0.49   0.00
loop17           0.03    0.00      0.00      0.00     0.00     0.00   0.00   0.00    5.23    0.00   0.00     2.48     0.00   1.00   0.00
loop18           0.03    0.00      0.00      0.00     0.00     0.00   0.00   0.00    4.66    0.00   0.00     2.50     0.00   0.70   0.00
loop19           0.01    0.00      0.00      0.00     0.00     0.00   0.00   0.00   14.86    0.00   0.00     6.27     0.00   3.29   0.00
loop20           0.02    0.00      0.00      0.00     0.00     0.00   0.00   0.00   12.48    0.00   0.00     9.15     0.00   1.65   0.00
loop21           0.02    0.00      0.00      0.00     0.00     0.00   0.00   0.00    8.66    0.00   0.00     9.83     0.00   1.29   0.00
loop22           0.04    0.00      0.00      0.00     0.00     0.00   0.00   0.00    5.10    0.00   0.00     5.09     0.00   0.70   0.00
loop23           0.01    0.00      0.00      0.00     0.00     0.00   0.00   0.00   16.32    0.00   0.00     3.05     0.00   1.16   0.00
loop24           0.00    0.00      0.00      0.00     0.00     0.00   0.00   0.00   20.60    0.00   0.00     2.50     0.00   4.20   0.00
loop25           0.01    0.00      0.00      0.00     0.00     0.00   0.00   0.00   16.30    0.00   0.00     2.44     0.00   2.37   0.00
loop26           0.00    0.00      0.00      0.00     0.00     0.00   0.00   0.00    0.00    0.00   0.00     1.60     0.00   0.00   0.00

2 Answers 2

0

I could not find a way to exclude loop devices and display the rest, but including particular devices explicitly may help you, i.e.

S_COLORS=always iostat -x -p nvme0n1 -p sda -p sdb -p dm-4

-1

[edited]

Try

iostat -xm -p {device name} # To display only specific device.

You can use sed instead grep,

iostat -xm | sed '/^loop/d'

If am not wrong,

More easy and best way is to pipe and filter. There is no specific way to exclude devices in 'iostat' command.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .