Linux – How to estimate hard drive usage on Linux

debianhard drivelinuxmonitoring

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?

Best Answer

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.