If you're maintaining a lot of with multiple hard-drives you'll need to know how to manage and watch your harddrives. You know it's getting full or needs cleaning before it's too late and your users can't complete their work because they're out of disk-space. Nothing is worse than franticly trying to reclaim disk-space because you ran out of it. This guide will hopefully aide you in a time-savinf manner.
First of all: check the usage of your hard-drive(s)!
As you can see my hda3 is at 82%. With the help of scripts you can have this task done at given times, and get an e-mail notification if the percentage of used disk-space reaches a certain threshold.
First we will make a basic that will report if any paritions are over 80%.
The egrep statement will match any usage between 80% and 100%.
Now let's do this as a timed event:
Type crontab -e to start an empty file where you can add all your cron jobs. (for more info type man 5 crontab)
Now to make a basic cron job that will run everyday at 10p.m..
The first number, 0, indicates the minute, the second, 22, is the hour that your job is supposed to run at. The next three *'s are day of month, the month, and day of week respectively.
Finally to have this cron job email you if any of your partition's are filled 80% or more you just add the mail command, like so:
The -s is for subject and firstname.lastname@example.org will be replaced by your email address.
Let me know what you think about this guide. If you like it, or if it wasn't useful. Any feedback is greatly encouraged. Thanks