is there any simple bash command to show current disk read/write usage without installing anything on the machine ?
please note it's not to test the hdd read/write speed, it's to know the current data size being written/read into the hdd
thanks
is there any simple bash command to show current disk read/write usage without installing anything on the machine ?
please note it's not to test the hdd read/write speed, it's to know the current data size being written/read into the hdd
thanks
Honestly, you really want to install iostat
but if you really must work off a base system you can get this out of /proc/diskstats
, though it will require some decoding. For example, if you want to know the total number of read and write operations that have happened you can do this (for my examples I'm looking at partition sda1).
awk '/sda1 / {print $4,$8}' /proc/diskstats
Or if you want to know about the number of bytes read and written you can do this. We perform the multiplication because the values given are in sectors, which are 512 bytes.
awk '/sda1 / {print $6*2" KB",$10*2" KB"}' /proc/diskstats
For all the fields you can check out the documentation in iostats.txt. Keep in mind that you'll have to add 3 to each of the fields to account for the text processing offset due to device major/minor/name in the output.
iostat
will show the current disk usage, while sar
can show you the historical usage (among many other things). Both are part of the sysstat
package, which may or may not be installed.