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

I have a Linux server (Debian) that serves several thousands of live connections.

It is easy to find out the memory and CPU usage (in percent) of my system, so I can predict when I will need to upgrade those hardware components.

However, I don't know how to estimate hard drive usage, by which I mean performance not space used.

My primary question is, how can I find out what the rate of my hard drive usage is on Linux?

However, maybe I am asking the wrong question. If so, could you give some clue why? And what information about hard drive should I be aware of to keep the situation under control?

share|improve this question
    
You switch between "hardware" and "hard drive", so it's unclear what you're looking for. Are you looking for a way to check the disk usage on your drives, e.g., available disk space (in which case, run df -h)? –  cjc Feb 28 '12 at 15:00
    
thank you, I've edited the post –  tsds Feb 28 '12 at 15:02
    
It's still unclear wether you are talking about I/O throughput or space usage or both. These are very different metrics. –  SvW Feb 28 '12 at 15:05

3 Answers 3

up vote 5 down vote accepted

Edited a little to make more sense relating to general performance...

As you are talking about disk utilzation rather than disk space you are probably interested in the values such as Disk latency, and IO service times. as they represent what the customer experiences in use of the disk, where as stuff like throughput is nice to know but it isn't a measure of end user experience.

If you take metrics using a tool like munin, after a while you will have a record of filesystem metrics from which you can estimate trends, assuming that your performance usage increase is representative.

Some alternatives for collecting data are collectd, cacti and various nagios plugins.

Update: as you have the data you need in munin, If you really wanted to make a rate of change number estimate which you could use to say "On this day in June 2014, I will need a new disk!". Then I would probably come up with some command line that queried the rrd file directly (as a starting point) eg

rrdtool fetch /var/lib/munin/hpl.hp.com/SERVERNAMEHERE-diskstats_utilization-cciss_c0d0_util-g.rrd AVERAGE

You would have to checkout the rrdtool fetch documentation directly, but I would just find a moving average of the difference between the successive 5 minute values for the disk utilization series that you are interested. You can then times that number by 12*24 to get the daily disk stats rate change. however that would be quite silly.

here are some example charts from the demo; http://munin.ping.uio.no/ping.uio.no/colosseum.ping.uio.no/index.html#disk

You should also install the smartd tools to catch any impending disk failures, i think it has helped me out with a message more than once.

share|improve this answer
    
yes, I do use munin, but I don't know what munin graphic should I use. –  tsds Feb 28 '12 at 15:06
    
my disk usage statistics for my servers are at /var/lib/munin/hpl.hp.com/myhostname-here-diskstats_utilization-cciss_c0d0-util‌​-g.rrd so I would try something that involved querying that dataset and coming up with a rate of increase number –  Tom H Feb 28 '12 at 15:17
    
although throughput is probably useful for calculating total capacity when you scale to multiple disks and units –  Tom H Feb 29 '12 at 12:49

iostat (apt-get install sysstat) and iotop (apt-get install iotop) will give you an insight on what your drives are doing (how much I/O load they're handling, and what processes are causing it).

vmstat has useful I/O metrics too. Look under the swap and io headers.

For actual disk usage (as in: space) df and du are standard, reporting global data for your mounts and directory sizes respectively.

share|improve this answer

The sort of blunt, manual way to get disk usage is to run df -h. You'll get something that looks like:

$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1              30G  5.2G   23G  19% /
none                  746M  108K  746M   1% /dev
none                  776M     0  776M   0% /dev/shm
none                  776M  108K  776M   1% /var/run
none                  776M     0  776M   0% /var/lock
none                  776M     0  776M   0% /lib/init/rw

You can run this at regular intervals to get a usage rate. Note that you can run df -k to get more script-friendly numbers. Check man df for details.

If you're concerned about running out of space, look into installing a monitoring tool like Monit. The free version should be available as a package in most distros, and it's pretty simple to set up. You would set an alert level, and it will send an email once it gets to, say, 90% full. If you want nice graphs, look at Munin and the like.

share|improve this answer
    
sorry, I didn't noticed it clearly in my original post - I'm interested in performance of my hard drive –  tsds Feb 28 '12 at 15:11

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.