Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

share|improve this question
1  
Why do you have a limitation where you can't install anything on the server? You should want to use the right solution versus a compromise. –  ewwhite Jul 21 '13 at 3:34
    
@ewwhite sometimes your clients who want to use a tool don't want or are not allowed to install anything on the system. thats my reason and for your question there are other 1000's of answers and reasons . and thanks for the vote-down –  Ronan Dejhero Jul 25 '13 at 8:22
1  
I didn't downvote. But I wanted to understand the constraint. –  ewwhite Jul 25 '13 at 12:14

2 Answers 2

up vote 2 down vote accepted

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.

share|improve this answer
    
this could do, but still can't get whats need to be done, i think i have to take 2 snapshots with 1 second-diff each, then see the diffs, by this get the kb writes/read /second for that drive right ? –  Ronan Dejhero Jul 22 '13 at 4:00
    
@RonanDejhero: Oh, so you want to monitor the stats, or get a per second measure? I still recommend installing iostat or iotop. They both do exactly what you want. –  Scott Pack Jul 23 '13 at 12:42
    
Thats the problem, i don't want to install anything, or what to say, i don't want users to install anything :) –  Ronan Dejhero Jul 24 '13 at 1:58
1  
@RonanDejhero: No problem. Keep hammering that screw. –  Scott Pack Jul 24 '13 at 2:22

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.

share|improve this answer

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.