I can use vmstat
on ubuntu linux to show IO input and output stats. Whether there is a build-in command in MacOS do the same output?
procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
r b swpd free buff cache si so bi bo in cs us sy id wa st
0 0 0 266800 1408168 25417796 0 0 3 76 35 46 1 1 98 0 0
0 0 0 266708 1408168 25417796 0 0 0 1032 1693 4065 1 1 98 0 0
0 0 0 267156 1408168 25417808 0 0 0 0 1819 4443 2 1 97 0 0
0 0 0 266872 1408168 25417828 0 0 0 12 1298 3724 1 1 98 0 0
I can use iostat
to check disk IO stats but it doesn't show input and output. It shows a total number of bytes on the disk.
I don't want to install 3rd party library to do that. Is there a command I can use on Mac?
Best Answer
The closest thing to getting IO r/w info is
iotop
command, which comes with all Mac OS (seedisk_r
anddisk_w
).If you are running on Mac OSX 10.10 (El Capitan) or later, then you need to first disable the SIP (System Integration Protection) for
dtrace
in order to runiotop
becauseiotop
usesdtrace
. For older OSX, you can ignore the following steps.To disable SIP for dtrace (and iotop) for Mac OSX 10.10 and above:
csrutil disable
(this is a temporary step)csrutil enable --without dtrace
. (It re-enables SIP except for dtrace)Now you can run
iotop
anddtrace
.csrutil enable
and reboot.